[Olsr-cvs] olsrd-current/src build_msg.c, 1.37, 1.38 defs.h, 1.65, 1.66 duplicate_set.c, 1.18, 1.19 generate_msg.c, 1.25, 1.26 hna_set.c, 1.23, 1.24 hysteresis.c, 1.21, 1.22 interfaces.c, 1.35, 1.36 interfaces.h, 1.43, 1.44 ipc_frontend.c, 1.37, 1.38 ipc_frontend.h, 1.15, 1.16 link_set.c, 1.76, 1.77 local_hna_set.c, 1.15, 1.16 lq_avl.c, 1.13, 1.14 lq_avl.h, 1.11, 1.12 lq_packet.c, 1.28, 1.29 lq_route.c, 1.56, 1.57 main.c, 1.101, 1.102 mid_set.c, 1.22, 1.23 mid_set.h, 1.15, 1.16 mpr.c, 1.19, 1.20 mpr_selector_set.c, 1.19, 1.20 neighbor_table.c, 1.34, 1.35 net_olsr.c, 1.31, 1.32 net_olsr.h, 1.14, 1.15 olsr.c, 1.60, 1.61 olsr_protocol.h, 1.22, 1.23 olsr_types.h, 1.11, 1.12 packet.c, 1.25, 1.26 parser.c, 1.35, 1.36 parser.h, 1.11, 1.12 plugin_util.c, 1.7, 1.8 print_packet.c, 1.12, 1.13 process_package.c, 1.42, 1.43 process_package.h, 1.12, 1.13 process_routes.c, 1.37, 1.38 rebuild_packet.c, 1.22, 1.23 rebuild_packet.h, 1.8, 1.9 routing_table.c, 1.32, 1.33 routing_table.h, 1.23, 1.24 scheduler.c, 1.43, 1.44 tc_set.c, 1.35, 1.36 tc_set.h, 1.21, 1.22 two_hop_neighbor_table.c, 1.19, 1.20 two_hop_neighbor_table.h, 1.14, 1.15

Bernd Petrovitsch (spam-protected)
Thu Nov 8 23:47:44 CET 2007


Update of /cvsroot/olsrd/olsrd-current/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/src

Modified Files:
	build_msg.c defs.h duplicate_set.c generate_msg.c hna_set.c 
	hysteresis.c interfaces.c interfaces.h ipc_frontend.c 
	ipc_frontend.h link_set.c local_hna_set.c lq_avl.c lq_avl.h 
	lq_packet.c lq_route.c main.c mid_set.c mid_set.h mpr.c 
	mpr_selector_set.c neighbor_table.c net_olsr.c net_olsr.h 
	olsr.c olsr_protocol.h olsr_types.h packet.c parser.c parser.h 
	plugin_util.c print_packet.c process_package.c 
	process_package.h process_routes.c rebuild_packet.c 
	rebuild_packet.h routing_table.c routing_table.h scheduler.c 
	tc_set.c tc_set.h two_hop_neighbor_table.c 
	two_hop_neighbor_table.h 
Log Message:
Another fat commit:

The main target was:
- Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom
  "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of
  temporary variables to call inet_ntoa()/inet_ptoa() vanished .....
- declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface"
  as "struct sockaddr_in" since it is that what we actually want there (and
  it is similar to the IPv6 code).

To get that thoroughly via compiler errors, we get:
- We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string()
  to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr"
  into a string buffer.

Alas, this also annoyed me since ages:
- cleanup: olsr_ip_to_string() and similar non-reentrant functions now must
  get a target buffer. To ease that, there is the "struct ipaddr_str"
  which is large enough for all of them (read: for an IPv6 address). This
  also removes the cyclic buffer there.
  All of these function return a "const char *" which can be directly used
  for printf(3) and friends.

And some cleanups:
- const'ified more functions
- converted the source to UTF-8.
- "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char")
- force the few inline function to always be inlined.
- #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table()
  if nothing is done
- use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()"
- clean up the routes on more signals. Basically we want to do this on all
  signals which terminate the program.
- killed a superflous global buffer in src/main.c

This version was breing since weeks and running for severa day in Vienna's
FunkFeuer net without any noticably problem!

Please report anything that broke!



Index: lq_route.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** lq_route.c	5 Nov 2007 15:32:55 -0000	1.56
--- lq_route.c	8 Nov 2007 22:47:41 -0000	1.57
***************
*** 54,57 ****
--- 54,58 ----
  #include "lq_avl.h"
  #include "lq_route.h"
+ #include "net_olsr.h"
  
  /*
***************
*** 65,69 ****
   */
  static int
! avl_comp_etx (void *etx1, void *etx2)
  {       
    if (*(float *)etx1 < *(float *)etx2) {
--- 66,70 ----
   */
  static int
! avl_comp_etx (const void *etx1, const void *etx2)
  {       
    if (*(float *)etx1 < *(float *)etx2) {
***************
*** 87,90 ****
--- 88,94 ----
                          struct tc_entry *vert)
  {
+ #if !defined(NODEBUG) && defined(DEBUG)
+   struct ipaddr_str buf;
+ #endif
    vert->cand_tree_node.key = &vert->path_etx;
    vert->cand_tree_node.data = vert;
***************
*** 92,96 ****
  #ifdef DEBUG
    OLSR_PRINTF(1, "SPF: insert candidate %s, cost %f\n",
!               olsr_ip_to_string(&(vert->addr)),
                vert->path_etx);
  #endif
--- 96,100 ----
  #ifdef DEBUG
    OLSR_PRINTF(1, "SPF: insert candidate %s, cost %f\n",
!               olsr_ip_to_string(&buf, &vert->addr),
                vert->path_etx);
  #endif
***************
*** 110,115 ****
  
  #ifdef DEBUG
    OLSR_PRINTF(1, "SPF: delete candidate %s, cost %f\n",
!               olsr_ip_to_string(&(vert->addr)),
                vert->path_etx);
  #endif
--- 114,122 ----
  
  #ifdef DEBUG
+ #ifndef NODEBUG
+   struct ipaddr_str buf;
+ #endif
    OLSR_PRINTF(1, "SPF: delete candidate %s, cost %f\n",
!               olsr_ip_to_string(&buf, &vert->addr),
                vert->path_etx);
  #endif
***************
*** 128,138 ****
                          struct tc_entry *vert)
  {
    vert->path_list_node.data = vert;
  
  #ifdef DEBUG
    OLSR_PRINTF(1, "SPF: append path %s, cost %f, via %s\n",
!               olsr_ip_to_string(&(vert->addr)),
                vert->path_etx,
!               vert->next_hop ? olsr_ip_to_string(&vert->next_hop->neighbor_iface_addr) : "-");
  #endif
  
--- 135,148 ----
                          struct tc_entry *vert)
  {
+ #if !defined(NODEBUG) && defined(DEBUG)
+   struct ipaddr_str pathbuf, nbuf;
+ #endif
    vert->path_list_node.data = vert;
  
  #ifdef DEBUG
    OLSR_PRINTF(1, "SPF: append path %s, cost %f, via %s\n",
!               olsr_ip_to_string(&pathbuf, &vert->addr),
                vert->path_etx,
!               vert->next_hop ? olsr_ip_to_string(&nbuf, &vert->next_hop->neighbor_iface_addr) : "-");
  #endif
  
***************
*** 177,188 ****
  olsr_spf_relax (struct avl_tree *cand_tree, struct tc_entry *vert)
  {
-   struct tc_entry *new_vert;
-   struct tc_edge_entry *tc_edge;
    struct avl_node *edge_node;
    float new_etx;
  
  #ifdef DEBUG
    OLSR_PRINTF(1, "SPF: exploring node %s, cost %f\n",
!               olsr_ip_to_string(&vert->addr),
                vert->path_etx);
  #endif
--- 187,199 ----
  olsr_spf_relax (struct avl_tree *cand_tree, struct tc_entry *vert)
  {
    struct avl_node *edge_node;
    float new_etx;
  
  #ifdef DEBUG
+ #ifndef NODEBUG
+   struct ipaddr_str buf, nbuf;
+ #endif
    OLSR_PRINTF(1, "SPF: exploring node %s, cost %f\n",
!               olsr_ip_to_string(&buf, &vert->addr),
                vert->path_etx);
  #endif
***************
*** 194,199 ****
         edge_node;
         edge_node = avl_walk_next(edge_node)) {
! 
!     tc_edge = edge_node->data;
  
      /*
--- 205,210 ----
         edge_node;
         edge_node = avl_walk_next(edge_node)) {
!     struct tc_entry *new_vert;
!     struct tc_edge_entry *tc_edge = edge_node->data;
  
      /*
***************
*** 203,207 ****
  #ifdef DEBUG
        OLSR_PRINTF(1, "SPF:   ignoring edge %s\n",
!                   olsr_ip_to_string(&tc_edge->T_dest_addr));
        if (tc_edge->flags & OLSR_TC_EDGE_DOWN) {
          OLSR_PRINTF(1, "SPF:     edge down\n");
--- 214,218 ----
  #ifdef DEBUG
        OLSR_PRINTF(1, "SPF:   ignoring edge %s\n",
!                   olsr_ip_to_string(&buf, &tc_edge->T_dest_addr));
        if (tc_edge->flags & OLSR_TC_EDGE_DOWN) {
          OLSR_PRINTF(1, "SPF:     edge down\n");
***************
*** 222,226 ****
  #ifdef DEBUG
        OLSR_PRINTF(1, "SPF:   exploring edge %s, cost %s\n",
!                   olsr_ip_to_string(&(tc_edge->T_dest_addr)),
                    olsr_etx_to_string(new_etx));
  #endif
--- 233,237 ----
  #ifdef DEBUG
        OLSR_PRINTF(1, "SPF:   exploring edge %s, cost %s\n",
!                   olsr_ip_to_string(&buf, &tc_edge->T_dest_addr),
                    olsr_etx_to_string(new_etx));
  #endif
***************
*** 231,234 ****
--- 242,246 ----
         */
      new_vert = tc_edge->edge_inv->tc;
+ 
      if (new_etx < new_vert->path_etx) {
  
***************
*** 250,258 ****
  #ifdef DEBUG
        OLSR_PRINTF(1, "SPF:   better path to %s, cost %s -> %s, via %s, hops %u\n",
!                   olsr_ip_to_string(&new_vert->addr),
                    olsr_etx_to_string(new_vert->path_etx),
                    olsr_etx_to_string(new_etx),
!                   olsr_ip_to_string(vert->next_hop ?
!                                     &vert->next_hop->neighbor_iface_addr : NULL),
                    new_vert->hops);
  #endif
--- 262,269 ----
  #ifdef DEBUG
        OLSR_PRINTF(1, "SPF:   better path to %s, cost %s -> %s, via %s, hops %u\n",
!                   olsr_ip_to_string(&buf, &new_vert->addr),
                    olsr_etx_to_string(new_vert->path_etx),
                    olsr_etx_to_string(new_etx),
!                   vert->next_hop ? olsr_ip_to_string(&nbuf, &vert->next_hop->neighbor_iface_addr) : "<none>",
                    new_vert->hops);
  #endif
***************
*** 410,414 ****
  
      if (!link) {
!       OLSR_PRINTF(2, "%s no next-hop\n", olsr_ip_to_string(&vert->addr));
        continue;
      }
--- 421,428 ----
  
      if (!link) {
! #ifndef NODEBUG
!       struct ipaddr_str buf;
! #endif
!       OLSR_PRINTF(2, "%s no next-hop\n", olsr_ip_to_string(&buf, &vert->addr));
        continue;
      }

Index: rebuild_packet.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** rebuild_packet.h	21 Nov 2004 11:28:56 -0000	1.8
--- rebuild_packet.h	8 Nov 2007 22:47:41 -0000	1.9
***************
*** 50,66 ****
  
  void
! hna_chgestruct(struct hna_message *, union olsr_message *);
  
  void
! mid_chgestruct(struct mid_message *, union olsr_message *);
  
  void
! unk_chgestruct(struct unknown_message *, union olsr_message *);
  
  void
! hello_chgestruct(struct hello_message *, union olsr_message *);
  
  void
! tc_chgestruct(struct tc_message *, union olsr_message *, union olsr_ip_addr *);
  
  #endif
--- 50,66 ----
  
  void
! hna_chgestruct(struct hna_message *, const union olsr_message *);
  
  void
! mid_chgestruct(struct mid_message *, const union olsr_message *);
  
  void
! unk_chgestruct(struct unknown_message *, const union olsr_message *);
  
  void
! hello_chgestruct(struct hello_message *, const union olsr_message *);
  
  void
! tc_chgestruct(struct tc_message *, const union olsr_message *, const union olsr_ip_addr *);
  
  #endif

Index: rebuild_packet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** rebuild_packet.c	28 Aug 2007 20:45:17 -0000	1.22
--- rebuild_packet.c	8 Nov 2007 22:47:41 -0000	1.23
***************
*** 46,49 ****
--- 46,50 ----
  #include "mid_set.h"
  #include "mantissa.h"
+ #include "net_olsr.h"
  
  /**
***************
*** 57,61 ****
  
  void
! hna_chgestruct(struct hna_message *hmsg, union olsr_message *m)
  {
    struct hna_net_addr *hna_pairs, *tmp_pairs;
--- 58,62 ----
  
  void
! hna_chgestruct(struct hna_message *hmsg, const union olsr_message *m)
  {
    struct hna_net_addr *hna_pairs, *tmp_pairs;
***************
*** 70,76 ****
      {
        /* IPv4 */
!       struct hnapair *haddr;
! 
!       haddr = m->v4.message.hna.hna_net;
  
        /*
--- 71,75 ----
      {
        /* IPv4 */
!       const struct hnapair *haddr = m->v4.message.hna.hna_net;
  
        /*
***************
*** 81,89 ****
        no_pairs = (ntohs(m->v4.olsr_msgsize) - 12) / 8;
        
!       COPY_IP(&hmsg->originator, &m->v4.originator);
        hmsg->packet_seq_number = ntohs(m->v4.seqno);
        hmsg->hop_count =  m->v4.hopcnt;
  
!       //printf("HNA from %s\n\n", olsr_ip_to_string((union olsr_ip_addr *)&hmsg->originator));
  
        /* Get vtime */
--- 80,90 ----
        no_pairs = (ntohs(m->v4.olsr_msgsize) - 12) / 8;
        
!       //COPY_IP(&hmsg->originator, &m->v4.originator);
!       hmsg->originator.v4.s_addr = m->v4.originator;
! 
        hmsg->packet_seq_number = ntohs(m->v4.seqno);
        hmsg->hop_count =  m->v4.hopcnt;
  
!       //printf("HNA from %s\n\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&hmsg->originator));
  
        /* Get vtime */
***************
*** 94,118 ****
  
        for(i = 0; i < no_pairs; i++)
! 	{
! 	  
  	  hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct");
  	  
! 	  
! 	  COPY_IP(&hna_pairs->net, &haddr->addr);
! 	  COPY_IP(&hna_pairs->netmask, &haddr->netmask);
  	  hna_pairs->next = tmp_pairs;
  	  
  	  tmp_pairs = hna_pairs;
  	  haddr++;
-       
  	}
- 
      }
    else
      {
        /* IPv6 */
!       struct hnapair6 *haddr6;
! 
!       haddr6 = m->v6.message.hna.hna_net;
  
        /*
--- 95,116 ----
  
        for(i = 0; i < no_pairs; i++)
! 	{	  
  	  hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct");
  	  
! 	  //COPY_IP(&hna_pairs->net, &haddr->addr);
!           hna_pairs->net.v4.s_addr = haddr->addr;
! 	  //COPY_IP(&hna_pairs->netmask, &haddr->netmask);
!           hna_pairs->netmask.v4 = haddr->netmask;
! 
  	  hna_pairs->next = tmp_pairs;
  	  
  	  tmp_pairs = hna_pairs;
  	  haddr++;
  	}
      }
    else
      {
        /* IPv6 */
!       const struct hnapair6 *haddr6 = m->v6.message.hna.hna_net;
  
        /*
***************
*** 123,127 ****
        no_pairs = (ntohs(m->v6.olsr_msgsize) - 24) / 32; /* NB 32 not 8 */
        
!       COPY_IP(&hmsg->originator, &m->v6.originator);
        hmsg->packet_seq_number = ntohs(m->v6.seqno);
        hmsg->hop_count =  m->v6.hopcnt;
--- 121,126 ----
        no_pairs = (ntohs(m->v6.olsr_msgsize) - 24) / 32; /* NB 32 not 8 */
        
!       //COPY_IP(&hmsg->originator, &m->v6.originator);
!       hmsg->originator.v6 = m->v6.originator;
        hmsg->packet_seq_number = ntohs(m->v6.seqno);
        hmsg->hop_count =  m->v6.hopcnt;
***************
*** 138,142 ****
  	  hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct 2");	  
  	  
! 	  COPY_IP(&hna_pairs->net, &haddr6->addr);
  	  hna_pairs->netmask.v6 = olsr_netmask_to_prefix((union olsr_ip_addr *)&haddr6->netmask);
  
--- 137,142 ----
  	  hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct 2");	  
  	  
! 	  //COPY_IP(&hna_pairs->net, &haddr6->addr);
! 	  hna_pairs->net.v6 = haddr6->addr;
  	  hna_pairs->netmask.v6 = olsr_netmask_to_prefix((union olsr_ip_addr *)&haddr6->netmask);
  
***************
*** 144,152 ****
  	  
  	  tmp_pairs = hna_pairs;
! 	  haddr6++;
! 	  
  	}
- 
-       
      }      
  
--- 144,149 ----
  	  
  	  tmp_pairs = hna_pairs;
! 	  haddr6++;	  
  	}
      }      
  
***************
*** 180,184 ****
  
  void
! mid_chgestruct(struct mid_message *mmsg, union olsr_message *m)
  {
    int i;
--- 177,181 ----
  
  void
! mid_chgestruct(struct mid_message *mmsg, const union olsr_message *m)
  {
    int i;
***************
*** 195,201 ****
      {
        /* IPv4 */
!       struct midaddr *maddr;
! 
!       maddr = m->v4.message.mid.mid_addr;
        /*
         * How many aliases?
--- 192,196 ----
      {
        /* IPv4 */
!       const struct midaddr *maddr = m->v4.message.mid.mid_addr;
        /*
         * How many aliases?
***************
*** 206,211 ****
  
        //printf("Aliases: %d\n", no_aliases);
!       COPY_IP(&mmsg->mid_origaddr, &m->v4.originator);
!       COPY_IP(&mmsg->addr, &m->v4.originator);
        /*seq number*/
        mmsg->mid_seqno = ntohs(m->v4.seqno);
--- 201,208 ----
  
        //printf("Aliases: %d\n", no_aliases);
!       //COPY_IP(&mmsg->mid_origaddr, &m->v4.originator);
!       mmsg->mid_origaddr.v4.s_addr = m->v4.originator;
!       //COPY_IP(&mmsg->addr, &m->v4.originator);
!       mmsg->addr.v4.s_addr = m->v4.originator;
        /*seq number*/
        mmsg->mid_seqno = ntohs(m->v4.seqno);
***************
*** 222,226 ****
  	  alias = olsr_malloc(sizeof(struct mid_alias), "MID chgestruct");
  	  
! 	  COPY_IP(&alias->alias_addr, &maddr->addr);
  	  alias->next = mmsg->mid_addr;
  	  mmsg->mid_addr = alias;
--- 219,224 ----
  	  alias = olsr_malloc(sizeof(struct mid_alias), "MID chgestruct");
  	  
! 	  //COPY_IP(&alias->alias_addr, &maddr->addr);
!           alias->alias_addr.v4.s_addr = maddr->addr;
  	  alias->next = mmsg->mid_addr;
  	  mmsg->mid_addr = alias;
***************
*** 231,240 ****
        if(olsr_cnf->debug_level > 1)
  	{
! 	  OLSR_PRINTF(3, "Alias list for %s: ", ip_to_string(&mmsg->mid_origaddr.v4));
! 	  OLSR_PRINTF(3, "%s", ip_to_string(&mmsg->addr.v4));
  	  alias_tmp = mmsg->mid_addr;
  	  while(alias_tmp)
  	    {
! 	      OLSR_PRINTF(3, " - %s", ip_to_string(&alias_tmp->alias_addr.v4));
  	      alias_tmp = alias_tmp->next;
  	    }
--- 229,241 ----
        if(olsr_cnf->debug_level > 1)
  	{
! #ifndef NODEBUG
!           struct ipaddr_str buf;
! #endif
! 	  OLSR_PRINTF(3, "Alias list for %s: ", olsr_ip_to_string(&buf, &mmsg->mid_origaddr));
! 	  OLSR_PRINTF(3, "%s", olsr_ip_to_string(&buf, &mmsg->addr));
  	  alias_tmp = mmsg->mid_addr;
  	  while(alias_tmp)
  	    {
! 	      OLSR_PRINTF(3, " - %s", olsr_ip_to_string(&buf, &alias_tmp->alias_addr));
  	      alias_tmp = alias_tmp->next;
  	    }
***************
*** 245,251 ****
      {
        /* IPv6 */
!       struct midaddr6 *maddr6;
! 
!       maddr6 = m->v6.message.mid.mid_addr;
        /*
         * How many aliases?
--- 246,250 ----
      {
        /* IPv6 */
!       const struct midaddr6 *maddr6 = m->v6.message.mid.mid_addr;
        /*
         * How many aliases?
***************
*** 256,261 ****
  
        //printf("Aliases: %d\n", no_aliases);
!       COPY_IP(&mmsg->mid_origaddr, &m->v6.originator);
!       COPY_IP(&mmsg->addr, &m->v6.originator);
        /*seq number*/
        mmsg->mid_seqno = ntohs(m->v6.seqno);
--- 255,262 ----
  
        //printf("Aliases: %d\n", no_aliases);
!       //COPY_IP(&mmsg->mid_origaddr, &m->v6.originator);
!       mmsg->mid_origaddr.v6 = m->v6.originator;
!       //COPY_IP(&mmsg->addr, &m->v6.originator);
!       mmsg->addr.v6 = m->v6.originator;
        /*seq number*/
        mmsg->mid_seqno = ntohs(m->v6.seqno);
***************
*** 267,277 ****
        //printf("Sequencenuber of MID from %s is %d\n", ip_to_string(&mmsg->addr), mmsg->mid_seqno);
  
- 
        for(i = 0; i < no_aliases; i++)
  	{
  	  alias = olsr_malloc(sizeof(struct mid_alias), "MID chgestruct 2");
  	  
! 	  //printf("Adding alias: %s\n", olsr_ip_to_string((union olsr_ip_addr *)&maddr6->addr));
! 	  COPY_IP(&alias->alias_addr, &maddr6->addr);
  	  alias->next = mmsg->mid_addr;
  	  mmsg->mid_addr = alias;
--- 268,278 ----
        //printf("Sequencenuber of MID from %s is %d\n", ip_to_string(&mmsg->addr), mmsg->mid_seqno);
  
        for(i = 0; i < no_aliases; i++)
  	{
  	  alias = olsr_malloc(sizeof(struct mid_alias), "MID chgestruct 2");
  	  
! 	  //printf("Adding alias: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&maddr6->addr));
! 	  //COPY_IP(&alias->alias_addr, &maddr6->addr);
! 	  alias->alias_addr.v6 = maddr6->addr;
  	  alias->next = mmsg->mid_addr;
  	  mmsg->mid_addr = alias;
***************
*** 283,293 ****
        if(olsr_cnf->debug_level > 1)
  	{
! 	  OLSR_PRINTF(3, "Alias list for %s", ip6_to_string(&mmsg->mid_origaddr.v6));
! 	  OLSR_PRINTF(3, "%s", ip6_to_string(&mmsg->addr.v6));
  
  	  alias_tmp = mmsg->mid_addr;
  	  while(alias_tmp)
  	    {
! 	      OLSR_PRINTF(3, " - %s", ip6_to_string(&alias_tmp->alias_addr.v6));
  	      alias_tmp = alias_tmp->next;
  	    }
--- 284,297 ----
        if(olsr_cnf->debug_level > 1)
  	{
! #ifndef NODEBUG
!           struct ipaddr_str buf;
! #endif
! 	  OLSR_PRINTF(3, "Alias list for %s", ip6_to_string(&buf, &mmsg->mid_origaddr.v6));
! 	  OLSR_PRINTF(3, "%s", ip6_to_string(&buf, &mmsg->addr.v6));
  
  	  alias_tmp = mmsg->mid_addr;
  	  while(alias_tmp)
  	    {
! 	      OLSR_PRINTF(3, " - %s", ip6_to_string(&buf, &alias_tmp->alias_addr.v6));
  	      alias_tmp = alias_tmp->next;
  	    }
***************
*** 311,315 ****
  
  void
! unk_chgestruct(struct unknown_message *umsg, union olsr_message *m)
  {
  
--- 315,319 ----
  
  void
! unk_chgestruct(struct unknown_message *umsg, const union olsr_message *m)
  {
  
***************
*** 323,327 ****
        /* IPv4 */
        /* address */
!       COPY_IP(&umsg->originator, &m->v4.originator);
        /*seq number*/
        umsg->seqno = ntohs(m->v4.seqno);
--- 327,332 ----
        /* IPv4 */
        /* address */
!       //COPY_IP(&umsg->originator, &m->v4.originator);
!       umsg->originator.v4.s_addr = m->v4.originator;
        /*seq number*/
        umsg->seqno = ntohs(m->v4.seqno);
***************
*** 333,337 ****
        /* IPv6 */
        /* address */
!       COPY_IP(&umsg->originator, &m->v6.originator);
        /*seq number*/
        umsg->seqno = ntohs(m->v6.seqno);
--- 338,343 ----
        /* IPv6 */
        /* address */
!       //COPY_IP(&umsg->originator, &m->v6.originator);
!       umsg->originator.v6 = m->v6.originator;
        /*seq number*/
        umsg->seqno = ntohs(m->v6.seqno);
***************
*** 354,358 ****
  
  void
! hello_chgestruct(struct hello_message *hmsg, union olsr_message *m)
  {
    union olsr_ip_addr *hadr;
--- 360,364 ----
  
  void
! hello_chgestruct(struct hello_message *hmsg, const union olsr_message *m)
  {
    union olsr_ip_addr *hadr;
***************
*** 366,373 ****
    if(olsr_cnf->ip_version == AF_INET)
      {
!       struct hellinfo *hinf;
  
        /* IPv4 */
!       COPY_IP(&hmsg->source_addr, &m->v4.originator);
        hmsg->packet_seq_number = ntohs(m->v4.seqno);
  
--- 372,380 ----
    if(olsr_cnf->ip_version == AF_INET)
      {
!       const struct hellinfo *hinf;
  
        /* IPv4 */
!       //COPY_IP(&hmsg->source_addr, &m->v4.originator);
!       hmsg->source_addr.v4.s_addr = m->v4.originator;
        hmsg->packet_seq_number = ntohs(m->v4.seqno);
  
***************
*** 395,399 ****
  	      nb = olsr_malloc(sizeof (struct hello_neighbor), "HELLO chgestruct");
  
! 	      COPY_IP(&nb->address, hadr);
  
  	      /* Fetch link and status */
--- 402,407 ----
  	      nb = olsr_malloc(sizeof (struct hello_neighbor), "HELLO chgestruct");
  
! 	      //COPY_IP(&nb->address, hadr);
! 	      nb->address = *hadr;
  
  	      /* Fetch link and status */
***************
*** 410,418 ****
    else
      {
!       struct hellinfo6 *hinf6;
  
        /* IPv6 */
!       COPY_IP(&hmsg->source_addr, &m->v6.originator);
!       //printf("parsing HELLO from %s\n", olsr_ip_to_string(&hmsg->source_addr));
        hmsg->packet_seq_number = ntohs(m->v6.seqno);
  
--- 418,427 ----
    else
      {
!       const struct hellinfo6 *hinf6;
  
        /* IPv6 */
!       //COPY_IP(&hmsg->source_addr, &m->v6.originator);
!       hmsg->source_addr.v6 = m->v6.originator;
!       //printf("parsing HELLO from %s\n", olsr_ip_to_string(&buf, &hmsg->source_addr));
        hmsg->packet_seq_number = ntohs(m->v6.seqno);
  
***************
*** 440,444 ****
  	      nb = olsr_malloc(sizeof (struct hello_neighbor), "OLSR chgestruct 2");
  
! 	      COPY_IP(&nb->address, hadr);
  
  	      /* Fetch link and status */
--- 449,454 ----
  	      nb = olsr_malloc(sizeof (struct hello_neighbor), "OLSR chgestruct 2");
  
! 	      //COPY_IP(&nb->address, hadr);
! 	      nb->address = *hadr;
  
  	      /* Fetch link and status */
***************
*** 467,474 ****
  
  void
! tc_chgestruct(struct tc_message *tmsg, union olsr_message *m, union olsr_ip_addr *from_addr)
  {
    struct tc_mpr_addr *mprs;
-   union olsr_ip_addr *tmp_addr;
  
    tmsg->multipoint_relay_selector_address = NULL;
--- 477,483 ----
  
  void
! tc_chgestruct(struct tc_message *tmsg, const union olsr_message *m, const union olsr_ip_addr *from_addr)
  {
    struct tc_mpr_addr *mprs;
  
    tmsg->multipoint_relay_selector_address = NULL;
***************
*** 480,498 ****
      {
        /* IPv4 */
!       struct olsr_tcmsg *tc;
!       struct neigh_info *mprsaddr, *maddr;
! 
!       tc = &m->v4.message.tc;
!       mprsaddr = tc->neigh;
! 
!       if((tmp_addr = mid_lookup_main_addr(from_addr)) == 0)
! 	{
! 	  COPY_IP(&tmsg->source_addr, from_addr);
! 	}
!       else
! 	{
! 	  COPY_IP(&tmsg->source_addr, tmp_addr);
! 	}
  
  
        /* Get vtime */
--- 489,504 ----
      {
        /* IPv4 */
!       const struct olsr_tcmsg *tc = &m->v4.message.tc;
!       const struct neigh_info *mprsaddr = tc->neigh;
!       const struct neigh_info *maddr;
!       const union olsr_ip_addr * const tmp_addr = mid_lookup_main_addr(from_addr);
  
+       if(tmp_addr == NULL) {
+         //COPY_IP(&tmsg->source_addr, from_addr);
+         tmsg->source_addr = *from_addr;
+       } else {
+         //COPY_IP(&tmsg->source_addr, tmp_addr);
+         tmsg->source_addr = *tmp_addr;
+       }
  
        /* Get vtime */
***************
*** 501,510 ****
        OLSR_PRINTF(3, "Got TC vtime: %f\n", tmsg->vtime);
  
!       COPY_IP(&tmsg->originator, &m->v4.originator);
        tmsg->packet_seq_number = ntohs(m->v4.seqno);
        tmsg->hop_count =  m->v4.hopcnt;
        tmsg->ansn =  ntohs(tc->ansn);
  
!       //printf("TC from %s seqno %d\n", olsr_ip_to_string(&tmsg->originator), tmsg->packet_seq_number);
  
        for (maddr = mprsaddr; (char *)maddr < ((char *)m + (ntohs(m->v4.olsr_msgsize))); maddr++)
--- 507,517 ----
        OLSR_PRINTF(3, "Got TC vtime: %f\n", tmsg->vtime);
  
!       //COPY_IP(&tmsg->originator, &m->v4.originator);
!       tmsg->originator.v4.s_addr = m->v4.originator;
        tmsg->packet_seq_number = ntohs(m->v4.seqno);
        tmsg->hop_count =  m->v4.hopcnt;
        tmsg->ansn =  ntohs(tc->ansn);
  
!       //printf("TC from %s seqno %d\n", olsr_ip_to_string(&buf, &tmsg->originator), tmsg->packet_seq_number);
  
        for (maddr = mprsaddr; (char *)maddr < ((char *)m + (ntohs(m->v4.olsr_msgsize))); maddr++)
***************
*** 513,517 ****
  	  mprs = olsr_malloc(sizeof(struct tc_mpr_addr), "TC chgestruct");
  
! 	  COPY_IP(&mprs->address, &maddr->addr);
  	  mprs->next = tmsg->multipoint_relay_selector_address;
  	  tmsg->multipoint_relay_selector_address = mprs;
--- 520,525 ----
  	  mprs = olsr_malloc(sizeof(struct tc_mpr_addr), "TC chgestruct");
  
! 	  //COPY_IP(&mprs->address, &maddr->addr);
! 	  mprs->address.v4.s_addr = maddr->addr;
  	  mprs->next = tmsg->multipoint_relay_selector_address;
  	  tmsg->multipoint_relay_selector_address = mprs;
***************
*** 521,538 ****
      {
        /* IPv6 */
!       struct olsr_tcmsg6 *tc6;
!       struct neigh_info6 *mprsaddr6, *maddr6;
! 
!       tc6 = &m->v6.message.tc;
!       mprsaddr6 = tc6->neigh;
  
!       if((tmp_addr = mid_lookup_main_addr(from_addr)) == 0)
! 	{
! 	  COPY_IP(&tmsg->source_addr, from_addr);
! 	}
!       else
! 	{
! 	  COPY_IP(&tmsg->source_addr, tmp_addr);
! 	}
  
        /* Check if sender is symmetric neighbor here !! */
--- 529,544 ----
      {
        /* IPv6 */
!       const struct neigh_info6 *maddr6;
!       const struct olsr_tcmsg6 *tc6 = &m->v6.message.tc;
!       const struct neigh_info6 *mprsaddr6 = tc6->neigh;
!       const union olsr_ip_addr * const tmp_addr = mid_lookup_main_addr(from_addr);
  
!       if(tmp_addr == NULL) {
!         //COPY_IP(&tmsg->source_addr, from_addr);
!         tmsg->source_addr = *from_addr;
!       } else {
!         //COPY_IP(&tmsg->source_addr, tmp_addr);
!         tmsg->source_addr = *tmp_addr;
!       }
  
        /* Check if sender is symmetric neighbor here !! */
***************
*** 543,547 ****
        OLSR_PRINTF(3, "Got TC vtime: %f\n", tmsg->vtime);
  
!       COPY_IP(&tmsg->originator, &m->v6.originator);
        tmsg->packet_seq_number = ntohs(m->v6.seqno);
        tmsg->hop_count =  m->v6.hopcnt;
--- 549,554 ----
        OLSR_PRINTF(3, "Got TC vtime: %f\n", tmsg->vtime);
  
!       //COPY_IP(&tmsg->originator, &m->v6.originator);
!       tmsg->originator.v6 = m->v6.originator;
        tmsg->packet_seq_number = ntohs(m->v6.seqno);
        tmsg->hop_count =  m->v6.hopcnt;
***************
*** 553,557 ****
  	  mprs = olsr_malloc(sizeof(struct tc_mpr_addr), "TC chgestruct 2");
  
! 	  COPY_IP(&mprs->address, &maddr6->addr);
  	  mprs->next = tmsg->multipoint_relay_selector_address;
  	  tmsg->multipoint_relay_selector_address = mprs;
--- 560,565 ----
  	  mprs = olsr_malloc(sizeof(struct tc_mpr_addr), "TC chgestruct 2");
  
! 	  //COPY_IP(&mprs->address, &maddr6->addr);
!           mprs->address.v6 = maddr6->addr;
  	  mprs->next = tmsg->multipoint_relay_selector_address;
  	  tmsg->multipoint_relay_selector_address = mprs;

Index: hna_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/hna_set.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** hna_set.c	21 Oct 2007 20:37:58 -0000	1.23
--- hna_set.c	8 Nov 2007 22:47:41 -0000	1.24
***************
*** 43,46 ****
--- 43,47 ----
  #include "olsr.h"
  #include "scheduler.h"
+ #include "net_olsr.h"
  
  
***************
*** 112,116 ****
        tmp_net = tmp_net->next)
      { 
!       if(COMP_IP(&tmp_net->A_network_addr, net) &&
  	 (memcmp(&tmp_net->A_netmask, mask, netmask_size) == 0))
  	return tmp_net;
--- 113,117 ----
        tmp_net = tmp_net->next)
      { 
!       if(ipequal(&tmp_net->A_network_addr, net) &&
  	 (memcmp(&tmp_net->A_netmask, mask, netmask_size) == 0))
  	return tmp_net;
***************
*** 142,146 ****
        tmp_hna = tmp_hna->next)
      {
!       if(COMP_IP(&tmp_hna->A_gateway_addr, gw))
  	return tmp_hna;
      }
--- 143,147 ----
        tmp_hna = tmp_hna->next)
      {
!       if(ipequal(&tmp_hna->A_gateway_addr, gw))
  	return tmp_hna;
      }
***************
*** 168,172 ****
  
    /* Fill struct */
!   COPY_IP(&new_entry->A_gateway_addr, addr);
  
    /* Link nets */
--- 169,174 ----
  
    /* Fill struct */
!   //COPY_IP(&new_entry->A_gateway_addr, addr);
!   new_entry->A_gateway_addr = *addr;
  
    /* Link nets */
***************
*** 205,210 ****
    
    /* Fill struct */
!   COPY_IP(&new_net->A_network_addr, net);
!   memcpy(&new_net->A_netmask, mask, netmask_size);
  
    /* Queue */
--- 207,214 ----
    
    /* Fill struct */
!   //COPY_IP(&new_net->A_network_addr, net);
!   new_net->A_network_addr = *net;
!   //memcpy(&new_net->A_netmask, mask, netmask_size);
!   new_net->A_netmask = *mask;
  
    /* Queue */
***************
*** 323,326 ****
--- 327,332 ----
  olsr_print_hna_set(void)
  {
+ #ifdef NODEBUG
+   /* The whole function doesn't do anything else. */
    int idx;
  
***************
*** 349,360 ****
  	      if(olsr_cnf->ip_version == AF_INET)
  		{
! 		  OLSR_PRINTF(1, "%-15s ", olsr_ip_to_string(&tmp_net->A_network_addr));
! 		  OLSR_PRINTF(1, "%-15s ", olsr_ip_to_string((union olsr_ip_addr *)&tmp_net->A_netmask.v4));
! 		  OLSR_PRINTF(1, "%-15s\n", olsr_ip_to_string(&tmp_hna->A_gateway_addr));
  		}
  	      else
  		{
! 		  OLSR_PRINTF(1, "%-27s/%d", olsr_ip_to_string(&tmp_net->A_network_addr), tmp_net->A_netmask.v6);
! 		  OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&tmp_hna->A_gateway_addr));
  		}
  
--- 355,374 ----
  	      if(olsr_cnf->ip_version == AF_INET)
  		{
! #ifndef NODEBUG
!                   struct ipaddr_str buf;
! #endif
!                   struct in_addr a;
! 		  OLSR_PRINTF(1, "%-15s ", olsr_ip_to_string(&buf, &tmp_net->A_network_addr));
!                   a.s_addr = tmp_net->A_netmask.v4; /* Ugly! */
! 		  OLSR_PRINTF(1, "%-15s ", ip4_to_string(&buf, a));
! 		  OLSR_PRINTF(1, "%-15s\n", olsr_ip_to_string(&buf, &tmp_hna->A_gateway_addr));
  		}
  	      else
  		{
! #ifndef NODEBUG
!                   struct ipaddr_str buf;
! #endif
! 		  OLSR_PRINTF(1, "%-27s/%d", olsr_ip_to_string(&buf, &tmp_net->A_network_addr), tmp_net->A_netmask.v6);
! 		  OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf, &tmp_hna->A_gateway_addr));
  		}
  
***************
*** 364,368 ****
  	}
      }
! 
  }
  
--- 378,382 ----
  	}
      }
! #endif
  }
  

Index: generate_msg.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/generate_msg.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** generate_msg.c	20 Apr 2007 13:46:04 -0000	1.25
--- generate_msg.c	8 Nov 2007 22:47:41 -0000	1.26
***************
*** 57,60 ****
--- 57,61 ----
  #include "link_set.h"
  #include "two_hop_neighbor_table.h"
+ #include "net_olsr.h"
  
  

Index: two_hop_neighbor_table.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/two_hop_neighbor_table.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** two_hop_neighbor_table.c	2 Aug 2007 22:07:19 -0000	1.19
--- two_hop_neighbor_table.c	8 Nov 2007 22:47:41 -0000	1.20
***************
*** 46,49 ****
--- 46,50 ----
  #include "mid_set.h"
  #include "neighbor_table.h"
+ #include "net_olsr.h"
  
  
***************
*** 54,62 ****
   *Initialize 2 hop neighbor table
   */
! int
  olsr_init_two_hop_table(void)
  {
    int idx;
- 
    for(idx=0;idx<HASHSIZE;idx++)
      {
--- 55,62 ----
   *Initialize 2 hop neighbor table
   */
! void
  olsr_init_two_hop_table(void)
  {
    int idx;
    for(idx=0;idx<HASHSIZE;idx++)
      {
***************
*** 64,68 ****
        two_hop_neighbortable[idx].prev = &two_hop_neighbortable[idx];
      }
-   return 1;
  }
  
--- 64,67 ----
***************
*** 80,93 ****
  
  void
! olsr_delete_neighbor_pointer(struct neighbor_2_entry *two_hop_entry, union olsr_ip_addr *address)
  {
!   struct neighbor_list_entry *entry;
!   
!   entry = two_hop_entry->neighbor_2_nblist.next;
!   
!   
    while(entry != &two_hop_entry->neighbor_2_nblist)
      {
!       if(COMP_IP(&entry->neighbor->neighbor_main_addr, address))
  	{
  	  struct neighbor_list_entry *entry_to_delete = entry;
--- 79,88 ----
  
  void
! olsr_delete_neighbor_pointer(struct neighbor_2_entry *two_hop_entry, const union olsr_ip_addr *address)
  {
!   struct neighbor_list_entry *entry = two_hop_entry->neighbor_2_nblist.next;
    while(entry != &two_hop_entry->neighbor_2_nblist)
      {
!       if(ipequal(&entry->neighbor->neighbor_main_addr, address))
  	{
  	  struct neighbor_list_entry *entry_to_delete = entry;
***************
*** 151,159 ****
  olsr_insert_two_hop_neighbor_table(struct neighbor_2_entry *two_hop_neighbor)
  {
!   olsr_u32_t              hash; 
! 
!   //printf("Adding 2 hop neighbor %s\n", olsr_ip_to_string(&two_hop_neighbor->neighbor_2_addr));
  
!   hash = olsr_hashing(&two_hop_neighbor->neighbor_2_addr);
  
    /* Queue */  
--- 146,152 ----
  olsr_insert_two_hop_neighbor_table(struct neighbor_2_entry *two_hop_neighbor)
  {
!   olsr_u32_t hash = olsr_hashing(&two_hop_neighbor->neighbor_2_addr);
  
!   //printf("Adding 2 hop neighbor %s\n", olsr_ip_to_string(&buf, &two_hop_neighbor->neighbor_2_addr));
  
    /* Queue */  
***************
*** 171,184 ****
   */
  struct neighbor_2_entry *
! olsr_lookup_two_hop_neighbor_table(union olsr_ip_addr *dest)
  {
  
    struct neighbor_2_entry  *neighbor_2;
!   olsr_u32_t               hash;
! 
!   //printf("LOOKING FOR %s\n", olsr_ip_to_string(dest));
!   hash = olsr_hashing(dest);
  
!   
    for(neighbor_2 = two_hop_neighbortable[hash].next;
        neighbor_2 != &two_hop_neighbortable[hash];
--- 164,174 ----
   */
  struct neighbor_2_entry *
! olsr_lookup_two_hop_neighbor_table(const union olsr_ip_addr *dest)
  {
  
    struct neighbor_2_entry  *neighbor_2;
!   olsr_u32_t               hash = olsr_hashing(dest);
  
!   //printf("LOOKING FOR %s\n", olsr_ip_to_string(&buf, dest));
    for(neighbor_2 = two_hop_neighbortable[hash].next;
        neighbor_2 != &two_hop_neighbortable[hash];
***************
*** 187,192 ****
        struct mid_address *adr;
  
!       //printf("Checking %s\n", olsr_ip_to_string(dest));
!       if (COMP_IP(&neighbor_2->neighbor_2_addr, dest))
  	return neighbor_2;
  
--- 177,182 ----
        struct mid_address *adr;
  
!       //printf("Checking %s\n", olsr_ip_to_string(&buf, dest));
!       if (ipequal(&neighbor_2->neighbor_2_addr, dest))
  	return neighbor_2;
  
***************
*** 195,199 ****
        while(adr)
  	{
! 	  if(COMP_IP(&adr->alias, dest))
  	    return neighbor_2;
  	  adr = adr->next_alias;
--- 185,189 ----
        while(adr)
  	{
! 	  if(ipequal(&adr->alias, dest))
  	    return neighbor_2;
  	  adr = adr->next_alias;
***************
*** 216,225 ****
   */
  struct neighbor_2_entry *
! olsr_lookup_two_hop_neighbor_table_mid(union olsr_ip_addr *dest)
  {
    struct neighbor_2_entry  *neighbor_2;
    olsr_u32_t               hash;
  
!   //printf("LOOKING FOR %s\n", olsr_ip_to_string(dest));
    hash = olsr_hashing(dest);
    
--- 206,215 ----
   */
  struct neighbor_2_entry *
! olsr_lookup_two_hop_neighbor_table_mid(const union olsr_ip_addr *dest)
  {
    struct neighbor_2_entry  *neighbor_2;
    olsr_u32_t               hash;
  
!   //printf("LOOKING FOR %s\n", olsr_ip_to_string(&buf, dest));
    hash = olsr_hashing(dest);
    
***************
*** 228,232 ****
        neighbor_2 = neighbor_2->next)
      {
!       if (COMP_IP(&neighbor_2->neighbor_2_addr, dest))
  	return neighbor_2;
      }
--- 218,222 ----
        neighbor_2 = neighbor_2->next)
      {
!       if (ipequal(&neighbor_2->neighbor_2_addr, dest))
  	return neighbor_2;
      }
***************
*** 245,250 ****
  olsr_print_two_hop_neighbor_table(void)
  {
    int i;
- 
    OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.02%d ----------------------- TWO-HOP NEIGHBORS\n\n",
                nowtm->tm_hour,
--- 235,241 ----
  olsr_print_two_hop_neighbor_table(void)
  {
+ #ifndef NODEBUG
+   /* The whole function makes no sense without it. */
    int i;
    OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.02%d ----------------------- TWO-HOP NEIGHBORS\n\n",
                nowtm->tm_hour,
***************
*** 255,290 ****
    OLSR_PRINTF(1, "IP addr (2-hop)  IP addr (1-hop)  TLQ\n");
  
!   for (i = 0; i < HASHSIZE; i++)
!     {
!       struct neighbor_2_entry *neigh2;
!       for (neigh2 = two_hop_neighbortable[i].next;
!            neigh2 != &two_hop_neighbortable[i]; neigh2 = neigh2->next)
! 	{
! 	  struct neighbor_list_entry *entry;
! 	  olsr_bool first = OLSR_TRUE;
! 
! 	  for (entry = neigh2->neighbor_2_nblist.next;
!                entry != &neigh2->neighbor_2_nblist; entry = entry->next)
! 	    {
! 	      double total_lq;
! 	      struct neighbor_entry *neigh = entry->neighbor;
! 
!               if (first)
!                 {
!                   OLSR_PRINTF(1, "%-15s  ",
!                               olsr_ip_to_string(&neigh2->neighbor_2_addr));
!                   first = OLSR_FALSE;
!                 }
! 
!               else
!                 OLSR_PRINTF(1, "                 ");
! 
!               total_lq = entry->path_link_quality;
  
!               OLSR_PRINTF(1, "%-15s  %5.3f\n",
!                           olsr_ip_to_string(&neigh->neighbor_main_addr),
!                           total_lq);
!             }
! 	}
      }
  }
--- 246,274 ----
    OLSR_PRINTF(1, "IP addr (2-hop)  IP addr (1-hop)  TLQ\n");
  
!   for (i = 0; i < HASHSIZE; i++) {
!     struct neighbor_2_entry *neigh2;
!     for (neigh2 = two_hop_neighbortable[i].next;
!          neigh2 != &two_hop_neighbortable[i];
!          neigh2 = neigh2->next)	{
!       struct neighbor_list_entry *entry;
!       olsr_bool first = OLSR_TRUE;
  
!       for (entry = neigh2->neighbor_2_nblist.next;
!            entry != &neigh2->neighbor_2_nblist;
!            entry = entry->next) {
!         struct ipaddr_str buf;
!         if (first) {
!           OLSR_PRINTF(1, "%-15s  ",
!                       olsr_ip_to_string(&buf, &neigh2->neighbor_2_addr));
!           first = OLSR_FALSE;
!         } else {
!           OLSR_PRINTF(1, "                 ");
!         }
!         OLSR_PRINTF(1, "%-15s  %5.3f\n",
!                     olsr_ip_to_string(&buf, &entry->neighbor->neighbor_main_addr),
!                     entry->path_link_quality);
!       }
      }
+   }
+ #endif
  }

Index: olsr_protocol.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_protocol.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** olsr_protocol.h	22 Apr 2007 20:25:48 -0000	1.22
--- olsr_protocol.h	8 Nov 2007 22:47:41 -0000	1.23
***************
*** 49,52 ****
--- 49,55 ----
  
  #include "olsr_types.h"
+ #include "olsr_cfg.h"
+ 
+ #include <string.h>
  
  /* Port for OLSR to use */
***************
*** 186,199 ****
  
  
- /*
-  * Macros for comparing and copying IP addresses
-  */
- 
- #define COMP_IP(ip1, ip2) (!memcmp(ip1, ip2, olsr_cnf->ipsize))
- 
- #define COPY_IP(to, from) memcpy(to, from, olsr_cnf->ipsize)
- 
- 
- 
  /***********************************************
   *           OLSR packet definitions           *
--- 189,192 ----

Index: lq_avl.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** lq_avl.c	5 Sep 2007 16:30:50 -0000	1.13
--- lq_avl.c	8 Nov 2007 22:47:41 -0000	1.14
***************
*** 56,74 ****
   * inline ipv4 comparison will be executed.
   */
! int (*avl_comp_default)(void *, void *) = NULL;
! int (*avl_comp_prefix_default)(void *, void *);
  
! int avl_comp_ipv4(void *ip1, void *ip2)
  {
!     return(*(unsigned int *)ip1 == *(unsigned int *)ip2 ? 0 : \
!            *(unsigned int *)ip1 < *(unsigned int *)ip2 ? -1 : +1);
  }
  
! int avl_comp_ipv6(void *ip1, void *ip2)
  {
    return memcmp(ip1, ip2, 16);
  }
  
! void avl_init(struct avl_tree *tree, int (*comp)(void *, void *))
  {
    tree->root = NULL;
--- 56,73 ----
   * inline ipv4 comparison will be executed.
   */
! int (*avl_comp_default)(const void *, const void *) = NULL;
! int (*avl_comp_prefix_default)(const void *, const void *);
  
! int avl_comp_ipv4(const void *ip1, const void *ip2)
  {
!   return inline_avl_comp_ipv4(ip1, ip2);
  }
  
! int avl_comp_ipv6(const void *ip1, const void *ip2)
  {
    return memcmp(ip1, ip2, 16);
  }
  
! void avl_init(struct avl_tree *tree, int (*comp)(const void *, const void *))
  {
    tree->root = NULL;
***************
*** 79,85 ****
  }
  
! static struct avl_node *avl_find_rec_ipv4(struct avl_node *node, void *key)
  {
!   if (*(unsigned int *)key < *(unsigned int *)node->key)
    {
      if (node->left != NULL)
--- 78,84 ----
  }
  
! static struct avl_node *avl_find_rec_ipv4(struct avl_node *node, const void *key)
  {
!   if (*(const unsigned int *)key < *(const unsigned int *)node->key)
    {
      if (node->left != NULL)
***************
*** 96,101 ****
  }
  
! static struct avl_node *avl_find_rec(struct avl_node *node, void *key,
!                                      int (*comp)(void *, void *))
  {
    int diff;
--- 95,100 ----
  }
  
! static struct avl_node *avl_find_rec(struct avl_node *node, const void *key,
!                                      int (*comp)(const void *, const void *))
  {
    int diff;
***************
*** 125,129 ****
  }
  
! struct avl_node *avl_find(struct avl_tree *tree, void *key)
  {
    struct avl_node *node;
--- 124,128 ----
  }
  
! struct avl_node *avl_find(struct avl_tree *tree, const void *key)
  {
    struct avl_node *node;

Index: link_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -d -r1.76 -r1.77
*** link_set.c	2 Nov 2007 20:58:06 -0000	1.76
--- link_set.c	8 Nov 2007 22:47:41 -0000	1.77
***************
*** 54,57 ****
--- 54,58 ----
  #include "scheduler.h"
  #include "lq_route.h"
+ #include "net_olsr.h"
  
  
***************
*** 145,150 ****
        if(entry->L_link_pending == 1)
  	{
! #ifdef DEBUG
! 	  OLSR_PRINTF(3, "HYST[%s]: Setting to HIDE\n", olsr_ip_to_string(&entry->neighbor_iface_addr));
  #endif
  	  return HIDE_LINK;
--- 146,152 ----
        if(entry->L_link_pending == 1)
  	{
! #ifndef NODEBUG
!           struct ipaddr_str buf;
! 	  OLSR_PRINTF(3, "HYST[%s]: Setting to HIDE\n", olsr_ip_to_string(&buf, &entry->neighbor_iface_addr));
  #endif
  	  return HIDE_LINK;
***************
*** 262,266 ****
      // if this is not a link to the neighour in question, skip
  
!     if (!COMP_IP(&walker->neighbor->neighbor_main_addr, main_addr))
        continue;
  
--- 264,268 ----
      // if this is not a link to the neighour in question, skip
  
!     if (!ipequal(&walker->neighbor->neighbor_main_addr, main_addr))
        continue;
  
***************
*** 284,288 ****
            // use the requested remote interface address as a tie-breaker
            ((tmp_if->int_metric == curr_metric) && 
!            COMP_IP(&walker->local_iface_addr, remote)))
        {
          // memorize the interface's metric
--- 286,290 ----
            // use the requested remote interface address as a tie-breaker
            ((tmp_if->int_metric == curr_metric) && 
!            ipequal(&walker->local_iface_addr, remote)))
        {
          // memorize the interface's metric
***************
*** 315,319 ****
        if((tmp_lq > curr_lq) ||
           // use the requested remote interface address as a tie-breaker
!          ((tmp_lq == curr_lq) && COMP_IP(&walker->local_iface_addr, remote)))
        {
          // memorize the link quality
--- 317,321 ----
        if((tmp_lq > curr_lq) ||
           // use the requested remote interface address as a tie-breaker
!          ((tmp_lq == curr_lq) && ipequal(&walker->local_iface_addr, remote)))
        {
          // memorize the link quality
***************
*** 368,373 ****
      // has a matching IP address
  
!     if ((COMP_IP(&mult->addr, &null_addr) && val < 0.0) ||
!         COMP_IP(&mult->addr, &entry->neighbor_iface_addr))
        val = mult->val;
    }
--- 370,375 ----
      // has a matching IP address
  
!     if ((ipequal(&mult->addr, &null_addr) && val < 0.0) ||
!         ipequal(&mult->addr, &entry->neighbor_iface_addr))
        val = mult->val;
    }
***************
*** 403,407 ****
      {
  
!       if(COMP_IP(int_addr, &tmp_link_set->local_iface_addr))
          {
            if(last_link_entry != NULL)
--- 405,409 ----
      {
  
!       if(ipequal(int_addr, &tmp_link_set->local_iface_addr))
          {
            if(last_link_entry != NULL)
***************
*** 478,482 ****
  
  #ifdef DEBUG
!   OLSR_PRINTF(1, "Adding %s=>%s to link set\n", olsr_ip_to_string(local), olsr_ip_to_string(remote));
  #endif
  
--- 480,489 ----
  
  #ifdef DEBUG
!   {
! #ifndef NODEBUG
!     struct ipaddr_str localbuf, rembuf;
! #endif
!     OLSR_PRINTF(1, "Adding %s=>%s to link set\n", olsr_ip_to_string(&localbuf, local), olsr_ip_to_string(&rembuf, remote));
!   }
  #endif
  
***************
*** 500,506 ****
     */
    //printf("\tLocal IF: %s\n", olsr_ip_to_string(local));
!   COPY_IP(&new_link->local_iface_addr, local);
    /* L_neighbor_iface_addr = Source Address */
!   COPY_IP(&new_link->neighbor_iface_addr, remote);
  
    /* L_SYM_time            = current time - 1 (expired) */
--- 507,515 ----
     */
    //printf("\tLocal IF: %s\n", olsr_ip_to_string(local));
!   //COPY_IP(&new_link->local_iface_addr, local);
!   new_link->local_iface_addr = *local;
    /* L_neighbor_iface_addr = Source Address */
!   //COPY_IP(&new_link->neighbor_iface_addr, remote);
!   new_link->neighbor_iface_addr = *remote;
  
    /* L_SYM_time            = current time - 1 (expired) */
***************
*** 564,573 ****
  
    /* Neighbor MUST exist! */
!   if(NULL == (neighbor = olsr_lookup_neighbor_table(remote_main)))
      {
-       neighbor = olsr_insert_neighbor_table(remote_main);
  #ifdef DEBUG
!       OLSR_PRINTF(3, "ADDING NEW NEIGHBOR ENTRY %s FROM LINK SET\n", olsr_ip_to_string(remote_main));
  #endif
      }
  
--- 573,586 ----
  
    /* Neighbor MUST exist! */
!   neighbor = olsr_lookup_neighbor_table(remote_main);
!   if(neighbor == NULL)
      {
  #ifdef DEBUG
! #ifndef NODEBUG
!       struct ipaddr_str buf;
! #endif
!       OLSR_PRINTF(3, "ADDING NEW NEIGHBOR ENTRY %s FROM LINK SET\n", olsr_ip_to_string(&buf, remote_main));
  #endif
+       neighbor = olsr_insert_neighbor_table(remote_main);
      }
  
***************
*** 586,590 ****
    new_link->neighbor = neighbor;
  
!   if(!COMP_IP(remote, remote_main))
      {
        /* Add MID alias if not already registered */
--- 599,603 ----
    new_link->neighbor = neighbor;
  
!   if(!ipequal(remote, remote_main))
      {
        /* Add MID alias if not already registered */
***************
*** 626,630 ****
    while(tmp_link_set)
      {
!       if(COMP_IP(int_addr, &tmp_link_set->neighbor_iface_addr))
  	return lookup_link_status(tmp_link_set);
        tmp_link_set = tmp_link_set->next;
--- 639,643 ----
    while(tmp_link_set)
      {
!       if(ipequal(int_addr, &tmp_link_set->neighbor_iface_addr))
  	return lookup_link_status(tmp_link_set);
        tmp_link_set = tmp_link_set->next;
***************
*** 652,662 ****
    while(tmp_link_set)
      {
!       if(COMP_IP(remote, &tmp_link_set->neighbor_iface_addr) &&
  	 (tmp_link_set->if_name
            ? !strcmp(tmp_link_set->if_name, local->int_name)
!           : COMP_IP(&local->ip_addr, &tmp_link_set->local_iface_addr)
            ) &&
           /* check the remote-main address only if there is one given */
!          (remote_main == NULL || COMP_IP(remote_main, &tmp_link_set->neighbor->neighbor_main_addr))
           )
  	return tmp_link_set;
--- 665,675 ----
    while(tmp_link_set)
      {
!       if(ipequal(remote, &tmp_link_set->neighbor_iface_addr) &&
  	 (tmp_link_set->if_name
            ? !strcmp(tmp_link_set->if_name, local->int_name)
!           : ipequal(&local->ip_addr, &tmp_link_set->local_iface_addr)
            ) &&
           /* check the remote-main address only if there is one given */
!          (remote_main == NULL || ipequal(remote_main, &tmp_link_set->neighbor->neighbor_main_addr))
           )
  	return tmp_link_set;
***************
*** 811,815 ****
         * will send a Hello with the same IP mentined twice
         */
!       if(COMP_IP(&neighbors->address, &in_if->ip_addr))
          {
  	  //printf("ok");
--- 824,828 ----
         * will send a Hello with the same IP mentined twice
         */
!       if(ipequal(&neighbors->address, &in_if->ip_addr))
          {
  	  //printf("ok");
***************
*** 923,928 ****
        if(TIMED_OUT(tmp_link_set->hello_timeout))
  	{
  	  tmp_link_set->L_link_quality = olsr_hyst_calc_instability(tmp_link_set->L_link_quality);
! 	  OLSR_PRINTF(1, "HYST[%s] HELLO timeout %0.3f\n", olsr_ip_to_string(&tmp_link_set->neighbor_iface_addr), tmp_link_set->L_link_quality);
  	  /* Update hello_timeout - NO SLACK THIS TIME */
  	  tmp_link_set->hello_timeout = GET_TIMESTAMP(tmp_link_set->last_htime*1000);
--- 936,944 ----
        if(TIMED_OUT(tmp_link_set->hello_timeout))
  	{
+ #ifndef NODEBUG
+           struct ipaddr_str buf;
+ #endif
  	  tmp_link_set->L_link_quality = olsr_hyst_calc_instability(tmp_link_set->L_link_quality);
! 	  OLSR_PRINTF(1, "HYST[%s] HELLO timeout %0.3f\n", olsr_ip_to_string(&buf, &tmp_link_set->neighbor_iface_addr), tmp_link_set->L_link_quality);
  	  /* Update hello_timeout - NO SLACK THIS TIME */
  	  tmp_link_set->hello_timeout = GET_TIMESTAMP(tmp_link_set->last_htime*1000);
***************
*** 954,958 ****
    const int addrsize = olsr_cnf->ip_version == AF_INET ? 15 : 39;
  
!   OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.%02d ---------------------------------------------------- LINKS\n\n",
                nowtm->tm_hour,
                nowtm->tm_min,
--- 970,974 ----
    const int addrsize = olsr_cnf->ip_version == AF_INET ? 15 : 39;
  
!   OLSR_PRINTF(0, "\n--- %02d:%02d:%02d.%02d ---------------------------------------------------- LINKS\n\n",
                nowtm->tm_hour,
                nowtm->tm_min,
***************
*** 963,966 ****
--- 979,983 ----
    for (walker = link_set; walker != NULL; walker = walker->next)
    {
+     struct ipaddr_str buf;
      float etx;
  
***************
*** 971,975 ****
  
      OLSR_PRINTF(1, "%-*s  %5.3f  %5.3f  %-3d    %-3d    %5.3f  %.2f\n",
!                 addrsize, olsr_ip_to_string(&walker->neighbor_iface_addr),
                  walker->L_link_quality,
                  walker->loss_link_quality,
--- 988,992 ----
  
      OLSR_PRINTF(1, "%-*s  %5.3f  %5.3f  %-3d    %-3d    %5.3f  %.2f\n",
!                 addrsize, olsr_ip_to_string(&buf, &walker->neighbor_iface_addr),
                  walker->L_link_quality,
                  walker->loss_link_quality,

Index: two_hop_neighbor_table.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/two_hop_neighbor_table.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** two_hop_neighbor_table.h	29 May 2005 12:47:46 -0000	1.14
--- two_hop_neighbor_table.h	8 Nov 2007 22:47:42 -0000	1.15
***************
*** 76,84 ****
  
  
! int
  olsr_init_two_hop_table(void);
  
  void
! olsr_delete_neighbor_pointer(struct neighbor_2_entry *, union olsr_ip_addr *);
  
  void
--- 76,84 ----
  
  
! void
  olsr_init_two_hop_table(void);
  
  void
! olsr_delete_neighbor_pointer(struct neighbor_2_entry *, const union olsr_ip_addr *);
  
  void
***************
*** 89,96 ****
  
  struct neighbor_2_entry *
! olsr_lookup_two_hop_neighbor_table(union olsr_ip_addr *);
  
  struct neighbor_2_entry *
! olsr_lookup_two_hop_neighbor_table_mid(union olsr_ip_addr *);
  
  void
--- 89,96 ----
  
  struct neighbor_2_entry *
! olsr_lookup_two_hop_neighbor_table(const union olsr_ip_addr *);
  
  struct neighbor_2_entry *
! olsr_lookup_two_hop_neighbor_table_mid(const union olsr_ip_addr *);
  
  void

Index: process_routes.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** process_routes.c	16 Sep 2007 21:14:25 -0000	1.37
--- process_routes.c	8 Nov 2007 22:47:41 -0000	1.38
***************
*** 48,53 ****
  #include "log.h"
  #include "kernel_routes.h"
- #include <assert.h>
  #include "lq_avl.h"
  
  #ifdef WIN32
--- 48,53 ----
  #include "log.h"
  #include "kernel_routes.h"
  #include "lq_avl.h"
+ #include "net_olsr.h"
  
  #ifdef WIN32
***************
*** 91,95 ****
    nh = olsr_get_nh(rt);
  
!   if(!COMP_IP(&rt->rt_dst.prefix, &nh->gateway)) {
      flags |= RTF_GATEWAY;
    }
--- 91,95 ----
    nh = olsr_get_nh(rt);
  
!   if(!ipequal(&rt->rt_dst.prefix, &nh->gateway)) {
      flags |= RTF_GATEWAY;
    }
***************
*** 279,283 ****
    nh = olsr_get_nh(rt);
  
!   if (COMP_IP(&rt->rt_dst.prefix, &nh->gateway)) {
      list_add_after(head_node, &rt->rt_change_node);
    } else {
--- 279,283 ----
    nh = olsr_get_nh(rt);
  
!   if (ipequal(&rt->rt_dst.prefix, &nh->gateway)) {
      list_add_after(head_node, &rt->rt_change_node);
    } else {

Index: neighbor_table.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/neighbor_table.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** neighbor_table.c	17 Sep 2007 22:24:22 -0000	1.34
--- neighbor_table.c	8 Nov 2007 22:47:41 -0000	1.35
***************
*** 51,54 ****
--- 51,55 ----
  #include "link_set.h"
  #include "mpr_selector_set.h"
+ #include "net_olsr.h"
  
  
***************
*** 91,95 ****
    while(entry != &neighbor->neighbor_2_list)
      {      
!       if(COMP_IP(&entry->neighbor_2->neighbor_2_addr, address))
  	{
  	  /* Dequeue */
--- 92,96 ----
    while(entry != &neighbor->neighbor_2_list)
      {      
!       if(ipequal(&entry->neighbor_2->neighbor_2_addr, address))
  	{
  	  /* Dequeue */
***************
*** 126,130 ****
      {
        
!       if(COMP_IP(&entry->neighbor_2->neighbor_2_addr, neighbor_main_address))
  	return entry;
        
--- 127,131 ----
      {
        
!       if(ipequal(&entry->neighbor_2->neighbor_2_addr, neighbor_main_address))
  	return entry;
        
***************
*** 163,167 ****
    while(entry != &neighbortable[hash])
      {
!       if(COMP_IP(&entry->neighbor_main_addr, neighbor_addr))
  	break;
        
--- 164,168 ----
    while(entry != &neighbortable[hash])
      {
!       if(ipequal(&entry->neighbor_main_addr, neighbor_addr))
  	break;
        
***************
*** 233,237 ****
        new_neigh = new_neigh->next)
      {
!       if(COMP_IP(&new_neigh->neighbor_main_addr, main_addr))
  	return new_neigh;
      }
--- 234,238 ----
        new_neigh = new_neigh->next)
      {
!       if(ipequal(&new_neigh->neighbor_main_addr, main_addr))
  	return new_neigh;
      }
***************
*** 242,246 ****
    
    /* Set address, willingness and status */
!   COPY_IP(&new_neigh->neighbor_main_addr, main_addr);
    new_neigh->willingness = WILL_NEVER;
    new_neigh->status = NOT_SYM;
--- 243,248 ----
    
    /* Set address, willingness and status */
!   //COPY_IP(&new_neigh->neighbor_main_addr, main_addr);
!   new_neigh->neighbor_main_addr = *main_addr;
    new_neigh->willingness = WILL_NEVER;
    new_neigh->status = NOT_SYM;
***************
*** 296,306 ****
    olsr_u32_t             hash = olsr_hashing(dst);
    
!   //printf("\nLookup %s\n", olsr_ip_to_string(dst));
    for(entry = neighbortable[hash].next;
        entry != &neighbortable[hash];
        entry = entry->next)
      {
!       //printf("Checking %s\n", olsr_ip_to_string(&entry->neighbor_main_addr));
!       if(COMP_IP(&entry->neighbor_main_addr, dst))
  	return entry;
        
--- 298,308 ----
    olsr_u32_t             hash = olsr_hashing(dst);
    
!   //printf("\nLookup %s\n", olsr_ip_to_string(&buf, dst));
    for(entry = neighbortable[hash].next;
        entry != &neighbortable[hash];
        entry = entry->next)
      {
!       //printf("Checking %s\n", olsr_ip_to_string(&buf, &entry->neighbor_main_addr));
!       if(ipequal(&entry->neighbor_main_addr, dst))
  	return entry;
        
***************
*** 432,474 ****
  olsr_print_neighbor_table(void)
  {
!   int i;
!   char *fstr;
! 
!   OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.%02d ------------------------------------------------ NEIGHBORS\n\n",
                nowtm->tm_hour,
                nowtm->tm_min,
                nowtm->tm_sec,
!               (int)now.tv_usec/10000);
! 
!   if (olsr_cnf->ip_version == AF_INET)
!     {
!       OLSR_PRINTF(1, "IP address       LQ     NLQ    SYM   MPR   MPRS  will\n");
!       fstr = "%-15s  %5.3f  %5.3f  %s  %s  %s  %d\n";
!     }
!   else
!     {
!       OLSR_PRINTF(1, "IP address                               LQ     NLQ    SYM   MPR   MPRS  will\n");
!       fstr = "%-39s  %5.3f  %5.3f  %s  %s  %s  %d\n";
!     }
! 
!   for (i = 0; i < HASHSIZE; i++)
!     {
!       struct neighbor_entry *neigh;
!       for(neigh = neighbortable[i].next; neigh != &neighbortable[i]; neigh = neigh->next)
! 	{
! 	  struct link_entry *lnk = get_best_link_to_neighbor(&neigh->neighbor_main_addr);
! 	  if(lnk)
!             {
!               const double best_lq = lnk->neigh_link_quality;
!               const double inv_best_lq = lnk->loss_link_quality;
  
!               OLSR_PRINTF(1, fstr, olsr_ip_to_string(&neigh->neighbor_main_addr),
!                           inv_best_lq, best_lq,
!                           (neigh->status == SYM) ? "YES " : "NO  ",
!                           neigh->is_mpr ? "YES " : "NO  ", 
!                           olsr_lookup_mprs_set(&neigh->neighbor_main_addr) == NULL ? "NO  " : "YES ",
!                           neigh->willingness);
!             }
!         }
      }
  }
--- 434,472 ----
  olsr_print_neighbor_table(void)
  {
! #ifdef NODEBUG
!   /* The whole function doesn't do anything else. */
! #ifndef NODEBUG
!   const int iplen = olsr_cnf->ip_version == AF_INET ?  15 : 39;
! #endif
!   int idx;
!   OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.%02d ------------------------------------------------ NEIGHBORS\n\n"
!               "%*s  LQ     NLQ    SYM   MPR   MPRS  will\n",
                nowtm->tm_hour,
                nowtm->tm_min,
                nowtm->tm_sec,
!               (int)now.tv_usec/10000,
!               iplen,
!               "IP address");
  
!   for (idx = 0; idx < HASHSIZE; idx++) {
!     struct neighbor_entry *neigh;
!     for(neigh = neighbortable[idx].next; neigh != &neighbortable[idx]; neigh = neigh->next) {
!       struct link_entry *lnk = get_best_link_to_neighbor(&neigh->neighbor_main_addr);
!       if(lnk) {
! #ifndef NODEBUG
!         struct ipaddr_str buf;
! #endif
!         OLSR_PRINTF(1, "%-*s  %5.3f  %5.3f  %s  %s  %s  %d\n",
!                     iplen,
!                     olsr_ip_to_string(&buf, &neigh->neighbor_main_addr),
!                     lnk->loss_link_quality,
!                     lnk->neigh_link_quality,
!                     neigh->status == SYM ? "YES " : "NO  ",
!                     neigh->is_mpr ? "YES " : "NO  ", 
!                     olsr_lookup_mprs_set(&neigh->neighbor_main_addr) == NULL ? "NO  " : "YES ",
!                     neigh->willingness);
!       }
      }
+   }
+ #endif
  }

Index: lq_avl.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** lq_avl.h	25 Sep 2007 13:47:36 -0000	1.11
--- lq_avl.h	8 Nov 2007 22:47:41 -0000	1.12
***************
*** 63,67 ****
    struct avl_node *last;
    unsigned int count;
!   int (*comp)(void *, void *);
  };
  
--- 63,67 ----
    struct avl_node *last;
    unsigned int count;
!   int (*comp)(const void *, const void *);
  };
  
***************
*** 69,74 ****
  #define AVL_DUP_NO 0
  
! void avl_init(struct avl_tree *, int (*)(void *, void *));
! struct avl_node *avl_find(struct avl_tree *, void *);
  int avl_insert(struct avl_tree *, struct avl_node *, int);
  void avl_delete(struct avl_tree *, struct avl_node *);
--- 69,74 ----
  #define AVL_DUP_NO 0
  
! void avl_init(struct avl_tree *, int (*)(const void *, const void *));
! struct avl_node *avl_find(struct avl_tree *, const void *);
  int avl_insert(struct avl_tree *, struct avl_node *, int);
  void avl_delete(struct avl_tree *, struct avl_node *);
***************
*** 78,85 ****
  struct avl_node *avl_walk_prev(struct avl_node *);
  
! extern int (*avl_comp_default)(void *, void *);
! extern int (*avl_comp_prefix_default)(void *, void *);
! extern int avl_comp_ipv4(void *, void *);
! extern int avl_comp_ipv6(void *, void *);
  
  #define inline_avl_comp_ipv4(ip1, ip2) \
--- 78,85 ----
  struct avl_node *avl_walk_prev(struct avl_node *);
  
! extern int (*avl_comp_default)(const void *, const void *);
! extern int (*avl_comp_prefix_default)(const void *, const void *);
! extern int avl_comp_ipv4(const void *, const void *);
! extern int avl_comp_ipv6(const void *, const void *);
  
  #define inline_avl_comp_ipv4(ip1, ip2) \

Index: print_packet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/print_packet.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** print_packet.c	17 Sep 2007 22:14:07 -0000	1.12
--- print_packet.c	8 Nov 2007 22:47:41 -0000	1.13
***************
*** 45,48 ****
--- 45,50 ----
  #include "olsr.h"
  #include "lq_packet.h"
+ #include "net_olsr.h"
+ 
  
  static void
***************
*** 74,81 ****
    olsr_16_t remainsize = size - OLSR_HEADERSIZE;
    union olsr_message *msg;
  
    /* Print packet header (no IP4/6 difference) */
    fprintf(handle, "  ============== OLSR PACKET ==============\n   source: %s\n   length: %d bytes\n   seqno: %d\n\n",
! 	  from_addr ? olsr_ip_to_string(from_addr) : "UNKNOWN",
  	  ntohs(pkt->v4.olsr_packlen), ntohs(pkt->v4.olsr_seqno));
  
--- 76,84 ----
    olsr_16_t remainsize = size - OLSR_HEADERSIZE;
    union olsr_message *msg;
+   struct ipaddr_str buf;
  
    /* Print packet header (no IP4/6 difference) */
    fprintf(handle, "  ============== OLSR PACKET ==============\n   source: %s\n   length: %d bytes\n   seqno: %d\n\n",
! 	  from_addr ? olsr_ip_to_string(&buf, from_addr) : "UNKNOWN",
  	  ntohs(pkt->v4.olsr_packlen), ntohs(pkt->v4.olsr_seqno));
  
***************
*** 103,110 ****
  print_olsr_serialized_message(FILE *handle, union olsr_message *msg)
  {
  
    fprintf(handle, "   ------------ OLSR MESSAGE ------------\n");
    fprintf(handle, "    Sender main addr: %s\n", 
! 	  olsr_ip_to_string((union olsr_ip_addr *)&msg->v4.originator));
    fprintf(handle, "    Type: %s, size: %d, vtime: %0.2f\n", 
  	  olsr_msgtype_to_string(msg->v4.olsr_msgtype), 
--- 106,114 ----
  print_olsr_serialized_message(FILE *handle, union olsr_message *msg)
  {
+   struct ipaddr_str buf;
  
    fprintf(handle, "   ------------ OLSR MESSAGE ------------\n");
    fprintf(handle, "    Sender main addr: %s\n", 
! 	  olsr_ip_to_string(&buf, (union olsr_ip_addr *)&msg->v4.originator));
    fprintf(handle, "    Type: %s, size: %d, vtime: %0.2f\n", 
  	  olsr_msgtype_to_string(msg->v4.olsr_msgtype), 
***************
*** 219,224 ****
  	       haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[4])
  	    {
! 
! 	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(haddr));
  	    }
  	}
--- 223,228 ----
  	       haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[4])
  	    {
!               struct ipaddr_str buf;
! 	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(&buf, haddr));
  	    }
  	}
***************
*** 246,250 ****
  	       haddr++)
  	    {
! 	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(haddr));
  	    }
  	}
--- 250,255 ----
  	       haddr++)
  	    {
!               struct ipaddr_str buf;
! 	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(&buf, haddr));
  	    }
  	}
***************
*** 286,291 ****
  	       haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[8])
  	    {
  	      olsr_u8_t *quality = (olsr_u8_t *)haddr + olsr_cnf->ipsize;
! 	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(haddr));
  	      fprintf(handle, "    ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]);
  	    }
--- 291,297 ----
  	       haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[8])
  	    {
+               struct ipaddr_str buf;
  	      olsr_u8_t *quality = (olsr_u8_t *)haddr + olsr_cnf->ipsize;
! 	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(&buf, haddr));
  	      fprintf(handle, "    ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]);
  	    }
***************
*** 314,319 ****
  	       haddr++)
  	    {
  	      olsr_u8_t *quality = (olsr_u8_t *)haddr + olsr_cnf->ipsize;
! 	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(haddr));
  	      fprintf(handle, "    ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]);
  	    }
--- 320,326 ----
  	       haddr++)
  	    {
+               struct ipaddr_str buf;
  	      olsr_u8_t *quality = (olsr_u8_t *)haddr + olsr_cnf->ipsize;
! 	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(&buf, haddr));
  	      fprintf(handle, "    ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]);
  	    }
***************
*** 335,339 ****
    while(remsize)
      {
!       fprintf(handle, "    +Neighbor: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
        data += olsr_cnf->ipsize;
        fprintf(handle, "    +LQ: %d, ", *data);
--- 342,347 ----
    while(remsize)
      {
!       struct ipaddr_str buf;
!       fprintf(handle, "    +Neighbor: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *) data));
        data += olsr_cnf->ipsize;
        fprintf(handle, "    +LQ: %d, ", *data);
***************
*** 359,363 ****
    while(remsize)
      {
!       fprintf(handle, "    +Neighbor: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
        data += olsr_cnf->ipsize;
  
--- 367,372 ----
    while(remsize)
      {
!       struct ipaddr_str buf;
!       fprintf(handle, "    +Neighbor: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *) data));
        data += olsr_cnf->ipsize;
  
***************
*** 375,381 ****
    while(remsize)
      {
!       fprintf(handle, "    +Network: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
        data += olsr_cnf->ipsize;
!       fprintf(handle, "    +Netmask: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
        data += olsr_cnf->ipsize;
  
--- 384,391 ----
    while(remsize)
      {
!       struct ipaddr_str buf;
!       fprintf(handle, "    +Network: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *) data));
        data += olsr_cnf->ipsize;
!       fprintf(handle, "    +Netmask: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *) data));
        data += olsr_cnf->ipsize;
  
***************
*** 392,396 ****
    while(remsize)
      {
!       fprintf(handle, "    +Alias: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
        data += olsr_cnf->ipsize;
        remsize -= olsr_cnf->ipsize;
--- 402,407 ----
    while(remsize)
      {
!       struct ipaddr_str buf;
!       fprintf(handle, "    +Alias: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *) data));
        data += olsr_cnf->ipsize;
        remsize -= olsr_cnf->ipsize;

Index: olsr_types.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_types.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** olsr_types.h	2 Nov 2007 10:16:39 -0000	1.11
--- olsr_types.h	8 Nov 2007 22:47:41 -0000	1.12
***************
*** 75,95 ****
  #include <netinet/in.h>
  
! union olsr_ip_addr
! {
!   /*
    struct in_addr v4;
-   */
-   olsr_u32_t v4;
    struct in6_addr v6;
  };
  
! struct olsr_ip_prefix
! {
    union olsr_ip_addr prefix;
    olsr_u8_t prefix_len;
  };
  
! union hna_netmask
! {
    olsr_u32_t v4;
    olsr_u16_t v6;
--- 75,89 ----
  #include <netinet/in.h>
  
! union olsr_ip_addr {
    struct in_addr v4;
    struct in6_addr v6;
  };
  
! struct olsr_ip_prefix {
    union olsr_ip_addr prefix;
    olsr_u8_t prefix_len;
  };
  
! union hna_netmask {
    olsr_u32_t v4;
    olsr_u16_t v6;

Index: ipc_frontend.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ipc_frontend.h	13 Oct 2007 12:31:04 -0000	1.15
--- ipc_frontend.h	8 Nov 2007 22:47:41 -0000	1.16
***************
*** 100,104 ****
  
  olsr_bool
! ipc_check_allowed_ip(union olsr_ip_addr *);
  
  void
--- 100,104 ----
  
  olsr_bool
! ipc_check_allowed_ip(const union olsr_ip_addr *);
  
  void

Index: duplicate_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/duplicate_set.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** duplicate_set.c	8 Nov 2007 15:34:11 -0000	1.18
--- duplicate_set.c	8 Nov 2007 22:47:41 -0000	1.19
***************
*** 46,49 ****
--- 46,50 ----
  #include "scheduler.h"
  #include "olsr.h"
+ #include "net_olsr.h"
  
  /* The duplicate table */
***************
*** 97,101 ****
  
    /* Address */
!   COPY_IP(&new_dup_entry->addr, originator);
    /* Seqno */
    new_dup_entry->seqno = seqno;
--- 98,103 ----
  
    /* Address */
!   //COPY_IP(&new_dup_entry->addr, originator);
!   new_dup_entry->addr = *originator;
    /* Seqno */
    new_dup_entry->seqno = seqno;
***************
*** 137,141 ****
        tmp_dup_table = tmp_dup_table->next)
      {
!       if(COMP_IP(&tmp_dup_table->addr, originator) &&
  	 (tmp_dup_table->seqno == seqno))
  	{
--- 139,143 ----
        tmp_dup_table = tmp_dup_table->next)
      {
!       if(ipequal(&tmp_dup_table->addr, originator) &&
  	 (tmp_dup_table->seqno == seqno))
  	{
***************
*** 168,172 ****
        tmp_dup_table = tmp_dup_table->next)
      {
!       if(COMP_IP(&tmp_dup_table->addr, originator) &&
  	 (tmp_dup_table->seqno == seqno))
  	{
--- 170,174 ----
        tmp_dup_table = tmp_dup_table->next)
      {
!       if(ipequal(&tmp_dup_table->addr, originator) &&
  	 (tmp_dup_table->seqno == seqno))
  	{
***************
*** 179,183 ****
  	  while(tmp_dup_iface)
  	    {
! 	      if(COMP_IP(&tmp_dup_iface->addr, int_addr))
  		return 0;
  	      
--- 181,185 ----
  	  while(tmp_dup_iface)
  	    {
! 	      if(ipequal(&tmp_dup_iface->addr, int_addr))
  		return 0;
  	      
***************
*** 236,241 ****
  	      struct dup_entry *entry_to_delete = tmp_dup_table;
  #ifdef DEBUG
  	      OLSR_PRINTF(5, "DUP TIMEOUT[%s] s: %d\n", 
! 		          olsr_ip_to_string(&tmp_dup_table->addr),
  		          tmp_dup_table->seqno);
  #endif
--- 238,246 ----
  	      struct dup_entry *entry_to_delete = tmp_dup_table;
  #ifdef DEBUG
+ #ifndef NODEBUG
+               struct ipaddr_str buf;
+ #endif
  	      OLSR_PRINTF(5, "DUP TIMEOUT[%s] s: %d\n", 
! 		          olsr_ip_to_string(&buf, &tmp_dup_table->addr),
  		          tmp_dup_table->seqno);
  #endif
***************
*** 270,274 ****
        tmp_dup_table = tmp_dup_table->next)
      {
!       if(COMP_IP(&tmp_dup_table->addr, originator) &&
  	 (tmp_dup_table->seqno == seqno))
  	{
--- 275,279 ----
        tmp_dup_table = tmp_dup_table->next)
      {
!       if(ipequal(&tmp_dup_table->addr, originator) &&
  	 (tmp_dup_table->seqno == seqno))
  	{
***************
*** 286,290 ****
    new_iface = olsr_malloc(sizeof(struct dup_iface), "New dup iface");
  
!   COPY_IP(&new_iface->addr, iface);
    new_iface->next = tmp_dup_table->ifaces;
    tmp_dup_table->ifaces = new_iface;
--- 291,296 ----
    new_iface = olsr_malloc(sizeof(struct dup_iface), "New dup iface");
  
!   //COPY_IP(&new_iface->addr, iface);
!   new_iface->addr = *iface;
    new_iface->next = tmp_dup_table->ifaces;
    tmp_dup_table->ifaces = new_iface;
***************
*** 300,303 ****
--- 306,312 ----
  		     const olsr_u16_t seqno)
  {
+ #if !defined(NODEBUG) && defined(DEBUG)
+   struct ipaddr_str buf;
+ #endif
    olsr_u32_t hash;
    struct dup_entry *tmp_dup_table;
***************
*** 311,315 ****
        tmp_dup_table = tmp_dup_table->next)
      {
!       if(COMP_IP(&tmp_dup_table->addr, originator) &&
  	 (tmp_dup_table->seqno == seqno))
  	{
--- 320,324 ----
        tmp_dup_table = tmp_dup_table->next)
      {
!       if(ipequal(&tmp_dup_table->addr, originator) &&
  	 (tmp_dup_table->seqno == seqno))
  	{
***************
*** 323,327 ****
    
  #ifdef DEBUG
!   OLSR_PRINTF(3, "Setting DUP %s/%d forwarded\n", olsr_ip_to_string(&tmp_dup_table->addr), seqno);
  #endif
  
--- 332,336 ----
    
  #ifdef DEBUG
!   OLSR_PRINTF(3, "Setting DUP %s/%d forwarded\n", olsr_ip_to_string(&buf, &tmp_dup_table->addr), seqno);
  #endif
  
***************
*** 349,354 ****
        while(tmp_dup_table != &dup_set[i])
  	{
! 	  printf("[%s] s: %d\n", 
! 		 olsr_ip_to_string(&tmp_dup_table->addr),
  		 tmp_dup_table->seqno);
  	  tmp_dup_table = tmp_dup_table->next;
--- 358,364 ----
        while(tmp_dup_table != &dup_set[i])
  	{
!           struct ipaddr_str buf;
!           printf("[%s] s: %d\n", 
! 		 olsr_ip_to_string(&buf, &tmp_dup_table->addr),
  		 tmp_dup_table->seqno);
  	  tmp_dup_table = tmp_dup_table->next;

Index: local_hna_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/local_hna_set.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** local_hna_set.c	5 Nov 2007 15:32:55 -0000	1.15
--- local_hna_set.c	8 Nov 2007 22:47:41 -0000	1.16
***************
*** 43,46 ****
--- 43,47 ----
  #include "local_hna_set.h"
  #include "olsr.h"
+ #include "net_olsr.h"
  
  void
***************
*** 80,85 ****
    while(h)
      {
!       if((net->v4 == h->net.prefix.v4) && 
! 	 (mask->v4 == prefix_len))
  	{
  	  /* Dequeue */
--- 81,86 ----
    while(h)
      {
!       if((net->v4.s_addr == h->net.prefix.v4.s_addr) && 
! 	 (mask->v4.s_addr == prefix_len))
  	{
  	  /* Dequeue */
***************
*** 129,137 ****
  {
    struct local_hna_entry *h = olsr_cnf->hna_entries;
!   const union olsr_ip_addr ip_addr = { .v4 = mask };
    const olsr_u16_t prefix_len = olsr_netmask_to_prefix(&ip_addr);
    while(h)
      {
!       if((net->v4 == h->net.prefix.v4) && 
  	 (prefix_len == h->net.prefix_len))
  	{
--- 130,138 ----
  {
    struct local_hna_entry *h = olsr_cnf->hna_entries;
!   const union olsr_ip_addr ip_addr = { .v4 = { .s_addr = mask } };
    const olsr_u16_t prefix_len = olsr_netmask_to_prefix(&ip_addr);
    while(h)
      {
!       if((net->v4.s_addr == h->net.prefix.v4.s_addr) && 
  	 (prefix_len == h->net.prefix_len))
  	{
***************
*** 174,178 ****
        for(h = olsr_cnf->hna_entries; h != NULL; h = h->next)
  	{
! 	  if(h->net.prefix_len == 0 && h->net.prefix.v4 == 0)
  	    return 1;
  	}
--- 175,179 ----
        for(h = olsr_cnf->hna_entries; h != NULL; h = h->next)
  	{
! 	  if(h->net.prefix_len == 0 && h->net.prefix.v4.s_addr == 0)
  	    return 1;
  	}

Index: lq_packet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** lq_packet.c	29 Aug 2007 23:08:54 -0000	1.28
--- lq_packet.c	8 Nov 2007 22:47:41 -0000	1.29
***************
*** 56,59 ****
--- 56,60 ----
  #include "olsr.h"
  #include "build_msg.h"
+ #include "net_olsr.h"
  
  
***************
*** 62,92 ****
  static unsigned char msg_buffer[MAXMESSAGESIZE - OLSR_HEADERSIZE];
  
! static inline void        pkt_get_u8(const olsr_u8_t **p, olsr_u8_t  *var)         { *var =       *(olsr_u8_t *)(*p);   *p += sizeof(olsr_u8_t); }
! static inline void       pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var)         { *var = ntohs(*(olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); }
! static inline void       pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var)         { *var = ntohl(*(olsr_u32_t *)(p));  *p += sizeof(olsr_u32_t); }
! static inline void        pkt_get_s8(const olsr_u8_t **p, olsr_8_t  *var)          { *var =       *(olsr_8_t *)(*p);    *p += sizeof(olsr_8_t); }
! static inline void       pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var)          { *var = ntohs(*(olsr_16_t *)(*p));  *p += sizeof(olsr_16_t); }
! static inline void       pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var)          { *var = ntohl(*(olsr_32_t *)(*p));  *p += sizeof(olsr_32_t); }
! static inline void    pkt_get_double(const olsr_u8_t **p, double *var)             { *var = me_to_double(**p);          *p += sizeof(olsr_u8_t); }
! static inline void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { COPY_IP(var, *p);                  *p += olsr_cnf->ipsize; }
! static inline void        pkt_get_lq(const olsr_u8_t **p, double *var)             { *var = (double)**p / 255.0;        *p += sizeof(olsr_u8_t); }
  
! static inline void        pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); }
! static inline void       pkt_ignore_u16(const olsr_u8_t **p) { *p += sizeof(olsr_u16_t); }
! static inline void       pkt_ignore_u32(const olsr_u8_t **p) { *p += sizeof(olsr_u32_t); }
! static inline void        pkt_ignore_s8(const olsr_u8_t **p) { *p += sizeof(olsr_8_t); }
! static inline void       pkt_ignore_s16(const olsr_u8_t **p) { *p += sizeof(olsr_16_t); }
! static inline void       pkt_ignore_s32(const olsr_u8_t **p) { *p += sizeof(olsr_32_t); }
! static inline void pkt_ignore_ipaddress(const olsr_u8_t **p) { *p += olsr_cnf->ipsize; }
  
! static inline void        pkt_put_u8(olsr_u8_t **p, const olsr_u8_t  var)         { *(olsr_u8_t *)(*p)  = var;        *p += sizeof(olsr_u8_t); }
! static inline void       pkt_put_u16(olsr_u8_t **p, const olsr_u16_t var)         { *(olsr_u16_t *)(*p) = htons(var); *p += sizeof(olsr_u16_t); }
! static inline void       pkt_put_u32(olsr_u8_t **p, const olsr_u32_t var)         { *(olsr_u32_t *)(*p) = htonl(var); *p += sizeof(olsr_u32_t); }
! static inline void        pkt_put_s8(olsr_u8_t **p, const olsr_8_t  var)          { *(olsr_8_t *)(*p)   = var;        *p += sizeof(olsr_8_t); }
! static inline void       pkt_put_s16(olsr_u8_t **p, const olsr_16_t var)          { *(olsr_16_t *)(*p)  = htons(var); *p += sizeof(olsr_16_t); }
! static inline void       pkt_put_s32(olsr_u8_t **p, const olsr_32_t var)          { *(olsr_32_t *)(*p)  = htonl(var); *p += sizeof(olsr_32_t); }
! static inline void    pkt_put_double(olsr_u8_t **p, const double var)             { **p = double_to_me(var);          *p += sizeof(olsr_u8_t); }
! static inline void pkt_put_ipaddress(olsr_u8_t **p, const union olsr_ip_addr var) { COPY_IP(*p, &var);                *p += olsr_cnf->ipsize; }
! static inline void        pkt_put_lq(olsr_u8_t **p, const double var)             { **p  = var * 255.0;               *p += sizeof(olsr_u8_t); }
  
  
--- 63,93 ----
  static unsigned char msg_buffer[MAXMESSAGESIZE - OLSR_HEADERSIZE];
  
! static INLINE void        pkt_get_u8(const olsr_u8_t **p, olsr_u8_t  *var)         { *var =       *(olsr_u8_t *)(*p);   *p += sizeof(olsr_u8_t); }
! static INLINE void       pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var)         { *var = ntohs(*(olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); }
! static INLINE void       pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var)         { *var = ntohl(*(olsr_u32_t *)(p));  *p += sizeof(olsr_u32_t); }
! static INLINE void        pkt_get_s8(const olsr_u8_t **p, olsr_8_t  *var)          { *var =       *(olsr_8_t *)(*p);    *p += sizeof(olsr_8_t); }
! static INLINE void       pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var)          { *var = ntohs(*(olsr_16_t *)(*p));  *p += sizeof(olsr_16_t); }
! static INLINE void       pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var)          { *var = ntohl(*(olsr_32_t *)(*p));  *p += sizeof(olsr_32_t); }
! static INLINE void    pkt_get_double(const olsr_u8_t **p, double *var)             { *var = me_to_double(**p);          *p += sizeof(olsr_u8_t); }
! static INLINE void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { memcpy(var, *p, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; }
! static INLINE void        pkt_get_lq(const olsr_u8_t **p, double *var)             { *var = (double)**p / 255.0;        *p += sizeof(olsr_u8_t); }
  
! static INLINE void        pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); }
! static INLINE void       pkt_ignore_u16(const olsr_u8_t **p) { *p += sizeof(olsr_u16_t); }
! static INLINE void       pkt_ignore_u32(const olsr_u8_t **p) { *p += sizeof(olsr_u32_t); }
! static INLINE void        pkt_ignore_s8(const olsr_u8_t **p) { *p += sizeof(olsr_8_t); }
! static INLINE void       pkt_ignore_s16(const olsr_u8_t **p) { *p += sizeof(olsr_16_t); }
! static INLINE void       pkt_ignore_s32(const olsr_u8_t **p) { *p += sizeof(olsr_32_t); }
! static INLINE void pkt_ignore_ipaddress(const olsr_u8_t **p) { *p += olsr_cnf->ipsize; }
  
! static INLINE void        pkt_put_u8(olsr_u8_t **p, const olsr_u8_t  var)         { *(olsr_u8_t *)(*p)  = var;        *p += sizeof(olsr_u8_t); }
! static INLINE void       pkt_put_u16(olsr_u8_t **p, const olsr_u16_t var)         { *(olsr_u16_t *)(*p) = htons(var); *p += sizeof(olsr_u16_t); }
! static INLINE void       pkt_put_u32(olsr_u8_t **p, const olsr_u32_t var)         { *(olsr_u32_t *)(*p) = htonl(var); *p += sizeof(olsr_u32_t); }
! static INLINE void        pkt_put_s8(olsr_u8_t **p, const olsr_8_t  var)          { *(olsr_8_t *)(*p)   = var;        *p += sizeof(olsr_8_t); }
! static INLINE void       pkt_put_s16(olsr_u8_t **p, const olsr_16_t var)          { *(olsr_16_t *)(*p)  = htons(var); *p += sizeof(olsr_16_t); }
! static INLINE void       pkt_put_s32(olsr_u8_t **p, const olsr_32_t var)          { *(olsr_32_t *)(*p)  = htonl(var); *p += sizeof(olsr_32_t); }
! static INLINE void    pkt_put_double(olsr_u8_t **p, const double var)             { **p = double_to_me(var);          *p += sizeof(olsr_u8_t); }
! static INLINE void pkt_put_ipaddress(olsr_u8_t **p, const union olsr_ip_addr var) { memcpy(*p, &var, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; }
! static INLINE void        pkt_put_lq(olsr_u8_t **p, const double var)             { **p  = var * 255.0;               *p += sizeof(olsr_u8_t); }
  
  
***************
*** 103,107 ****
    lq_hello->comm.size = 0;
  
!   COPY_IP(&lq_hello->comm.orig, &olsr_cnf->main_addr);
  
    lq_hello->comm.ttl = 1;
--- 104,109 ----
    lq_hello->comm.size = 0;
  
!   //COPY_IP(&lq_hello->comm.orig, &olsr_cnf->main_addr);
!   lq_hello->comm.orig = olsr_cnf->main_addr;
  
    lq_hello->comm.ttl = 1;
***************
*** 122,126 ****
  
        // a) this neighbor interface IS NOT visible via the output interface
!       if(!COMP_IP(&walker->local_iface_addr, &outif->ip_addr))
          neigh->link_type = UNSPEC_LINK;
        
--- 124,128 ----
  
        // a) this neighbor interface IS NOT visible via the output interface
!       if(!ipequal(&walker->local_iface_addr, &outif->ip_addr))
          neigh->link_type = UNSPEC_LINK;
        
***************
*** 148,152 ****
        // set the entry's neighbour interface address
  
!       COPY_IP(&neigh->addr, &walker->neighbor_iface_addr);
        
        // queue the neighbour entry
--- 150,155 ----
        // set the entry's neighbour interface address
  
!       //COPY_IP(&neigh->addr, &walker->neighbor_iface_addr);
!       neigh->addr = walker->neighbor_iface_addr;
        
        // queue the neighbour entry
***************
*** 190,194 ****
    lq_tc->comm.size = 0;
  
!   COPY_IP(&lq_tc->comm.orig, &olsr_cnf->main_addr);
  
    if (olsr_cnf->lq_fish > 0)
--- 193,198 ----
    lq_tc->comm.size = 0;
  
!   //COPY_IP(&lq_tc->comm.orig, &olsr_cnf->main_addr);
!   lq_tc->comm.orig = olsr_cnf->main_addr;
  
    if (olsr_cnf->lq_fish > 0)
***************
*** 212,216 ****
    lq_tc->comm.seqno = get_msg_seqno();
  
!   COPY_IP(&lq_tc->from, &olsr_cnf->main_addr);
  
    lq_tc->ansn = get_local_ansn();
--- 216,221 ----
    lq_tc->comm.seqno = get_msg_seqno();
  
!   //COPY_IP(&lq_tc->from, &olsr_cnf->main_addr);
!   lq_tc->from = olsr_cnf->main_addr;
  
    lq_tc->ansn = get_local_ansn();
***************
*** 249,253 ****
            // set the entry's main address
  
!           COPY_IP(&neigh->address, &walker->neighbor_main_addr);
  
            // set the entry's link quality
--- 254,259 ----
            // set the entry's main address
  
!           //COPY_IP(&neigh->address, &walker->neighbor_main_addr);
!           neigh->address = walker->neighbor_main_addr;
  
            // set the entry's link quality
***************
*** 300,304 ****
        olsr_head_v4->size = htons(comm->size);
  
!       COPY_IP(&olsr_head_v4->orig, &comm->orig);
  
        olsr_head_v4->ttl = comm->ttl;
--- 306,310 ----
        olsr_head_v4->size = htons(comm->size);
  
!       olsr_head_v4->orig = comm->orig.v4.s_addr;
  
        olsr_head_v4->ttl = comm->ttl;
***************
*** 315,319 ****
        olsr_head_v6->size = htons(comm->size);
  
!       COPY_IP(&olsr_head_v6->orig, &comm->orig);
  
        olsr_head_v6->ttl = comm->ttl;
--- 321,325 ----
        olsr_head_v6->size = htons(comm->size);
  
!       memcpy(&olsr_head_v6->orig, &comm->orig.v6.s6_addr, sizeof(olsr_head_v6->orig));
  
        olsr_head_v6->ttl = comm->ttl;
***************
*** 446,450 ****
                // add the current neighbor's IP address
  
!               COPY_IP(buff + size, &neigh->addr);
                size += olsr_cnf->ipsize;
  
--- 452,456 ----
                // add the current neighbor's IP address
  
!               genipcopy(buff + size, &neigh->addr);
                size += olsr_cnf->ipsize;
  
***************
*** 556,560 ****
  
        // add the current neighbor's IP address
!       COPY_IP(buff + size, &neigh->address);
        size += olsr_cnf->ipsize;
  
--- 562,566 ----
  
        // add the current neighbor's IP address
!       genipcopy(buff + size, &neigh->address);
        size += olsr_cnf->ipsize;
  
***************
*** 670,674 ****
          return 1;
      }
!     COPY_IP(&tc->source_addr, addr);
  
      pkt_get_u8(&curr, &tc->ttl);
--- 676,681 ----
          return 1;
      }
!     //COPY_IP(&tc->source_addr, addr);
!     tc->source_addr = *addr;
  
      pkt_get_u8(&curr, &tc->ttl);

Index: mid_set.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** mid_set.h	2 Aug 2007 21:50:22 -0000	1.15
--- mid_set.h	8 Nov 2007 22:47:41 -0000	1.16
***************
*** 45,48 ****
--- 45,49 ----
  
  #include "olsr_types.h"
+ #include "hashing.h"
  
  

Index: process_package.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** process_package.h	20 Feb 2005 18:52:18 -0000	1.12
--- process_package.h	8 Nov 2007 22:47:41 -0000	1.13
***************
*** 52,56 ****
  
  void
! olsr_hello_tap(struct hello_message *, struct interface *, union olsr_ip_addr *);
  
  void
--- 52,56 ----
  
  void
! olsr_hello_tap(struct hello_message *, struct interface *, const union olsr_ip_addr *);
  
  void

Index: net_olsr.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** net_olsr.h	5 Nov 2007 15:32:55 -0000	1.14
--- net_olsr.h	8 Nov 2007 22:47:41 -0000	1.15
***************
*** 48,51 ****
--- 48,52 ----
  #include "interfaces.h"
  #include "process_routes.h"
+ 
  #include <arpa/inet.h>
  #include <net/if.h>
***************
*** 53,56 ****
--- 54,80 ----
  typedef int (*packet_transform_function)(olsr_u8_t *, int *);
  
+ struct ipaddr_str {
+     char buf[MAX(INET6_ADDRSTRLEN, INET_ADDRSTRLEN)];
+ };
+ 
+ /*
+  * Macros for comparing and copying IP addresses
+  */
+ #define INLINE inline __attribute__((always_inline))
+ static INLINE int ip4cmp(const struct in_addr *a, const struct in_addr *b) { return ntohl(a->s_addr) - ntohl(b->s_addr); }
+ static INLINE int ip4equal(const struct in_addr *a, const struct in_addr *b) { return a->s_addr == b->s_addr; }
+ 
+ static INLINE int ip6cmp(const struct in6_addr *a, const struct in6_addr *b) { return memcmp(a, b, sizeof(*a)); }
+ static INLINE int ip6equal(const struct in6_addr *a, const struct in6_addr *b) { return ip6cmp(a, b) == 0; }
+ 
+ int ipcmp(const union olsr_ip_addr *a, const union olsr_ip_addr *b);
+ static INLINE int ipequal(const union olsr_ip_addr *a, const union olsr_ip_addr *b) { return ipcmp(a, b) == 0; }
+ 
+ /* Do not use this - this is as evil as the COPY_IP() macro was and only used in
+  * source which also needs cleanups.
+  */
+ static INLINE void genipcopy(void *dst, const void *src) { memcpy(dst, src, olsr_cnf->ipsize); }
+ 
+ 
  void
  net_set_disp_pack_out(olsr_bool);
***************
*** 69,73 ****
  
  olsr_u16_t
! net_output_pending(struct interface *);
  
  int
--- 93,97 ----
  
  olsr_u16_t
! net_output_pending(const struct interface *);
  
  int
***************
*** 87,106 ****
  
  int
! olsr_prefix_to_netmask(union olsr_ip_addr *, olsr_u16_t);
  
  olsr_u16_t
  olsr_netmask_to_prefix(const union olsr_ip_addr *);
  
! char *
! sockaddr_to_string(const struct sockaddr *);
  
  const char *
! ip_to_string(const olsr_u32_t *);
  
  const char *
! ip6_to_string(const struct in6_addr *);
  
  const char *
! olsr_ip_to_string(const union olsr_ip_addr *);
  
  const char *
--- 111,133 ----
  
  int
! olsr_prefix_to_netmask(union olsr_ip_addr *, const olsr_u16_t);
  
  olsr_u16_t
  olsr_netmask_to_prefix(const union olsr_ip_addr *);
  
! const char *
! sockaddr_to_string(struct ipaddr_str * const , const struct sockaddr *);
  
  const char *
! ip4_to_string(struct ipaddr_str * const buf, const struct in_addr);
  
  const char *
! ip6_to_string(struct ipaddr_str * const buf, const struct in6_addr * const addr6);
  
  const char *
! olsr_ip_to_string(struct ipaddr_str * const buf, const union olsr_ip_addr *);
! 
! const char *
! sockaddr_to_string(struct ipaddr_str * const buf, const struct sockaddr *);
  
  const char *

Index: defs.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/defs.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -d -r1.65 -r1.66
*** defs.h	20 Oct 2007 21:07:24 -0000	1.65
--- defs.h	8 Nov 2007 22:47:41 -0000	1.66
***************
*** 57,61 ****
  
  #include "olsr_protocol.h"
- #include "net_olsr.h" /* IPaddr -> string conversions is used by everyone */
  #include "olsr_cfg.h"
  
--- 57,60 ----
***************
*** 88,92 ****
  #define OLSR_PRINTF(lvl, format, args...) do { } while(0)
  #else
! #define OLSR_PRINTF(lvl, format, args...) do {                  \
      if((olsr_cnf->debug_level >= (lvl)) && debug_handle)          \
        fprintf(debug_handle, (format), ##args);                    \
--- 87,91 ----
  #define OLSR_PRINTF(lvl, format, args...) do { } while(0)
  #else
! #define OLSR_PRINTF(lvl, format, args...) do {                    \
      if((olsr_cnf->debug_level >= (lvl)) && debug_handle)          \
        fprintf(debug_handle, (format), ##args);                    \

Index: packet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/packet.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** packet.c	20 Oct 2007 15:16:32 -0000	1.25
--- packet.c	8 Nov 2007 22:47:41 -0000	1.26
***************
*** 48,51 ****
--- 48,52 ----
  #include "neighbor_table.h"
  #include "build_msg.h"
+ #include "net_olsr.h"
  
  static olsr_bool sending_tc = OLSR_FALSE;
***************
*** 61,65 ****
  olsr_free_hello_packet(struct hello_message *message)
  {
!   struct hello_neighbor *nb, *prev_nb;
  
    if(!message)
--- 62,66 ----
  olsr_free_hello_packet(struct hello_message *message)
  {
!   struct hello_neighbor *nb;
  
    if(!message)
***************
*** 67,77 ****
    
    nb = message->neighbors;
!   
!   while (nb)
!     {
!       prev_nb = nb;
!       nb = nb->next;
!       free(prev_nb);
!     }
  }
  
--- 68,76 ----
    
    nb = message->neighbors;
!   while (nb) {
!     struct hello_neighbor *prev_nb = nb;
!     nb = nb->next;
!     free(prev_nb);
!   }
  }
  
***************
*** 94,98 ****
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "\tBuilding HELLO on interface %s\n", outif->int_name);
  #endif
  
--- 93,97 ----
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "\tBuilding HELLO on interface \"%s\"\n", outif->int_name ? outif->int_name : "<null>");
  #endif
  
***************
*** 112,116 ****
  
    message->ttl = 1;  
!   COPY_IP(&message->source_addr, &olsr_cnf->main_addr);
  
  #ifdef DEBUG
--- 111,116 ----
  
    message->ttl = 1;  
!   //COPY_IP(&message->source_addr, &olsr_cnf->main_addr);
!   message->source_addr = olsr_cnf->main_addr;
  
  #ifdef DEBUG
***************
*** 123,131 ****
    while(links != NULL)
      {      
        int lnk = lookup_link_status(links);
        /* Update the status */
        
        /* Check if this link tuple is registered on the outgoing interface */
!       if(!COMP_IP(&links->local_iface_addr, &outif->ip_addr))
  	{
  	  links = links->next;
--- 123,134 ----
    while(links != NULL)
      {      
+ #if !defined(NODEBUG) && defined(DEBUG)
+       struct ipaddr_str buf;
+ #endif
        int lnk = lookup_link_status(links);
        /* Update the status */
        
        /* Check if this link tuple is registered on the outgoing interface */
!       if(!ipequal(&links->local_iface_addr, &outif->ip_addr))
  	{
  	  links = links->next;
***************
*** 187,197 ****
    
        /* Set the remote interface address */
!       COPY_IP(&message_neighbor->address, &links->neighbor_iface_addr);
        
        /* Set the main address */
!       COPY_IP(&message_neighbor->main_address, &links->neighbor->neighbor_main_addr);
  #ifdef DEBUG
!       OLSR_PRINTF(5, "Added: %s - ", olsr_ip_to_string(&message_neighbor->address));
!       OLSR_PRINTF(5, " status %d\n", message_neighbor->status);
  #endif
        message_neighbor->next=message->neighbors;
--- 190,201 ----
    
        /* Set the remote interface address */
!       //COPY_IP(&message_neighbor->address, &links->neighbor_iface_addr);
!       message_neighbor->address = links->neighbor_iface_addr;
        
        /* Set the main address */
!       //COPY_IP(&message_neighbor->main_address, &links->neighbor->neighbor_main_addr);
!       message_neighbor->main_address = links->neighbor->neighbor_main_addr;
  #ifdef DEBUG
!       OLSR_PRINTF(5, "Added: %s -  status %d\n", olsr_ip_to_string(&buf, &message_neighbor->address), message_neighbor->status);
  #endif
        message_neighbor->next=message->neighbors;
***************
*** 218,221 ****
--- 222,228 ----
  	    neighbor=neighbor->next)
  	  {
+ #if !defined(NODEBUG) && defined(DEBUG)
+             struct ipaddr_str buf;
+ #endif
  	    /* Check that the neighbor is not added yet */
  	    tmp_neigh = message->neighbors;
***************
*** 223,227 ****
  	    while(tmp_neigh)
  	      {
! 		if(COMP_IP(&tmp_neigh->main_address, &neighbor->neighbor_main_addr))
  		  {
  		    //printf("Not adding duplicate neighbor %s\n", olsr_ip_to_string(&neighbor->neighbor_main_addr));
--- 230,234 ----
  	    while(tmp_neigh)
  	      {
! 		if(ipequal(&tmp_neigh->main_address, &neighbor->neighbor_main_addr))
  		  {
  		    //printf("Not adding duplicate neighbor %s\n", olsr_ip_to_string(&neighbor->neighbor_main_addr));
***************
*** 286,295 ****
  	    
  
! 	    COPY_IP(&message_neighbor->address, &neighbor->neighbor_main_addr);
  
! 	    COPY_IP(&message_neighbor->main_address, &neighbor->neighbor_main_addr);
  #ifdef DEBUG
! 	    OLSR_PRINTF(5, "Added: %s - ", olsr_ip_to_string(&message_neighbor->address));
! 	    OLSR_PRINTF(5, " status  %d\n", message_neighbor->status);
  #endif
  	    message_neighbor->next=message->neighbors;
--- 293,303 ----
  	    
  
! 	    //COPY_IP(&message_neighbor->address, &neighbor->neighbor_main_addr);
! 	    message_neighbor->address = neighbor->neighbor_main_addr;
  
! 	    //COPY_IP(&message_neighbor->main_address, &neighbor->neighbor_main_addr);
! 	    message_neighbor->main_address = neighbor->neighbor_main_addr;
  #ifdef DEBUG
! 	    OLSR_PRINTF(5, "Added: %s -  status  %d\n", olsr_ip_to_string(&buf, &message_neighbor->address), message_neighbor->status);
  #endif
  	    message_neighbor->next=message->neighbors;
***************
*** 313,317 ****
  olsr_free_tc_packet(struct tc_message *message)
  {
!   struct tc_mpr_addr *mprs, *prev_mprs;
  
    if(!message)
--- 321,325 ----
  olsr_free_tc_packet(struct tc_message *message)
  {
!   struct tc_mpr_addr *mprs;
  
    if(!message)
***************
*** 319,329 ****
  
    mprs = message->multipoint_relay_selector_address;
!   
!   while (mprs)
!     {
!       prev_mprs = mprs;
!       mprs = mprs->next;
!       free(prev_mprs);
!     }
  }
  
--- 327,335 ----
  
    mprs = message->multipoint_relay_selector_address;
!   while (mprs != NULL) {
!     struct tc_mpr_addr *prev_mprs = mprs;
!     mprs = mprs->next;
!     free(prev_mprs);
!   }
  }
  
***************
*** 352,357 ****
    message->ansn = get_local_ansn();
  
!   COPY_IP(&message->originator, &olsr_cnf->main_addr);
!   COPY_IP(&message->source_addr, &olsr_cnf->main_addr);
    
  
--- 358,365 ----
    message->ansn = get_local_ansn();
  
!   //COPY_IP(&message->originator, &olsr_cnf->main_addr);
!   message->originator = olsr_cnf->main_addr;
!   //COPY_IP(&message->source_addr, &olsr_cnf->main_addr);
!   message->source_addr = olsr_cnf->main_addr;
    
  
***************
*** 374,378 ****
  		message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC");
  		
! 		COPY_IP(&message_mpr->address, &entry->neighbor_main_addr);
  		message_mpr->next = message->multipoint_relay_selector_address;
  		message->multipoint_relay_selector_address = message_mpr;
--- 382,387 ----
  		message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC");
  		
! 		//COPY_IP(&message_mpr->address, &entry->neighbor_main_addr);
! 		message_mpr->address = entry->neighbor_main_addr;
  		message_mpr->next = message->multipoint_relay_selector_address;
  		message->multipoint_relay_selector_address = message_mpr;
***************
*** 390,394 ****
  		    message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC 2");
  		    
! 		    COPY_IP(&message_mpr->address, &entry->neighbor_main_addr);
  		    message_mpr->next = message->multipoint_relay_selector_address;
  		    message->multipoint_relay_selector_address = message_mpr;
--- 399,404 ----
  		    message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC 2");
  		    
! 		    //COPY_IP(&message_mpr->address, &entry->neighbor_main_addr);
! 		    message_mpr->address = entry->neighbor_main_addr;
  		    message_mpr->next = message->multipoint_relay_selector_address;
  		    message->multipoint_relay_selector_address = message_mpr;
***************
*** 405,409 ****
  		    message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC 3");
  		    
! 		    COPY_IP(&message_mpr->address, &entry->neighbor_main_addr);
  		    message_mpr->next = message->multipoint_relay_selector_address;
  		    message->multipoint_relay_selector_address = message_mpr;
--- 415,420 ----
  		    message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC 3");
  		    
! 		    //COPY_IP(&message_mpr->address, &entry->neighbor_main_addr);
! 		    message_mpr->address = entry->neighbor_main_addr;
  		    message_mpr->next = message->multipoint_relay_selector_address;
  		    message->multipoint_relay_selector_address = message_mpr;

Index: process_package.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** process_package.c	13 Sep 2007 15:31:59 -0000	1.42
--- process_package.c	8 Nov 2007 22:47:41 -0000	1.43
***************
*** 55,58 ****
--- 55,59 ----
  #include "scheduler.h"
  #include "local_hna_set.h"
+ #include "net_olsr.h"
  
  
***************
*** 79,84 ****
  
  void
! olsr_hello_tap(struct hello_message *message, struct interface *in_if,
!                union olsr_ip_addr *from_addr)
  {
    struct neighbor_entry     *neighbor;
--- 80,86 ----
  
  void
! olsr_hello_tap(struct hello_message *message,
!                struct interface *in_if,
!                const union olsr_ip_addr *from_addr)
  {
    struct neighbor_entry     *neighbor;
***************
*** 100,104 ****
  
        for (walker = message->neighbors; walker != NULL; walker = walker->next)
!         if (COMP_IP(&walker->address, &in_if->ip_addr))
            break;
  
--- 102,106 ----
  
        for (walker = message->neighbors; walker != NULL; walker = walker->next)
!         if (ipequal(&walker->address, &in_if->ip_addr))
            break;
  
***************
*** 168,173 ****
    if(neighbor->willingness != message->willingness)
      {
        OLSR_PRINTF(1, "Willingness for %s changed from %d to %d - UPDATING\n", 
! 		  olsr_ip_to_string(&neighbor->neighbor_main_addr),
  		  neighbor->willingness,
  		  message->willingness);
--- 170,178 ----
    if(neighbor->willingness != message->willingness)
      {
+ #ifndef NODEBUG
+       struct ipaddr_str buf;
+ #endif
        OLSR_PRINTF(1, "Willingness for %s changed from %d to %d - UPDATING\n", 
! 		  olsr_ip_to_string(&buf, &neighbor->neighbor_main_addr),
  		  neighbor->willingness,
  		  message->willingness);
***************
*** 201,205 ****
  
  void
! olsr_process_received_hello(union olsr_message *m, struct interface *in_if, union olsr_ip_addr *from_addr)
  {
    struct hello_message      message;
--- 206,212 ----
  
  void
! olsr_process_received_hello(union olsr_message *m,
!                             struct interface *in_if,
!                             union olsr_ip_addr *from_addr)
  {
    struct hello_message      message;
***************
*** 217,223 ****
  
  void
! olsr_tc_tap(struct tc_message *message, struct interface *in_if,
!             union olsr_ip_addr *from_addr, union olsr_message *m)
  {
    struct tc_mpr_addr              *mpr;
    struct tc_entry                 *tc_last;
--- 224,235 ----
  
  void
! olsr_tc_tap(struct tc_message *message,
!             struct interface *in_if,
!             union olsr_ip_addr *from_addr,
!             union olsr_message *m)
  {
+ #ifndef NODEBUG
+   struct ipaddr_str                buf;
+ #endif
    struct tc_mpr_addr              *mpr;
    struct tc_entry                 *tc_last;
***************
*** 230,234 ****
  
    OLSR_PRINTF(3, "Processing TC from %s, seq 0x%04x\n",
!               olsr_ip_to_string(&message->originator), message->ansn);
  
    /*
--- 242,246 ----
  
    OLSR_PRINTF(3, "Processing TC from %s, seq 0x%04x\n",
!               olsr_ip_to_string(&buf, &message->originator), message->ansn);
  
    /*
***************
*** 241,245 ****
      {
        OLSR_PRINTF(2, "Received TC from NON SYM neighbor %s\n",
!                   olsr_ip_to_string(from_addr));
        olsr_free_tc_packet(message);
        return;
--- 253,257 ----
      {
        OLSR_PRINTF(2, "Received TC from NON SYM neighbor %s\n",
!                   olsr_ip_to_string(&buf, from_addr));
        olsr_free_tc_packet(message);
        return;
***************
*** 253,257 ****
        while(mpr!=NULL)
          {
!           OLSR_PRINTF(3, "%s:", olsr_ip_to_string(&mpr->address));
            mpr=mpr->next;
          }
--- 265,269 ----
        while(mpr!=NULL)
          {
!           OLSR_PRINTF(3, "%s:", olsr_ip_to_string(&buf, &mpr->address));
            mpr=mpr->next;
          }
***************
*** 291,295 ****
          {
            OLSR_PRINTF(3, "Dropping empty TC from %s\n",
!                       olsr_ip_to_string(&message->originator));
          }
      }
--- 303,307 ----
          {
            OLSR_PRINTF(3, "Dropping empty TC from %s\n",
!                       olsr_ip_to_string(&buf, &message->originator));
          }
      }
***************
*** 319,323 ****
   */
  void
! olsr_process_received_tc(union olsr_message *m, struct interface *in_if, union olsr_ip_addr *from_addr)
  { 
    struct tc_message               message;
--- 331,337 ----
   */
  void
! olsr_process_received_tc(union olsr_message *m,
!                          struct interface *in_if,
!                          union olsr_ip_addr *from_addr)
  { 
    struct tc_message               message;
***************
*** 349,354 ****
  
  void
! olsr_process_received_mid(union olsr_message *m, struct interface *in_if, union olsr_ip_addr *from_addr)
  {
    struct mid_alias *tmp_adr;
    struct mid_message message;
--- 363,373 ----
  
  void
! olsr_process_received_mid(union olsr_message *m,
!                           struct interface *in_if,
!                           union olsr_ip_addr *from_addr)
  {
+ #if !defined(NODEBUG) && defined(DEBUG)
+   struct ipaddr_str buf;
+ #endif
    struct mid_alias *tmp_adr;
    struct mid_message message;
***************
*** 369,373 ****
  
  #ifdef DEBUG
!   OLSR_PRINTF(5, "Processing MID from %s...\n", olsr_ip_to_string(&message.mid_origaddr));
  #endif
    tmp_adr = message.mid_addr;
--- 388,392 ----
  
  #ifdef DEBUG
!   OLSR_PRINTF(5, "Processing MID from %s...\n", olsr_ip_to_string(&buf, &message.mid_origaddr));
  #endif
    tmp_adr = message.mid_addr;
***************
*** 381,385 ****
    if(check_neighbor_link(from_addr) != SYM_LINK)
      {
!       OLSR_PRINTF(2, "Received MID from NON SYM neighbor %s\n", olsr_ip_to_string(from_addr));
        olsr_free_mid_packet(&message);
        return;
--- 400,407 ----
    if(check_neighbor_link(from_addr) != SYM_LINK)
      {
! #ifndef NODEBUG
!       struct ipaddr_str buf;
! #endif
!       OLSR_PRINTF(2, "Received MID from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr));
        olsr_free_mid_packet(&message);
        return;
***************
*** 393,398 ****
        if(!mid_lookup_main_addr(&tmp_adr->alias_addr))
  	{
! 	  OLSR_PRINTF(1, "MID new: (%s, ", olsr_ip_to_string(&message.mid_origaddr));
! 	  OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(&tmp_adr->alias_addr));
  	  insert_mid_alias(&message.mid_origaddr, &tmp_adr->alias_addr, (float)message.vtime);
  	}
--- 415,423 ----
        if(!mid_lookup_main_addr(&tmp_adr->alias_addr))
  	{
! #ifndef NODEBUG
!           struct ipaddr_str buf;
! #endif
! 	  OLSR_PRINTF(1, "MID new: (%s, ", olsr_ip_to_string(&buf, &message.mid_origaddr));
! 	  OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(&buf, &tmp_adr->alias_addr));
  	  insert_mid_alias(&message.mid_origaddr, &tmp_adr->alias_addr, (float)message.vtime);
  	}
***************
*** 429,433 ****
  
  void
! olsr_process_received_hna(union olsr_message *m, struct interface *in_if, union olsr_ip_addr *from_addr)
  {
    struct hna_net_addr  *hna_tmp;
--- 454,460 ----
  
  void
! olsr_process_received_hna(union olsr_message *m,
!                           struct interface *in_if,
!                           union olsr_ip_addr *from_addr)
  {
    struct hna_net_addr  *hna_tmp;
***************
*** 461,465 ****
    if(check_neighbor_link(from_addr) != SYM_LINK)
      {
!       OLSR_PRINTF(2, "Received HNA from NON SYM neighbor %s\n", olsr_ip_to_string(from_addr));
        olsr_free_hna_packet(&message);
        return;
--- 488,495 ----
    if(check_neighbor_link(from_addr) != SYM_LINK)
      {
! #ifndef NODEBUG
!       struct ipaddr_str buf;
! #endif
!       OLSR_PRINTF(2, "Received HNA from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr));
        olsr_free_hna_packet(&message);
        return;
***************
*** 511,514 ****
--- 541,547 ----
        message_neighbors = message_neighbors->next)
      {
+ #if !defined(NODEBUG) && defined(DEBUG)
+       struct ipaddr_str buf;
+ #endif
        union olsr_ip_addr      *neigh_addr;
        struct neighbor_2_entry *two_hop_neighbor;
***************
*** 526,532 ****
        neigh_addr = mid_lookup_main_addr(&message_neighbors->address);
  
!       if (neigh_addr != NULL)
!         COPY_IP(&message_neighbors->address, neigh_addr);
!       
        if(((message_neighbors->status == SYM_NEIGH) ||
            (message_neighbors->status == MPR_NEIGH)))
--- 559,567 ----
        neigh_addr = mid_lookup_main_addr(&message_neighbors->address);
  
!       if (neigh_addr != NULL) {
!         //COPY_IP(&message_neighbors->address, neigh_addr);
!         message_neighbors->address = *neigh_addr;
!       }
! 
        if(((message_neighbors->status == SYM_NEIGH) ||
            (message_neighbors->status == MPR_NEIGH)))
***************
*** 535,539 ****
              olsr_lookup_my_neighbors(neighbor, &message_neighbors->address);
  #ifdef DEBUG
!           OLSR_PRINTF(7, "\tProcessing %s\n", olsr_ip_to_string(&message_neighbors->address));
  #endif
            if (two_hop_neighbor_yet != NULL)
--- 570,574 ----
              olsr_lookup_my_neighbors(neighbor, &message_neighbors->address);
  #ifdef DEBUG
!           OLSR_PRINTF(7, "\tProcessing %s\n", olsr_ip_to_string(&buf, &message_neighbors->address));
  #endif
            if (two_hop_neighbor_yet != NULL)
***************
*** 577,581 ****
                    OLSR_PRINTF(5, 
  			      "Adding 2 hop neighbor %s\n\n", 
! 			      olsr_ip_to_string(&message_neighbors->address));
  #endif
                    changes_neighborhood = OLSR_TRUE;
--- 612,616 ----
                    OLSR_PRINTF(5, 
  			      "Adding 2 hop neighbor %s\n\n", 
! 			      olsr_ip_to_string(&buf, &message_neighbors->address));
  #endif
                    changes_neighborhood = OLSR_TRUE;
***************
*** 583,588 ****
  
                    two_hop_neighbor =
!                     olsr_malloc(sizeof(struct neighbor_2_entry),
!                                 "Process HELLO");
  		  
                    two_hop_neighbor->neighbor_2_nblist.next =
--- 618,622 ----
  
                    two_hop_neighbor =
!                     olsr_malloc(sizeof(struct neighbor_2_entry), "Process HELLO");
  		  
                    two_hop_neighbor->neighbor_2_nblist.next =
***************
*** 594,604 ****
                    two_hop_neighbor->neighbor_2_pointer = 0;
  		  
!                   COPY_IP(&two_hop_neighbor->neighbor_2_addr,
!                           &message_neighbors->address);
  
                    olsr_insert_two_hop_neighbor_table(two_hop_neighbor);
  
!                   olsr_linking_this_2_entries(neighbor, two_hop_neighbor,
!                                               (float)message->vtime);
                  }
                else
--- 628,637 ----
                    two_hop_neighbor->neighbor_2_pointer = 0;
  		  
!                   //COPY_IP(&two_hop_neighbor->neighbor_2_addr,&message_neighbors->address);
!                   two_hop_neighbor->neighbor_2_addr = message_neighbors->address;
  
                    olsr_insert_two_hop_neighbor_table(two_hop_neighbor);
  
!                   olsr_linking_this_2_entries(neighbor, two_hop_neighbor, (float)message->vtime);
                  }
                else
***************
*** 610,615 ****
                    changes_topology = OLSR_TRUE;
  		  
!                   olsr_linking_this_2_entries(neighbor, two_hop_neighbor,
!                                               (float)message->vtime); 
                  }
              }
--- 643,647 ----
                    changes_topology = OLSR_TRUE;
  		  
!                   olsr_linking_this_2_entries(neighbor, two_hop_neighbor, (float)message->vtime); 
                  }
              }
***************
*** 846,857 ****
  {
    
!   struct hello_neighbor  *neighbors;
! 
!   neighbors=message->neighbors;
    
    while(neighbors!=NULL)
      {  
!       //printf("(linkstatus)Checking %s ",olsr_ip_to_string(&neighbors->address));
!       //printf("against %s\n",olsr_ip_to_string(&main_addr));
  
  
--- 878,887 ----
  {
    
!   struct hello_neighbor  *neighbors = message->neighbors;
    
    while(neighbors!=NULL)
      {  
!       //printf("(linkstatus)Checking %s ",olsr_ip_to_string(&buf, &neighbors->address));
!       //printf("against %s\n",olsr_ip_to_string(&buf, &main_addr));
  
  
***************
*** 859,863 ****
        {	
  	/* IPv4 */  
! 	if(COMP_IP(&neighbors->address, &in_if->ip_addr))
  	  {
  	    //printf("ok");
--- 889,893 ----
        {	
  	/* IPv4 */  
! 	if(ip4equal(&neighbors->address.v4, &in_if->ip_addr.v4))
  	  {
  	    //printf("ok");
***************
*** 871,875 ****
        {	
  	/* IPv6 */  
! 	if(COMP_IP(&neighbors->address, &in_if->int6_addr.sin6_addr))
  	  {
  	    //printf("ok");
--- 901,905 ----
        {	
  	/* IPv6 */  
! 	if(ip6equal(&neighbors->address.v6, &in_if->int6_addr.sin6_addr))
  	  {
  	    //printf("ok");

Index: mid_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** mid_set.c	17 Sep 2007 22:24:22 -0000	1.22
--- mid_set.c	8 Nov 2007 22:47:41 -0000	1.23
***************
*** 48,51 ****
--- 48,52 ----
  #include "link_set.h"
  #include "packet.h" /* struct mid_alias */
+ #include "net_olsr.h"
  
  
***************
*** 112,116 ****
        tmp = tmp->next)
      {
!       if(COMP_IP(&tmp->main_addr, m_addr))
  	break;
       }
--- 113,117 ----
        tmp = tmp->next)
      {
!       if(ipequal(&tmp->main_addr, m_addr))
  	break;
       }
***************
*** 118,122 ****
    /* Check if alias is already registered with m_addr */
    registered_m_addr = mid_lookup_main_addr(&alias->alias);
!   if (registered_m_addr != NULL && COMP_IP(registered_m_addr, m_addr))
      {
        /* Alias is already registered with main address. Nothing to do here. */
--- 119,123 ----
    /* Check if alias is already registered with m_addr */
    registered_m_addr = mid_lookup_main_addr(&alias->alias);
!   if (registered_m_addr != NULL && ipequal(registered_m_addr, m_addr))
      {
        /* Alias is already registered with main address. Nothing to do here. */
***************
*** 142,146 ****
        alias->main_entry = tmp;
        QUEUE_ELEM(reverse_mid_set[alias_hash], alias);
!       COPY_IP(&tmp->main_addr, m_addr);
        tmp->ass_timer = GET_TIMESTAMP(vtime*1000);
        /* Queue */
--- 143,148 ----
        alias->main_entry = tmp;
        QUEUE_ELEM(reverse_mid_set[alias_hash], alias);
!       //COPY_IP(&tmp->main_addr, m_addr);
!       tmp->main_addr = *m_addr;
        tmp->ass_timer = GET_TIMESTAMP(vtime*1000);
        /* Queue */
***************
*** 168,173 ****
        if((tmp_2_neighbor = olsr_lookup_two_hop_neighbor_table_mid(&tmp_adr->alias)) != NULL)
  	{
! 	  OLSR_PRINTF(1, "Deleting 2 hop node from MID: %s to ", olsr_ip_to_string(&tmp_adr->alias));
! 	  OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(m_addr));
  
  	  olsr_delete_two_hop_neighbor_table(tmp_2_neighbor);
--- 170,178 ----
        if((tmp_2_neighbor = olsr_lookup_two_hop_neighbor_table_mid(&tmp_adr->alias)) != NULL)
  	{
! #ifndef NODEBUG
!           struct ipaddr_str buf;
! #endif
! 	  OLSR_PRINTF(1, "Deleting 2 hop node from MID: %s to ", olsr_ip_to_string(&buf, &tmp_adr->alias));
! 	  OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf, m_addr));
  
  	  olsr_delete_two_hop_neighbor_table(tmp_2_neighbor);
***************
*** 181,186 ****
  
  	{
! 	  OLSR_PRINTF(1, "[MID]Deleting bogus neighbor entry %s real ", olsr_ip_to_string(&tmp_adr->alias));
! 	  OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(m_addr));
  
  	  replace_neighbor_link_set(tmp_neigh, real_neigh);
--- 186,194 ----
  
  	{
! #ifndef NODEBUG
!           struct ipaddr_str buf;
! #endif
! 	  OLSR_PRINTF(1, "[MID]Deleting bogus neighbor entry %s real ", olsr_ip_to_string(&buf, &tmp_adr->alias));
! 	  OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf, m_addr));
  
  	  replace_neighbor_link_set(tmp_neigh, real_neigh);
***************
*** 215,229 ****
  insert_mid_alias(const union olsr_ip_addr *main_add, const union olsr_ip_addr *alias, float vtime)
  {
-   struct mid_address *adr;
    struct neighbor_entry *ne_old, *ne_new;
    struct mid_entry *me_old;
    int ne_ref_rp_count;
! 
!   adr = olsr_malloc(sizeof(struct mid_address), "Insert MID alias");
    
!   OLSR_PRINTF(1, "Inserting alias %s for ", olsr_ip_to_string(alias));
!   OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(main_add));
  
!   COPY_IP(&adr->alias, alias);
    adr->next_alias = NULL;
    
--- 223,239 ----
  insert_mid_alias(const union olsr_ip_addr *main_add, const union olsr_ip_addr *alias, float vtime)
  {
    struct neighbor_entry *ne_old, *ne_new;
    struct mid_entry *me_old;
    int ne_ref_rp_count;
! #ifndef NODEBUG
!   struct ipaddr_str buf;
! #endif
!   struct mid_address *adr = olsr_malloc(sizeof(struct mid_address), "Insert MID alias");
    
!   OLSR_PRINTF(1, "Inserting alias %s for ", olsr_ip_to_string(&buf, alias));
!   OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf, main_add));
  
!   //COPY_IP(&adr->alias, alias);
!   adr->alias = *alias;
    adr->next_alias = NULL;
    
***************
*** 233,237 ****
    ne_old = olsr_lookup_neighbor_table_alias(alias);
    if (ne_old != NULL) {
!      OLSR_PRINTF(2, "Remote main address change detected. Mangling neighbortable to replace %s with %s.\n", olsr_ip_to_string(alias), olsr_ip_to_string(main_add));
       olsr_delete_neighbor_table(alias);
       ne_new = olsr_insert_neighbor_table(main_add);
--- 243,247 ----
    ne_old = olsr_lookup_neighbor_table_alias(alias);
    if (ne_old != NULL) {
!      OLSR_PRINTF(2, "Remote main address change detected. Mangling neighbortable to replace %s with %s.\n", olsr_ip_to_string(&buf, alias), olsr_ip_to_string(&buf, main_add));
       olsr_delete_neighbor_table(alias);
       ne_new = olsr_insert_neighbor_table(main_add);
***************
*** 281,285 ****
        tmp_list = tmp_list->next)
  	{
! 	  if(COMP_IP(&tmp_list->alias, adr))
  	    return &tmp_list->main_entry->main_addr;
  	}
--- 291,295 ----
        tmp_list = tmp_list->next)
  	{
! 	  if(ipequal(&tmp_list->alias, adr))
  	    return &tmp_list->main_entry->main_addr;
  	}
***************
*** 308,312 ****
        tmp_list = tmp_list->next)
      {
!       if(COMP_IP(&tmp_list->main_addr, adr))
  	return tmp_list;
      }
--- 318,322 ----
        tmp_list = tmp_list->next)
      {
!       if(ipequal(&tmp_list->main_addr, adr))
  	return tmp_list;
      }
***************
*** 339,346 ****
  olsr_update_mid_table(const union olsr_ip_addr *adr, float vtime)
  {
-   struct mid_entry *tmp_list = mid_set;
    olsr_u32_t hash;
  
!   OLSR_PRINTF(3, "MID: update %s\n", olsr_ip_to_string(adr));
    hash = olsr_hashing(adr);
  
--- 349,359 ----
  olsr_update_mid_table(const union olsr_ip_addr *adr, float vtime)
  {
    olsr_u32_t hash;
+ #ifndef NODEBUG
+   struct ipaddr_str buf;
+ #endif
+   struct mid_entry *tmp_list = mid_set;
  
!   OLSR_PRINTF(3, "MID: update %s\n", olsr_ip_to_string(&buf, adr));
    hash = olsr_hashing(adr);
  
***************
*** 351,357 ****
      {
        /*find match*/
!       if(COMP_IP(&tmp_list->main_addr, adr))
  	{
! 	  // printf("MID: Updating timer for node %s\n", olsr_ip_to_string(&tmp_list->main_addr));
  	  tmp_list->ass_timer = GET_TIMESTAMP(vtime*1000);
  
--- 364,370 ----
      {
        /*find match*/
!       if(ipequal(&tmp_list->main_addr, adr))
  	{
! 	  // printf("MID: Updating timer for node %s\n", olsr_ip_to_string(&buf, &tmp_list->main_addr));
  	  tmp_list->ass_timer = GET_TIMESTAMP(vtime*1000);
  
***************
*** 387,391 ****
        entry = entry->next)
      {
!       if(COMP_IP(&entry->main_addr, m_addr))
  	break;
      }
--- 400,404 ----
        entry = entry->next)
      {
!       if(ipequal(&entry->main_addr, m_addr))
  	break;
      }
***************
*** 408,412 ****
        /* Go through the list of declared aliases to find the matching current alias */
        while(declared_aliases != 0 &&
!             ! COMP_IP(&current_alias->alias, &declared_aliases->alias_addr))
          {
            declared_aliases = declared_aliases->next;
--- 421,425 ----
        /* Go through the list of declared aliases to find the matching current alias */
        while(declared_aliases != 0 &&
!             ! ipequal(&current_alias->alias, &declared_aliases->alias_addr))
          {
            declared_aliases = declared_aliases->next;
***************
*** 415,421 ****
        if (declared_aliases == NULL)
          {
            /* Current alias not found in list of declared aliases: free current alias */
!           OLSR_PRINTF(1, "MID remove: (%s, ", olsr_ip_to_string(&entry->main_addr));
!             OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(&current_alias->alias));
  
            /* Update linked list as seen by 'entry' */
--- 428,437 ----
        if (declared_aliases == NULL)
          {
+ #ifndef NODEBUG
+           struct ipaddr_str buf;
+ #endif
            /* Current alias not found in list of declared aliases: free current alias */
!           OLSR_PRINTF(1, "MID remove: (%s, ", olsr_ip_to_string(&buf, &entry->main_addr));
!             OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(&buf, &current_alias->alias));
  
            /* Update linked list as seen by 'entry' */
***************
*** 468,476 ****
  	  if(TIMED_OUT(tmp_list->ass_timer))
  	    {
  	      struct mid_entry *entry_to_delete = tmp_list;
  	      tmp_list = tmp_list->next;
  #ifdef DEBUG
  	      OLSR_PRINTF(1, "MID info for %s timed out.. deleting it\n",
! 			  olsr_ip_to_string(&entry_to_delete->main_addr));
  #endif
  	      /*Delete it*/
--- 484,495 ----
  	  if(TIMED_OUT(tmp_list->ass_timer))
  	    {
+ #if !defined(NODEBUG) && defined(DEBUG)
+               struct ipaddr_str buf;
+ #endif
  	      struct mid_entry *entry_to_delete = tmp_list;
  	      tmp_list = tmp_list->next;
  #ifdef DEBUG
  	      OLSR_PRINTF(1, "MID info for %s timed out.. deleting it\n",
! 			  olsr_ip_to_string(&buf, &entry_to_delete->main_addr));
  #endif
  	      /*Delete it*/
***************
*** 533,541 ****
  	{
  	  struct mid_address *tmp_addr;
!           
! 	  OLSR_PRINTF(1, "%s: ", olsr_ip_to_string(&tmp_list->main_addr));
            for(tmp_addr = tmp_list->aliases;tmp_addr;tmp_addr = tmp_addr->next_alias)
  	    {
! 	      OLSR_PRINTF(1, " %s ", olsr_ip_to_string(&tmp_addr->alias));
  	    }
  	  OLSR_PRINTF(1, "\n");
--- 552,562 ----
  	{
  	  struct mid_address *tmp_addr;
! #ifndef NODEBUG
!           struct ipaddr_str buf;
! #endif          
! 	  OLSR_PRINTF(1, "%s: ", olsr_ip_to_string(&buf, &tmp_list->main_addr));
            for(tmp_addr = tmp_list->aliases;tmp_addr;tmp_addr = tmp_addr->next_alias)
  	    {
! 	      OLSR_PRINTF(1, " %s ", olsr_ip_to_string(&buf, &tmp_addr->alias));
  	    }
  	  OLSR_PRINTF(1, "\n");

Index: plugin_util.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/plugin_util.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** plugin_util.c	24 Oct 2007 13:45:00 -0000	1.7
--- plugin_util.c	8 Nov 2007 22:47:41 -0000	1.8
***************
*** 45,48 ****
--- 45,50 ----
  #include "defs.h"
  
+ #include <arpa/inet.h>
+ 
  int set_plugin_port(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused)))
  {

Index: net_olsr.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** net_olsr.c	5 Nov 2007 15:32:55 -0000	1.31
--- net_olsr.c	8 Nov 2007 22:47:41 -0000	1.32
***************
*** 207,211 ****
   */
  olsr_u16_t
! net_output_pending(struct interface *ifp)
  {
    return ifp->netbuf.pending;
--- 207,211 ----
   */
  olsr_u16_t
! net_output_pending(const struct interface *ifp)
  {
    return ifp->netbuf.pending;
***************
*** 311,319 ****
  del_ptf(packet_transform_function f)
  {
!   struct ptf *tmp_ptf, *prev;
! 
!   tmp_ptf = ptf_list;
!   prev = NULL;
! 
    while(tmp_ptf)
      {
--- 311,316 ----
  del_ptf(packet_transform_function f)
  {
!   struct ptf *prev = NULL;
!   struct ptf *tmp_ptf = ptf_list;
    while(tmp_ptf)
      {
***************
*** 345,359 ****
  net_output(struct interface *ifp)
  {
!   struct sockaddr_in *sin;  
!   struct sockaddr_in dst;
!   struct sockaddr_in6 *sin6;  
!   struct sockaddr_in6 dst6;
    struct ptf *tmp_ptf_list;
    union olsr_packet *outmsg;
    int retval;
  
-   sin = NULL;
-   sin6 = NULL;
- 
    if(!ifp->netbuf.pending)
      return 0;
--- 342,351 ----
  net_output(struct interface *ifp)
  {
!   struct sockaddr_in *sin = NULL;
!   struct sockaddr_in6 *sin6 = NULL;
    struct ptf *tmp_ptf_list;
    union olsr_packet *outmsg;
    int retval;
  
    if(!ifp->netbuf.pending)
      return 0;
***************
*** 371,374 ****
--- 363,367 ----
    if(olsr_cnf->ip_version == AF_INET)
      {
+       struct sockaddr_in dst;
        /* IP version 4 */
        sin = (struct sockaddr_in *)&ifp->int_broadaddr;
***************
*** 383,386 ****
--- 376,380 ----
    else
      {
+       struct sockaddr_in6 dst6;
        /* IP version 6 */
        sin6 = (struct sockaddr_in6 *)&ifp->int6_multaddr;
***************
*** 433,440 ****
  	 < 0)
  	{
  	  perror("sendto(v6)");
  	  olsr_syslog(OLSR_LOG_ERR, "OLSR: sendto IPv6 %m");
  	  fprintf(stderr, "Socket: %d interface: %d\n", ifp->olsr_socket, ifp->if_index);
! 	  fprintf(stderr, "To: %s (size: %d)\n", ip6_to_string(&sin6->sin6_addr), (int)sizeof(*sin6));
  	  fprintf(stderr, "Outputsize: %d\n", ifp->netbuf.pending);
  	  retval = -1;
--- 427,435 ----
  	 < 0)
  	{
+           struct ipaddr_str buf;
  	  perror("sendto(v6)");
  	  olsr_syslog(OLSR_LOG_ERR, "OLSR: sendto IPv6 %m");
  	  fprintf(stderr, "Socket: %d interface: %d\n", ifp->olsr_socket, ifp->if_index);
! 	  fprintf(stderr, "To: %s (size: %u)\n", ip6_to_string(&buf, &sin6->sin6_addr), (unsigned int)sizeof(*sin6));
  	  fprintf(stderr, "Outputsize: %d\n", ifp->netbuf.pending);
  	  retval = -1;
***************
*** 455,459 ****
  
  /**
!  * Create a IPv6 netmask based on a prefix length
   *
   * @param allocated address to build the netmask in
--- 450,454 ----
  
  /**
!  * Create a IPv4 or IPv6 netmask based on a prefix length
   *
   * @param allocated address to build the netmask in
***************
*** 465,488 ****
  olsr_prefix_to_netmask(union olsr_ip_addr *adr, const olsr_u16_t prefix)
  {
    int p;
    olsr_u8_t *a;
  
!   if(adr == NULL) {
      return 0;
    }
  
    a = adr->v6.s6_addr;
!   for (p = prefix; p > 8; p -= 8) {
      *a++ = 0xff;
    }
!   *a++ = 0xff << p;
!   while (a < adr->v6.s6_addr+olsr_cnf->ipsize) {
      *a++ = 0;
    }
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "Prefix %d = Netmask: %s\n", prefix, olsr_ip_to_string(adr));
  #endif
- 
    return 1;
  }
--- 460,486 ----
  olsr_prefix_to_netmask(union olsr_ip_addr *adr, const olsr_u16_t prefix)
  {
+ #if !defined(NODEBUG) && defined(DEBUG)
+   struct ipaddr_str buf;
+ #endif
    int p;
+   const olsr_u8_t * const a_end = adr->v6.s6_addr+olsr_cnf->ipsize;
    olsr_u8_t *a;
  
!   if (adr == NULL) {
      return 0;
    }
  
    a = adr->v6.s6_addr;
!   for (p = prefix; a < a_end && p > 8; p -= 8) {
      *a++ = 0xff;
    }
!   *a++ = 0xff << (8 - p);
!   while (a < a_end) {
      *a++ = 0;
    }
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "Prefix %d = Netmask: %s\n", prefix, olsr_ip_to_string(&buf, adr));
  #endif
    return 1;
  }
***************
*** 500,516 ****
  olsr_netmask_to_prefix(const union olsr_ip_addr *adr)
  {
    olsr_u16_t prefix = 0;
-   unsigned int i;
    olsr_u8_t tmp;
  
!   for (i = 0; i < olsr_cnf->ipsize && adr->v6.s6_addr[i] == 0xff; i++) {
      prefix += 8;
    }
!   for (tmp = adr->v6.s6_addr[i]; tmp > 0; tmp <<= 1) {
      prefix++;
    }
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "Netmask: %s = Prefix %d\n", olsr_ip_to_string(adr), prefix);
  #endif
  
--- 498,518 ----
  olsr_netmask_to_prefix(const union olsr_ip_addr *adr)
  {
+ #if !defined(NODEBUG) && defined(DEBUG)
+   struct ipaddr_str buf;
+ #endif
    olsr_u16_t prefix = 0;
    olsr_u8_t tmp;
+   const olsr_u8_t * const a_end = adr->v6.s6_addr+olsr_cnf->ipsize;
+   const olsr_u8_t *a;
  
!   for (a = adr->v6.s6_addr; a < a_end && *a == 0xff; a++) {
      prefix += 8;
    }
!   for (tmp = *a; tmp > 0; tmp <<= 1) {
      prefix++;
    }
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "Netmask: %s = Prefix %d\n", olsr_ip_to_string(&buf, adr), prefix);
  #endif
  
***************
*** 518,557 ****
  }
  
- 
  /**
   *Converts a sockaddr struct to a string representing
   *the IP address from the sockaddr struct
   *
-  *<b>NON REENTRANT!!!!</b>
-  *
   *@param address_to_convert the sockaddr struct to "convert"
   *@return a char pointer to the string containing the IP
   */
! char *
! sockaddr_to_string(const struct sockaddr *address_to_convert)
  {
!   const struct sockaddr_in *address = (const struct sockaddr_in *)address_to_convert; 
!   return inet_ntoa(address->sin_addr);
!   
  }
  
- 
  /**
   *Converts the 32bit olsr_u32_t datatype to
   *a char array.
   *
-  *<b>NON REENTRANT!!!!</b>
-  *
   *@param address the olsr_u32_t to "convert"
   *@return a char pointer to the string containing the IP
   */
- 
  const char *
! ip_to_string(const olsr_u32_t *address)
  {
!   struct in_addr in;
!   in.s_addr=*address;
!   return inet_ntoa(in);
!   
  }
  
--- 520,548 ----
  }
  
  /**
   *Converts a sockaddr struct to a string representing
   *the IP address from the sockaddr struct
   *
   *@param address_to_convert the sockaddr struct to "convert"
   *@return a char pointer to the string containing the IP
   */
! const char *
! sockaddr_to_string(struct ipaddr_str * const buf, const struct sockaddr * const addr)
  {
!     const struct sockaddr_in * const addr4 = (const struct sockaddr_in *)addr;
!     return ip4_to_string(buf, addr4->sin_addr);
  }
  
  /**
   *Converts the 32bit olsr_u32_t datatype to
   *a char array.
   *
   *@param address the olsr_u32_t to "convert"
   *@return a char pointer to the string containing the IP
   */
  const char *
! ip4_to_string(struct ipaddr_str * const buf, const struct in_addr addr4)
  {
!     return inet_ntop(AF_INET, &addr4, buf->buf, sizeof(buf->buf));
  }
  
***************
*** 560,596 ****
   *a char array.
   *
-  *<b>NON REENTRANT</b>
-  *
   *@param addr6 the address to "convert"
   *@return a char pointer to the string containing the IP
   */
- 
  const char *
! ip6_to_string(const struct in6_addr *addr6)
  {
!   static char ipv6_buf[INET6_ADDRSTRLEN]; /* for address coversion */
!   return inet_ntop(AF_INET6, addr6, ipv6_buf, sizeof(ipv6_buf));
  }
  
  const char *
! olsr_ip_to_string(const union olsr_ip_addr *addr)
  {
!   static int idx = 0;
!   static char buff[4][MAX(INET6_ADDRSTRLEN,INET_ADDRSTRLEN)];
!   const char *ret;
! 
!   if (!addr) {
!       return "null";
!   }
!   
!   if(olsr_cnf->ip_version == AF_INET) {
!     ret = inet_ntop(AF_INET, &addr->v4, buff[idx], sizeof(buff[idx]));
!   } else {
!     /* IPv6 */
!     ret = inet_ntop(AF_INET6, &addr->v6, buff[idx], sizeof(buff[idx]));
!   }
!   idx = (idx + 1) & 3;
! 
!   return ret;
  }
  
--- 551,572 ----
   *a char array.
   *
   *@param addr6 the address to "convert"
   *@return a char pointer to the string containing the IP
   */
  const char *
! ip6_to_string(struct ipaddr_str * const buf, const struct in6_addr * const addr6)
  {
!   return inet_ntop(AF_INET6, addr6, buf->buf, sizeof(buf->buf));
  }
  
  const char *
! olsr_ip_to_string(struct ipaddr_str * const buf, const union olsr_ip_addr *addr)
  {
! #if 0
!     if (!addr) {
!         return "null";
!     }
! #endif
!     return inet_ntop(olsr_cnf->ip_version, addr, buf->buf, sizeof(buf->buf));
  }
  
***************
*** 629,672 ****
  olsr_add_invalid_address(const union olsr_ip_addr *adr)
  {
!   struct deny_address_entry *new_entry;
! 
!   new_entry = olsr_malloc(sizeof(struct deny_address_entry), "Add deny address");
  
    new_entry->next = deny_entries;
-   COPY_IP(&new_entry->addr, adr);
- 
    deny_entries = new_entry;
! 
!   OLSR_PRINTF(1, "Added %s to IP deny set\n", olsr_ip_to_string(&new_entry->addr));
!   return;
  }
  
! /**
!  *Converts the 32bit olsr_u32_t datatype to
!  *a char array.
!  *
!  *<b>NON REENTRANT</b>
!  *
!  *@param addr6 the address to "convert"
!  *@return a char pointer to the string containing the IP
!  */
  olsr_bool
  olsr_validate_address(const union olsr_ip_addr *adr)
  {
!   const struct deny_address_entry *deny_entry = deny_entries;
  
!   while (deny_entry) {
!     if (COMP_IP(adr, &deny_entry->addr)) {
!       OLSR_PRINTF(1, "Validation of address %s failed!\n",
!                   olsr_ip_to_string(adr));
        return OLSR_FALSE;
      }
- 
-     deny_entry = deny_entry->next;
    }
- 
    return OLSR_TRUE;
  }
  
  /*
   * Local Variables:
--- 605,645 ----
  olsr_add_invalid_address(const union olsr_ip_addr *adr)
  {
! #ifndef NODEBUG
!   struct ipaddr_str buf;
! #endif
!   struct deny_address_entry *new_entry = olsr_malloc(sizeof(struct deny_address_entry), "Add deny address");
  
+   new_entry->addr = *adr;
    new_entry->next = deny_entries;
    deny_entries = new_entry;
!   OLSR_PRINTF(1, "Added %s to IP deny set\n", olsr_ip_to_string(&buf, &new_entry->addr));
  }
  
! 
  olsr_bool
  olsr_validate_address(const union olsr_ip_addr *adr)
  {
!   const struct deny_address_entry *deny_entry;
  
!   for (deny_entry = deny_entries; deny_entry != NULL; deny_entry = deny_entry->next) {
!     if(ipequal(adr, &deny_entry->addr))	{
! #ifndef NODEBUG
!       struct ipaddr_str buf;
! #endif
!       OLSR_PRINTF(1, "Validation of address %s failed!\n", olsr_ip_to_string(&buf, adr));
        return OLSR_FALSE;
      }
    }
    return OLSR_TRUE;
  }
  
+ 
+ int ipcmp(const union olsr_ip_addr * const a, const union olsr_ip_addr * const b)
+ {
+     return  olsr_cnf->ip_version == AF_INET
+         ? ip4cmp(&a->v4, &b->v4)
+         : ip6cmp(&a->v6, &b->v6);
+ }
+ 
  /*
   * Local Variables:

Index: build_msg.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/build_msg.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** build_msg.c	5 Nov 2007 15:32:55 -0000	1.37
--- build_msg.c	8 Nov 2007 22:47:41 -0000	1.38
***************
*** 46,49 ****
--- 46,50 ----
  #include "local_hna_set.h"
  #include "mantissa.h"
+ #include "net_olsr.h"
  
  #define BMSG_DBGLVL 5
***************
*** 298,302 ****
    m->v4.olsr_msgtype = HELLO_MESSAGE;
    /* Set source(main) addr */
!   COPY_IP(&m->v4.originator, &olsr_cnf->main_addr);
  
    m->v4.olsr_vtime = ifp->valtimes.hello;
--- 299,304 ----
    m->v4.olsr_msgtype = HELLO_MESSAGE;
    /* Set source(main) addr */
!   //COPY_IP(&m->v4.originator, &olsr_cnf->main_addr);
!   m->v4.originator = olsr_cnf->main_addr.v4.s_addr;
  
    m->v4.olsr_vtime = ifp->valtimes.hello;
***************
*** 320,323 ****
--- 322,328 ----
        for(j = 0; j <= MAX_LINK; j++)
  	{
+ #if !defined(NODEBUG) && defined(DEBUG)
+           struct ipaddr_str buf;
+ #endif
  
  	  /* HYSTERESIS - Not adding neighbors with link type HIDE */
***************
*** 335,341 ****
  
  #ifdef DEBUG
! 	      OLSR_PRINTF(BMSG_DBGLVL, "\t%s - ", olsr_ip_to_string(&nb->address));
  	      OLSR_PRINTF(BMSG_DBGLVL, "L:%d N:%d\n", j, i);
! #endif		  
  	      /*
  	       * If there is not enough room left 
--- 340,346 ----
  
  #ifdef DEBUG
! 	      OLSR_PRINTF(BMSG_DBGLVL, "\t%s - ", olsr_ip_to_string(&buf, &nb->address));
  	      OLSR_PRINTF(BMSG_DBGLVL, "L:%d N:%d\n", j, i);
! #endif
  	      /*
  	       * If there is not enough room left 
***************
*** 391,395 ****
  		}
  	      
! 	      COPY_IP(haddr, &nb->address);
  	      
  	      /* Point to next address */
--- 396,401 ----
  		}
  	      
! 	      //COPY_IP(haddr, &nb->address);
! 	      *haddr = nb->address;
  	      
  	      /* Point to next address */
***************
*** 469,473 ****
    m->v6.hopcnt = 0;
    /* Set source(main) addr */
!   COPY_IP(&m->v6.originator, &olsr_cnf->main_addr);
    m->v6.olsr_msgtype = HELLO_MESSAGE;
  
--- 475,480 ----
    m->v6.hopcnt = 0;
    /* Set source(main) addr */
!   //COPY_IP(&m->v6.originator, &olsr_cnf->main_addr);
!   m->v6.originator = olsr_cnf->main_addr.v6;
    m->v6.olsr_msgtype = HELLO_MESSAGE;
  
***************
*** 488,491 ****
--- 495,501 ----
        for(j = 0; j <= MAX_LINK; j++)
  	{
+ #if !defined(NODEBUG) && defined(DEBUG)
+           struct ipaddr_str buf;
+ #endif
  	  first_entry = OLSR_TRUE;
  	  	  
***************
*** 499,505 ****
  
  #ifdef DEBUG
! 	      OLSR_PRINTF(BMSG_DBGLVL, "\t%s - ", olsr_ip_to_string(&nb->address));
  	      OLSR_PRINTF(BMSG_DBGLVL, "L:%d N:%d\n", j, i);
! #endif		  
  
  
--- 509,515 ----
  
  #ifdef DEBUG
! 	      OLSR_PRINTF(BMSG_DBGLVL, "\t%s - ", olsr_ip_to_string(&buf, &nb->address));
  	      OLSR_PRINTF(BMSG_DBGLVL, "L:%d N:%d\n", j, i);
! #endif
  
  
***************
*** 556,560 ****
  		}
  		  
! 	      COPY_IP(haddr, &nb->address);
  		  
  	      /* Point to next address */
--- 566,571 ----
  		}
  		  
! 	      //COPY_IP(haddr, &nb->address);
! 	      *haddr = nb->address;
  		  
  	      /* Point to next address */
***************
*** 600,604 ****
  serialize_tc4(struct tc_message *message, struct interface *ifp)           
  {
! 
    olsr_u16_t remainsize, curr_size;
    struct tc_mpr_addr *mprs;
--- 611,617 ----
  serialize_tc4(struct tc_message *message, struct interface *ifp)           
  {
! #if !defined(NODEBUG) && defined(DEBUG)
!   struct ipaddr_str buf;
! #endif
    olsr_u16_t remainsize, curr_size;
    struct tc_mpr_addr *mprs;
***************
*** 634,638 ****
    m->v4.hopcnt = message->hop_count;
    m->v4.ttl = message->ttl;
!   COPY_IP(&m->v4.originator, &message->originator);
  
    /* Fill TC header */
--- 647,652 ----
    m->v4.hopcnt = message->hop_count;
    m->v4.ttl = message->ttl;
!   //COPY_IP(&m->v4.originator, &message->originator);
!   m->v4.originator = message->originator.v4.s_addr;
  
    /* Fill TC header */
***************
*** 675,682 ****
  #ifdef DEBUG
  	  OLSR_PRINTF(BMSG_DBGLVL, "\t%s\n", 
! 		      olsr_ip_to_string(&mprs->address));
  #endif 
!       COPY_IP(&mprsaddr->addr, &mprs->address);
! 
        curr_size += olsr_cnf->ipsize;
        mprsaddr++;
--- 689,696 ----
  #ifdef DEBUG
  	  OLSR_PRINTF(BMSG_DBGLVL, "\t%s\n", 
! 		      olsr_ip_to_string(&buf, &mprs->address));
  #endif 
!       //COPY_IP(&mprsaddr->addr, &mprs->address);
!       mprsaddr->addr = mprs->address.v4.s_addr;
        curr_size += olsr_cnf->ipsize;
        mprsaddr++;
***************
*** 726,730 ****
  serialize_tc6(struct tc_message *message, struct interface *ifp)           
  {
! 
    olsr_u16_t remainsize, curr_size;
    struct tc_mpr_addr *mprs;
--- 740,746 ----
  serialize_tc6(struct tc_message *message, struct interface *ifp)           
  {
! #if !defined(NODEBUG) && defined(DEBUG)
!   struct ipaddr_str buf;
! #endif
    olsr_u16_t remainsize, curr_size;
    struct tc_mpr_addr *mprs;
***************
*** 759,763 ****
    m->v6.hopcnt = message->hop_count;
    m->v6.ttl = message->ttl;
!   COPY_IP(&m->v6.originator, &message->originator);
  
    /* Fill TC header */
--- 775,780 ----
    m->v6.hopcnt = message->hop_count;
    m->v6.ttl = message->ttl;
!   //COPY_IP(&m->v6.originator, &message->originator);
!   m->v6.originator = message->originator.v6;
  
    /* Fill TC header */
***************
*** 796,802 ****
  #ifdef DEBUG
  	  OLSR_PRINTF(BMSG_DBGLVL, "\t%s\n", 
! 		      olsr_ip_to_string(&mprs->address));
  #endif
!       COPY_IP(&mprsaddr6->addr, &mprs->address);
        curr_size += olsr_cnf->ipsize;
  
--- 813,820 ----
  #ifdef DEBUG
  	  OLSR_PRINTF(BMSG_DBGLVL, "\t%s\n", 
! 		      olsr_ip_to_string(&buf, &mprs->address));
  #endif
!       //COPY_IP(&mprsaddr6->addr, &mprs->address);
!       mprsaddr6->addr = mprs->address.v6;
        curr_size += olsr_cnf->ipsize;
  
***************
*** 872,876 ****
    m->v4.ttl = MAX_TTL;
    /* Set main(first) address */
!   COPY_IP(&m->v4.originator, &olsr_cnf->main_addr);
    m->v4.olsr_msgtype = MID_MESSAGE;
    m->v4.olsr_vtime = ifp->valtimes.mid;
--- 890,895 ----
    m->v4.ttl = MAX_TTL;
    /* Set main(first) address */
!   //COPY_IP(&m->v4.originator, &olsr_cnf->main_addr);
!   m->v4.originator = olsr_cnf->main_addr.v4.s_addr;
    m->v4.olsr_msgtype = MID_MESSAGE;
    m->v4.olsr_vtime = ifp->valtimes.mid;
***************
*** 881,886 ****
    for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next)
      {
!       if(!COMP_IP(&olsr_cnf->main_addr, &ifs->ip_addr))
  	{
  
  	  if((curr_size + olsr_cnf->ipsize) > remainsize)
--- 900,908 ----
    for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next)
      {
!       if(!ipequal(&olsr_cnf->main_addr, &ifs->ip_addr))
  	{
+ #if !defined(NODEBUG) && defined(DEBUG)
+           struct ipaddr_str buf;
+ #endif
  
  	  if((curr_size + olsr_cnf->ipsize) > remainsize)
***************
*** 906,914 ****
  #ifdef DEBUG
  	  OLSR_PRINTF(BMSG_DBGLVL, "\t%s(%s)\n", 
! 		      olsr_ip_to_string(&ifs->ip_addr), 
  		      ifs->int_name);
  #endif
  	  
! 	  COPY_IP(&addrs->addr, &ifs->ip_addr);
  	  addrs++;
  	  curr_size += olsr_cnf->ipsize;
--- 928,937 ----
  #ifdef DEBUG
  	  OLSR_PRINTF(BMSG_DBGLVL, "\t%s(%s)\n", 
! 		      olsr_ip_to_string(&buf, &ifs->ip_addr), 
  		      ifs->int_name);
  #endif
  	  
! 	  //COPY_IP(&addrs->addr, &ifs->ip_addr);
!           addrs->addr = ifs->ip_addr.v4.s_addr;
  	  addrs++;
  	  curr_size += olsr_cnf->ipsize;
***************
*** 973,978 ****
    m->v6.olsr_vtime = ifp->valtimes.mid;
    /* Set main(first) address */
!   COPY_IP(&m->v6.originator, &olsr_cnf->main_addr);
!    
  
    addrs6 = m->v6.message.mid.mid_addr;
--- 996,1001 ----
    m->v6.olsr_vtime = ifp->valtimes.mid;
    /* Set main(first) address */
!   //COPY_IP(&m->v6.originator, &olsr_cnf->main_addr);
!   m->v6.originator = olsr_cnf->main_addr.v6;
  
    addrs6 = m->v6.message.mid.mid_addr;
***************
*** 981,986 ****
    for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next)
      {
!       if(!COMP_IP(&olsr_cnf->main_addr, &ifs->ip_addr))
  	{
  	  if((curr_size + olsr_cnf->ipsize) > remainsize)
  	    {
--- 1004,1012 ----
    for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next)
      {
!       if(!ipequal(&olsr_cnf->main_addr, &ifs->ip_addr))
  	{
+ #if !defined(NODEBUG) && defined(DEBUG)
+           struct ipaddr_str buf;
+ #endif
  	  if((curr_size + olsr_cnf->ipsize) > remainsize)
  	    {
***************
*** 1005,1013 ****
  #ifdef DEBUG
  		  OLSR_PRINTF(BMSG_DBGLVL, "\t%s(%s)\n", 
! 			      olsr_ip_to_string(&ifs->ip_addr), 
  			      ifs->int_name);
  #endif
  
! 	  COPY_IP(&addrs6->addr, &ifs->ip_addr);
  	  addrs6++;
  	  curr_size += olsr_cnf->ipsize;
--- 1031,1040 ----
  #ifdef DEBUG
  		  OLSR_PRINTF(BMSG_DBGLVL, "\t%s(%s)\n", 
! 			      olsr_ip_to_string(&buf, &ifs->ip_addr), 
  			      ifs->int_name);
  #endif
  
!           //COPY_IP(&addrs6->addr, &ifs->ip_addr);
!           addrs6->addr = ifs->ip_addr.v6;
  	  addrs6++;
  	  curr_size += olsr_cnf->ipsize;
***************
*** 1063,1067 ****
    
    /* Fill header */
!   COPY_IP(&m->v4.originator, &olsr_cnf->main_addr);
    m->v4.hopcnt = 0;
    m->v4.ttl = MAX_TTL;
--- 1090,1095 ----
    
    /* Fill header */
!   //COPY_IP(&m->v4.originator, &olsr_cnf->main_addr);
!   m->v4.originator = olsr_cnf->main_addr.v4.s_addr;
    m->v4.hopcnt = 0;
    m->v4.ttl = MAX_TTL;
***************
*** 1096,1102 ****
        OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net));
  #endif
!       COPY_IP(&pair->addr, &h->net.prefix);
        olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len);
!       pair->addr = ip_addr.v4;
        pair++;
        curr_size += (2 * olsr_cnf->ipsize);
--- 1124,1132 ----
        OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net));
  #endif
!       //COPY_IP(&pair->addr, &h->net);
!       pair->addr = h->net.prefix.v4.s_addr;
!       //COPY_IP(&pair->netmask, &h->netmask);
        olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len);
!       pair->netmask = ip_addr.v4.s_addr;
        pair++;
        curr_size += (2 * olsr_cnf->ipsize);
***************
*** 1114,1120 ****
  
  
- 
- 
- 
  /**
   *IP version 6
--- 1144,1147 ----
***************
*** 1153,1157 ****
  
    /* Fill header */
!   COPY_IP(&m->v6.originator, &olsr_cnf->main_addr);
    m->v6.hopcnt = 0;
    m->v6.ttl = MAX_TTL;
--- 1180,1185 ----
  
    /* Fill header */
!   //COPY_IP(&m->v6.originator, &olsr_cnf->main_addr);
!   m->v6.originator = olsr_cnf->main_addr.v6;
    m->v6.hopcnt = 0;
    m->v6.ttl = MAX_TTL;
***************
*** 1185,1191 ****
        OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net));
  #endif
!       COPY_IP(&pair6->addr, &h->net.prefix);
        olsr_prefix_to_netmask(&tmp_netmask, h->net.prefix_len);
!       COPY_IP(&pair6->netmask, &tmp_netmask);
        pair6++;
        curr_size += (2 * olsr_cnf->ipsize);
--- 1213,1221 ----
        OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net));
  #endif
!       //COPY_IP(&pair6->addr, &h->net);
!       pair6->addr = h->net.prefix.v6;
!       //COPY_IP(&pair6->netmask, &tmp_netmask);
        olsr_prefix_to_netmask(&tmp_netmask, h->net.prefix_len);
!       pair6->netmask = tmp_netmask.v6;
        pair6++;
        curr_size += (2 * olsr_cnf->ipsize);

Index: routing_table.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** routing_table.c	16 Oct 2007 09:54:43 -0000	1.32
--- routing_table.c	8 Nov 2007 22:47:41 -0000	1.33
***************
*** 51,55 ****
  #include "lq_avl.h"
  #include "lq_route.h"
! #include "assert.h"
  
  struct avl_tree routingtree;
--- 51,57 ----
  #include "lq_avl.h"
  #include "lq_route.h"
! #include "net_olsr.h"
! 
! #include <assert.h>
  
  struct avl_tree routingtree;
***************
*** 81,96 ****
   */
  int
! avl_comp_ipv4_prefix (void *prefix1, void *prefix2)
  {       
!   struct olsr_ip_prefix *pfx1, *pfx2;
! 
!   pfx1 = prefix1;
!   pfx2 = prefix2;
  
    /* prefix */
!   if (pfx1->prefix.v4 < pfx2->prefix.v4) {
      return -1;
    }
!   if (pfx1->prefix.v4 > pfx2->prefix.v4) {
      return +1;
    }
--- 83,96 ----
   */
  int
! avl_comp_ipv4_prefix (const void *prefix1, const void *prefix2)
  {       
!   const struct olsr_ip_prefix *pfx1 = prefix1;
!   const struct olsr_ip_prefix *pfx2 = prefix2;
  
    /* prefix */
!   if (pfx1->prefix.v4.s_addr < pfx2->prefix.v4.s_addr) {
      return -1;
    }
!   if (pfx1->prefix.v4.s_addr > pfx2->prefix.v4.s_addr) {
      return +1;
    }
***************
*** 118,128 ****
   */
  int
! avl_comp_ipv6_prefix (void *prefix1, void *prefix2)
  {       
-   struct olsr_ip_prefix *pfx1, *pfx2;
    int res;
! 
!   pfx1 = prefix1;
!   pfx2 = prefix2;
  
    /* prefix */
--- 118,126 ----
   */
  int
! avl_comp_ipv6_prefix (const void *prefix1, const void *prefix2)
  {       
    int res;
!   const struct olsr_ip_prefix *pfx1 = prefix1;
!   const struct olsr_ip_prefix *pfx2 = prefix2;
  
    /* prefix */
***************
*** 174,178 ****
    struct olsr_ip_prefix prefix;
  
!   COPY_IP(&prefix, dst);
    prefix.prefix_len = olsr_cnf->maxplen;
  
--- 172,176 ----
    struct olsr_ip_prefix prefix;
  
!   prefix.prefix = *dst;
    prefix.prefix_len = olsr_cnf->maxplen;
  
***************
*** 261,265 ****
    memset(rtp, 0, sizeof(struct rt_path));
  
!   COPY_IP(&rtp->rtp_originator, originator);
  
    /* set key and backpointer prior to tree insertion */
--- 259,264 ----
    memset(rtp, 0, sizeof(struct rt_path));
  
!   //COPY_IP(&rtp->rtp_originator, originator);
!   rtp->rtp_originator = *originator;
  
    /* set key and backpointer prior to tree insertion */
***************
*** 282,286 ****
  olsr_nh_change(struct rt_nexthop *nh1, struct rt_nexthop *nh2)
  {
!   if ((!COMP_IP(&nh1->gateway, &nh2->gateway)) ||
        (nh1->iif_index != nh2->iif_index)) {
      return OLSR_TRUE;
--- 281,285 ----
  olsr_nh_change(struct rt_nexthop *nh1, struct rt_nexthop *nh2)
  {
!   if (!ipequal(&nh1->gateway, &nh2->gateway) ||
        (nh1->iif_index != nh2->iif_index)) {
      return OLSR_TRUE;
***************
*** 362,368 ****
    node = avl_walk_first(&rt->rt_path_tree);
  
!   if (!node) {
!     assert(0); /* should not happen */
!   }
  
    rt->rt_best = node->data;
--- 361,365 ----
    node = avl_walk_first(&rt->rt_path_tree);
  
!   assert(node != 0); /* should not happen */
  
    rt->rt_best = node->data;
***************
*** 472,481 ****
  {
    static char buff[128];
  
    snprintf(buff, sizeof(buff),
             "%s/%u via %s",
!            olsr_ip_to_string(&rt->rt_dst.prefix),
             rt->rt_dst.prefix_len,
!            olsr_ip_to_string(&rt->rt_nexthop.gateway));
  
    return buff;
--- 469,479 ----
  {
    static char buff[128];
+   struct ipaddr_str prefixstr, gwstr;
  
    snprintf(buff, sizeof(buff),
             "%s/%u via %s",
!            olsr_ip_to_string(&prefixstr, &rt->rt_dst.prefix),
             rt->rt_dst.prefix_len,
!            olsr_ip_to_string(&gwstr, &rt->rt_nexthop.gateway));
  
    return buff;
***************
*** 488,503 ****
  olsr_rtp_to_string(struct rt_path *rtp)
  {
-   struct rt_entry *rt;
    static char buff[128];
! 
!   rt = rtp->rtp_rt;
  
    snprintf(buff, sizeof(buff),
             "%s/%u from %s via %s, "
             "etx %.3f, metric %u, v %u",
!            olsr_ip_to_string(&rt->rt_dst.prefix),
             rt->rt_dst.prefix_len,
!            olsr_ip_to_string(&rtp->rtp_originator),
!            olsr_ip_to_string(&rtp->rtp_nexthop.gateway),
             rtp->rtp_metric.etx,
             rtp->rtp_metric.hops,
--- 486,500 ----
  olsr_rtp_to_string(struct rt_path *rtp)
  {
    static char buff[128];
!   struct ipaddr_str prefixstr, origstr, gwstr;
!   struct rt_entry *rt = rtp->rtp_rt;
  
    snprintf(buff, sizeof(buff),
             "%s/%u from %s via %s, "
             "etx %.3f, metric %u, v %u",
!            olsr_ip_to_string(&prefixstr, &rt->rt_dst.prefix),
             rt->rt_dst.prefix_len,
!            olsr_ip_to_string(&origstr, &rtp->rtp_originator),
!            olsr_ip_to_string(&gwstr, &rtp->rtp_nexthop.gateway),
             rtp->rtp_metric.etx,
             rtp->rtp_metric.hops,
***************
*** 563,570 ****
  olsr_print_routing_table(struct avl_tree *tree)
  {
!   struct rt_entry *rt;
!   struct rt_path *rtp;
! 
!   struct avl_node *rt_tree_node, *rtp_tree_node;
  
    printf("ROUTING TABLE\n");
--- 560,564 ----
  olsr_print_routing_table(struct avl_tree *tree)
  {
!   struct avl_node *rt_tree_node;
  
    printf("ROUTING TABLE\n");
***************
*** 573,585 ****
         rt_tree_node;
         rt_tree_node = avl_walk_next(rt_tree_node)) {
! 
!     rt = rt_tree_node->data;
  
      /* first the route entry */
      printf("%s/%u, via %s, best-originator %s\n",
!            olsr_ip_to_string(&rt->rt_dst.prefix),
             rt->rt_dst.prefix_len,
!            olsr_ip_to_string(&rt->rt_nexthop.gateway),
!            olsr_ip_to_string(&rt->rt_best->rtp_originator));
  
      /* walk the per-originator path tree of routes */
--- 567,580 ----
         rt_tree_node;
         rt_tree_node = avl_walk_next(rt_tree_node)) {
!     struct avl_node *rtp_tree_node;
!     struct ipaddr_str prefixstr, origstr, gwstr;
!     struct rt_entry * const rt = rt_tree_node->data;
  
      /* first the route entry */
      printf("%s/%u, via %s, best-originator %s\n",
!            olsr_ip_to_string(&prefixstr, &rt->rt_dst.prefix),
             rt->rt_dst.prefix_len,
!            olsr_ip_to_string(&origstr, &rt->rt_nexthop.gateway),
!            olsr_ip_to_string(&gwstr, &rt->rt_best->rtp_originator));
  
      /* walk the per-originator path tree of routes */
***************
*** 588,601 ****
           rtp_tree_node = avl_walk_next(rtp_tree_node)) {
  
!       rtp = rtp_tree_node->data;
! 
        printf("\tfrom %s, etx %.3f, metric %u, via %s, %s, v %u\n",
!              olsr_ip_to_string(&rtp->rtp_originator),
               rtp->rtp_metric.etx,
               rtp->rtp_metric.hops,
!              olsr_ip_to_string(&rtp->rtp_nexthop.gateway),
               if_ifwithindex_name(rt->rt_nexthop.iif_index),
!              rtp->rtp_version);
!     
      }
    }
--- 583,594 ----
           rtp_tree_node = avl_walk_next(rtp_tree_node)) {
  
!       const struct rt_path * const rtp = rtp_tree_node->data;
        printf("\tfrom %s, etx %.3f, metric %u, via %s, %s, v %u\n",
!              olsr_ip_to_string(&origstr, &rtp->rtp_originator),
               rtp->rtp_metric.etx,
               rtp->rtp_metric.hops,
!              olsr_ip_to_string(&gwstr, &rtp->rtp_nexthop.gateway),
               if_ifwithindex_name(rt->rt_nexthop.iif_index),
!              rtp->rtp_version);    
      }
    }

Index: ipc_frontend.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** ipc_frontend.c	5 Nov 2007 15:32:55 -0000	1.37
--- ipc_frontend.c	8 Nov 2007 22:47:41 -0000	1.38
***************
*** 54,57 ****
--- 54,58 ----
  #include "socket_parser.h"
  #include "local_hna_set.h"
+ #include "net_olsr.h"
  
  #ifdef WIN32
***************
*** 177,186 ****
  
  olsr_bool
! ipc_check_allowed_ip(union olsr_ip_addr *addr)
  {
    struct ipc_host *ipch = olsr_cnf->ipc_hosts;
    struct ipc_net *ipcn = olsr_cnf->ipc_nets;
  
!   if(addr->v4 == ntohl(INADDR_LOOPBACK))
      return OLSR_TRUE;
  
--- 178,187 ----
  
  olsr_bool
! ipc_check_allowed_ip(const union olsr_ip_addr *addr)
  {
    struct ipc_host *ipch = olsr_cnf->ipc_hosts;
    struct ipc_net *ipcn = olsr_cnf->ipc_nets;
  
!   if(addr->v4.s_addr == ntohl(INADDR_LOOPBACK))
      return OLSR_TRUE;
  
***************
*** 188,192 ****
    while(ipch)
      {
!       if(addr->v4 == ipch->host.v4)
  	return OLSR_TRUE;
        ipch = ipch->next;
--- 189,193 ----
    while(ipch)
      {
!         if(ipequal(addr, &ipch->host))
  	return OLSR_TRUE;
        ipch = ipch->next;
***************
*** 196,200 ****
    while(ipcn)
      {
!       if((addr->v4 & ipcn->mask.v4) == (ipcn->net.v4 & ipcn->mask.v4))
  	return OLSR_TRUE;
        ipcn = ipcn->next;
--- 197,201 ----
    while(ipcn)
      {
!       if((addr->v4.s_addr & ipcn->mask.v4.s_addr) == (ipcn->net.v4.s_addr & ipcn->mask.v4.s_addr))
  	return OLSR_TRUE;
        ipcn = ipcn->next;
***************
*** 218,222 ****
    {
      char	buf[MAXPACKETSIZE+1];
!     struct	olsr olsr;
    } inbuf;
  
--- 219,223 ----
    {
      char	buf[MAXPACKETSIZE+1];
!     struct olsr	olsr;
    } inbuf;
  
***************
*** 271,276 ****
   */
  int
! ipc_route_send_rtentry(union olsr_ip_addr *dst, union olsr_ip_addr *gw,
!                        int met, int add, const char *int_name)
  {
    struct ipcmsg packet;
--- 272,280 ----
   */
  int
! ipc_route_send_rtentry(union olsr_ip_addr *dst,
!                        union olsr_ip_addr *gw,
!                        int met,
!                        int add,
!                        const char *int_name)
  {
    struct ipcmsg packet;
***************
*** 288,292 ****
    packet.msgtype = ROUTE_IPC;
  
!   COPY_IP(&packet.target_addr, dst);
  
    packet.add = add;
--- 292,297 ----
    packet.msgtype = ROUTE_IPC;
  
!   //COPY_IP(&packet.target_addr, dst);
!   packet.target_addr = *dst;
  
    packet.add = add;
***************
*** 294,298 ****
      {
        packet.metric = met;
!       COPY_IP(&packet.gateway_addr, gw);
      }
  
--- 299,304 ----
      {
        packet.metric = met;
!       //COPY_IP(&packet.gateway_addr, gw);
!       packet.gateway_addr = *gw;
      }
  
***************
*** 352,361 ****
      packet.msgtype = ROUTE_IPC;
  	  
!     COPY_IP(&packet.target_addr, &rt->rt_dst.prefix);
! 	  
      packet.add = 1;
      packet.metric = (olsr_u8_t)(rt->rt_best->rtp_metric.hops);
  
!     COPY_IP(&packet.gateway_addr, &rt->rt_nexthop.gateway);
  
      memcpy(&packet.device[0], if_ifwithindex_name(rt->rt_nexthop.iif_index), 4);
--- 358,369 ----
      packet.msgtype = ROUTE_IPC;
  	  
!     //COPY_IP(&packet.target_addr, &rt->rt_dst.prefix);
!     packet.target_addr = rt->rt_dst.prefix;
! 
      packet.add = 1;
      packet.metric = (olsr_u8_t)(rt->rt_best->rtp_metric.hops);
  
!     //COPY_IP(&packet.gateway_addr, &rt->rt_nexthop.gateway);
!     packet.gateway_addr = rt->rt_nexthop.gateway;
  
      memcpy(&packet.device[0], if_ifwithindex_name(rt->rt_nexthop.iif_index), 4);
***************
*** 423,428 ****
   
    /* Main addr */
!   COPY_IP(&net_msg->main_addr, &olsr_cnf->main_addr);
! 
  
    /*
--- 431,436 ----
   
    /* Main addr */
!   //COPY_IP(&net_msg->main_addr, &olsr_cnf->main_addr);
!   net_msg->main_addr = olsr_cnf->main_addr;
  
    /*

Index: main.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -C2 -d -r1.101 -r1.102
*** main.c	3 Nov 2007 23:21:27 -0000	1.101
--- main.c	8 Nov 2007 22:47:41 -0000	1.102
***************
*** 55,58 ****
--- 55,59 ----
  #include "net_os.h"
  #include "build_msg.h"
+ #include "net_olsr.h"
  
  #if LINUX_POLICY_ROUTING
***************
*** 110,114 ****
    char conf_file_name[FILENAME_MAX];
    struct tms tms_buf;
! 
  #ifdef WIN32
    WSADATA WsaData;
--- 111,117 ----
    char conf_file_name[FILENAME_MAX];
    struct tms tms_buf;
! #ifndef NODEBUG
!   struct ipaddr_str buf;
! #endif
  #ifdef WIN32
    WSADATA WsaData;
***************
*** 149,157 ****
  
    /* Get initial timestep */
!   nowtm = NULL;
!   while (nowtm == NULL)
!     {
!       nowtm = localtime((time_t *)&now.tv_sec);
!     }
      
    printf("\n *** %s ***\n Build date: %s on %s\n http://www.olsr.org\n\n", 
--- 152,158 ----
  
    /* Get initial timestep */
!   do {
!     nowtm = localtime(&now.tv_sec);
!   } while (nowtm == NULL);
      
    printf("\n *** %s ***\n Build date: %s on %s\n http://www.olsr.org\n\n", 
***************
*** 398,402 ****
    olsr_load_plugins();
  
!   OLSR_PRINTF(1, "Main address: %s\n\n", olsr_ip_to_string(&olsr_cnf->main_addr));
  
    /* Start syslog entry */
--- 399,403 ----
    olsr_load_plugins();
  
!   OLSR_PRINTF(1, "Main address: %s\n\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr));
  
    /* Start syslog entry */
***************
*** 414,419 ****
  #else
    signal(SIGHUP, olsr_reconfigure);  
!   signal(SIGINT, olsr_shutdown);  
!   signal(SIGTERM, olsr_shutdown);  
    signal(SIGPIPE, SIG_IGN);
  #endif
--- 415,424 ----
  #else
    signal(SIGHUP, olsr_reconfigure);  
!   signal(SIGINT,  olsr_shutdown);
!   signal(SIGQUIT, olsr_shutdown);
!   signal(SIGILL,  olsr_shutdown);
!   signal(SIGABRT, olsr_shutdown);
!   signal(SIGSEGV, olsr_shutdown);
!   signal(SIGTERM, olsr_shutdown);
    signal(SIGPIPE, SIG_IGN);
  #endif
***************
*** 467,471 ****
  #else
  static void
! olsr_shutdown(int signal)
  #endif
  {
--- 472,476 ----
  #else
  static void
! olsr_shutdown(int signal __attribute__((unused)))
  #endif
  {

Index: olsr.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** olsr.c	16 Oct 2007 10:01:29 -0000	1.60
--- olsr.c	8 Nov 2007 22:47:41 -0000	1.61
***************
*** 62,65 ****
--- 62,66 ----
  #include "lq_packet.h"
  #include "lq_avl.h"
+ #include "net_olsr.h"
  
  #include <stdarg.h>
***************
*** 333,337 ****
      {
  #ifdef DEBUG
!       OLSR_PRINTF(5, "Forward - sender %s not MPR selector\n", olsr_ip_to_string(src));
  #endif
        return 0;
--- 334,341 ----
      {
  #ifdef DEBUG
! #ifndef NODEBUG
!       struct ipaddr_str buf;
! #endif
!       OLSR_PRINTF(5, "Forward - sender %s not MPR selector\n", olsr_ip_to_string(&buf, src));
  #endif
        return 0;

Index: routing_table.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** routing_table.h	16 Oct 2007 09:54:43 -0000	1.23
--- routing_table.h	8 Nov 2007 22:47:41 -0000	1.24
***************
*** 150,155 ****
  unsigned int olsr_bump_routingtree_version(void);
  
! int avl_comp_ipv4_prefix (void *, void *);
! int avl_comp_ipv6_prefix (void *, void *);
  
  void olsr_rt_best(struct rt_entry *);
--- 150,155 ----
  unsigned int olsr_bump_routingtree_version(void);
  
! int avl_comp_ipv4_prefix (const void *, const void *);
! int avl_comp_ipv6_prefix (const void *, const void *);
  
  void olsr_rt_best(struct rt_entry *);

Index: interfaces.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** interfaces.c	13 Oct 2007 12:09:11 -0000	1.35
--- interfaces.c	8 Nov 2007 22:47:41 -0000	1.36
***************
*** 45,48 ****
--- 45,49 ----
  #include "scheduler.h"
  #include "olsr.h"
+ #include "net_olsr.h"
  
  static olsr_u32_t if_property_id;
***************
*** 227,231 ****
  
  struct interface *
! if_ifwithaddr(const union olsr_ip_addr * const addr)
  {
    struct interface *ifp;
--- 228,232 ----
  
  struct interface *
! if_ifwithaddr(const union olsr_ip_addr *addr)
  {
    struct interface *ifp;
***************
*** 242,246 ****
  	  //printf("%s\n", olsr_ip_to_string(addr));
  
! 	  if (COMP_IP(&((struct sockaddr_in *)&ifp->int_addr)->sin_addr, addr))
  	      return ifp;
  	}
--- 243,247 ----
  	  //printf("%s\n", olsr_ip_to_string(addr));
  
! 	  if (((struct sockaddr_in *)&ifp->int_addr)->sin_addr.s_addr == addr->v4.s_addr)
  	      return ifp;
  	}
***************
*** 250,254 ****
  	  //printf("Checking %s ", olsr_ip_to_string((union olsr_ip_addr *)&ifp->int6_addr.sin6_addr));
  	  //printf("== %s\n", olsr_ip_to_string((union olsr_ip_addr *)&((struct sockaddr_in6 *)addr)->sin6_addr));
! 	  if (COMP_IP(&ifp->int6_addr.sin6_addr, addr))
  	    return ifp;
  	}
--- 251,255 ----
  	  //printf("Checking %s ", olsr_ip_to_string((union olsr_ip_addr *)&ifp->int6_addr.sin6_addr));
  	  //printf("== %s\n", olsr_ip_to_string((union olsr_ip_addr *)&((struct sockaddr_in6 *)addr)->sin6_addr));
!           if (ip6equal(&ifp->int6_addr.sin6_addr, &addr->v6))
  	    return ifp;
  	}

Index: tc_set.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** tc_set.h	4 Nov 2007 17:52:13 -0000	1.21
--- tc_set.h	8 Nov 2007 22:47:41 -0000	1.22
***************
*** 46,49 ****
--- 46,51 ----
  #include "defs.h"
  #include "packet.h"
+ #include "lq_avl.h"
+ #include "lq_list.h"
  
  /*
***************
*** 116,120 ****
  extern struct tc_entry *tc_myself;
  
! int olsr_init_tc(void);
  void olsr_change_myself_tc(void);
  int olsr_tc_delete_mprs(struct tc_entry *, struct tc_message *);
--- 118,122 ----
  extern struct tc_entry *tc_myself;
  
! void olsr_init_tc(void);
  void olsr_change_myself_tc(void);
  int olsr_tc_delete_mprs(struct tc_entry *, struct tc_message *);

Index: mpr.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/mpr.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** mpr.c	21 Oct 2007 20:53:13 -0000	1.19
--- mpr.c	8 Nov 2007 22:47:41 -0000	1.20
***************
*** 46,49 ****
--- 46,50 ----
  #include "neighbor_table.h"
  #include "scheduler.h"
+ #include "net_olsr.h"
  
  /* Begin:
***************
*** 122,126 ****
  	    {
  	      
! 	      //OLSR_PRINTF(1, "(1)Skipping 2h neighbor %s - already 1hop\n", olsr_ip_to_string(&two_hop_neighbor->neighbor_2_addr));
  
  	      continue;
--- 123,127 ----
  	    {
  	      
! 	      //OLSR_PRINTF(1, "(1)Skipping 2h neighbor %s - already 1hop\n", olsr_ip_to_string(&buf, &two_hop_neighbor->neighbor_2_addr));
  
  	      continue;
***************
*** 134,138 ****
  		  two_hop_list_tmp = olsr_malloc(sizeof(struct neighbor_2_list_entry), "MPR two hop list");
  
! 		  //OLSR_PRINTF(1, "ONE LINK ADDING %s\n", olsr_ip_to_string(&two_hop_neighbor->neighbor_2_addr));
  
  		  /* Only queue one way here */		  
--- 135,139 ----
  		  two_hop_list_tmp = olsr_malloc(sizeof(struct neighbor_2_list_entry), "MPR two hop list");
  
! 		  //OLSR_PRINTF(1, "ONE LINK ADDING %s\n", olsr_ip_to_string(&buf, &two_hop_neighbor->neighbor_2_addr));
  
  		  /* Only queue one way here */		  
***************
*** 168,175 ****
    struct neighbor_entry        *dup_neighbor;
    olsr_u16_t                   count;
!   
    count = *two_hop_covered_count;
  
!   OLSR_PRINTF(1, "Setting %s as MPR\n", olsr_ip_to_string(&one_hop_neighbor->neighbor_main_addr));
  
    //printf("PRE COUNT: %d\n\n", count);
--- 169,178 ----
    struct neighbor_entry        *dup_neighbor;
    olsr_u16_t                   count;
! #ifndef NODEBUG
!   struct ipaddr_str            buf;
! #endif  
    count = *two_hop_covered_count;
  
!   OLSR_PRINTF(1, "Setting %s as MPR\n", olsr_ip_to_string(&buf, &one_hop_neighbor->neighbor_main_addr));
  
    //printf("PRE COUNT: %d\n\n", count);
***************
*** 185,189 ****
        if((dup_neighbor != NULL) && (dup_neighbor->status == SYM))
  	{
! 	  //OLSR_PRINTF(7, "(2)Skipping 2h neighbor %s - already 1hop\n", olsr_ip_to_string(&second_hop_entries->neighbor_2->neighbor_2_addr));
  	  continue;
  	}
--- 188,192 ----
        if((dup_neighbor != NULL) && (dup_neighbor->status == SYM))
  	{
! 	  //OLSR_PRINTF(7, "(2)Skipping 2h neighbor %s - already 1hop\n", olsr_ip_to_string(&buf, &second_hop_entries->neighbor_2->neighbor_2_addr));
  	  continue;
  	}
***************
*** 198,202 ****
  	  the_one_hop_list = second_hop_entries->neighbor_2->neighbor_2_nblist.next;
  
! 	  //OLSR_PRINTF(1, "[%s](%x) has coverage %d\n", olsr_ip_to_string(&second_hop_entries->neighbor_2->neighbor_2_addr), second_hop_entries->neighbor_2, second_hop_entries->neighbor_2->mpr_covered_count);
  
  	  if(second_hop_entries->neighbor_2->mpr_covered_count >= olsr_cnf->mpr_coverage)
--- 201,205 ----
  	  the_one_hop_list = second_hop_entries->neighbor_2->neighbor_2_nblist.next;
  
! 	  //OLSR_PRINTF(1, "[%s](%x) has coverage %d\n", olsr_ip_to_string(&buf, &second_hop_entries->neighbor_2->neighbor_2_addr), second_hop_entries->neighbor_2, second_hop_entries->neighbor_2->mpr_covered_count);
  
  	  if(second_hop_entries->neighbor_2->mpr_covered_count >= olsr_cnf->mpr_coverage)
***************
*** 253,257 ****
  	  /*	  
  	  printf("[%s] nocov: %d mpr: %d will: %d max: %d\n\n", 
! 		 olsr_ip_to_string(&a_neighbor->neighbor_main_addr), 
  		 a_neighbor->neighbor_2_nocov,
  		 a_neighbor->is_mpr,
--- 256,260 ----
  	  /*	  
  	  printf("[%s] nocov: %d mpr: %d will: %d max: %d\n\n", 
! 		 olsr_ip_to_string(&buf, &a_neighbor->neighbor_main_addr), 
  		 a_neighbor->neighbor_2_nocov,
  		 a_neighbor->is_mpr,
***************
*** 395,399 ****
  	      twohop_neighbors = twohop_neighbors->next)
  	    {
! 	      //printf("\tChecking %s....", olsr_ip_to_string(&twohop_neighbors->neighbor_2->neighbor_2_addr));
                struct neighbor_entry *dup_neighbor = olsr_lookup_neighbor_table(&twohop_neighbors->neighbor_2->neighbor_2_addr);
  	      
--- 398,402 ----
  	      twohop_neighbors = twohop_neighbors->next)
  	    {
! 	      //printf("\tChecking %s....", olsr_ip_to_string(&buf, &twohop_neighbors->neighbor_2->neighbor_2_addr));
                struct neighbor_entry *dup_neighbor = olsr_lookup_neighbor_table(&twohop_neighbors->neighbor_2->neighbor_2_addr);
  	      
***************
*** 429,449 ****
  {
    olsr_u16_t                   count = 0;
!   olsr_u8_t                    index;
  
    //printf("\nAdding WILL ALWAYS nodes....\n");
  
!   for(index=0;index<HASHSIZE;index++)
      {
        struct neighbor_entry        *a_neighbor;
!       for(a_neighbor = neighbortable[index].next;
! 	  a_neighbor != &neighbortable[index];
  	  a_neighbor = a_neighbor->next)
  	{ 
! 	  if((a_neighbor->status == NOT_SYM) || (a_neighbor->willingness != WILL_ALWAYS))
  	    continue;
! 
  	  olsr_chosen_mpr(a_neighbor, &count); 
  
! 	  OLSR_PRINTF(3, "Adding WILL_ALWAYS: %s\n", olsr_ip_to_string(&a_neighbor->neighbor_main_addr));
  
  	}
--- 432,455 ----
  {
    olsr_u16_t                   count = 0;
!   olsr_u8_t                    idx;
  
    //printf("\nAdding WILL ALWAYS nodes....\n");
  
!   for(idx=0;idx<HASHSIZE;idx++)
      {
        struct neighbor_entry        *a_neighbor;
!       for(a_neighbor = neighbortable[idx].next;
! 	  a_neighbor != &neighbortable[idx];
  	  a_neighbor = a_neighbor->next)
  	{ 
! #ifndef NODEBUG
!           struct ipaddr_str buf;
! #endif
! 	  if((a_neighbor->status == NOT_SYM) || (a_neighbor->willingness != WILL_ALWAYS)) {
  	    continue;
!           }
  	  olsr_chosen_mpr(a_neighbor, &count); 
  
! 	  OLSR_PRINTF(3, "Adding WILL_ALWAYS: %s\n", olsr_ip_to_string(&buf, &a_neighbor->neighbor_main_addr));
  
  	}
***************
*** 461,466 ****
  olsr_calculate_mpr(void)     
  {  
!   olsr_u16_t                   two_hop_covered_count;
!   olsr_u16_t                   two_hop_count;
    int i;
  
--- 467,472 ----
  olsr_calculate_mpr(void)     
  {  
!   olsr_u16_t two_hop_covered_count;
!   olsr_u16_t two_hop_count;
    int i;
  
***************
*** 548,557 ****
    for(i = WILL_NEVER + 1; i < WILL_ALWAYS; i++)
      {
!       int index;
!       for(index=0;index<HASHSIZE;index++)
  	{
            struct neighbor_entry *a_neighbor;
! 	  for(a_neighbor = neighbortable[index].next;
! 	      a_neighbor != &neighbortable[index];
  	      a_neighbor = a_neighbor->next)
  	    {
--- 554,563 ----
    for(i = WILL_NEVER + 1; i < WILL_ALWAYS; i++)
      {
!       int idx;
!       for(idx=0;idx<HASHSIZE;idx++)
  	{
            struct neighbor_entry *a_neighbor;
! 	  for(a_neighbor = neighbortable[idx].next;
! 	      a_neighbor != &neighbortable[idx];
  	      a_neighbor = a_neighbor->next)
  	    {
***************
*** 563,567 ****
  		{
                    struct neighbor_2_list_entry *two_hop_list;
! 		  //printf("\tChecking %s\n", olsr_ip_to_string(&a_neighbor->neighbor_main_addr));
  		  remove = 1;
  
--- 569,573 ----
  		{
                    struct neighbor_2_list_entry *two_hop_list;
! 		  //printf("\tChecking %s\n", olsr_ip_to_string(&buf, &a_neighbor->neighbor_main_addr));
  		  remove = 1;
  
***************
*** 576,580 ****
  			continue;
  		      
! 		      //printf("\t[%s] coverage %d\n", olsr_ip_to_string(&two_hop_list->neighbor_2->neighbor_2_addr), two_hop_list->neighbor_2->mpr_covered_count);
  		      /* Do not remove if we find a entry which need this MPR */
  		      if(two_hop_list->neighbor_2->mpr_covered_count <= olsr_cnf->mpr_coverage)
--- 582,586 ----
  			continue;
  		      
! 		      //printf("\t[%s] coverage %d\n", olsr_ip_to_string(&buf, &two_hop_list->neighbor_2->neighbor_2_addr), two_hop_list->neighbor_2->mpr_covered_count);
  		      /* Do not remove if we find a entry which need this MPR */
  		      if(two_hop_list->neighbor_2->mpr_covered_count <= olsr_cnf->mpr_coverage)
***************
*** 584,588 ****
  		  if(remove)
  		    {
! 		      OLSR_PRINTF(3, "MPR OPTIMIZE: removiong mpr %s\n\n", olsr_ip_to_string(&a_neighbor->neighbor_main_addr));
  		      a_neighbor->is_mpr = OLSR_FALSE;
  		    }
--- 590,597 ----
  		  if(remove)
  		    {
! #ifndef NODEBUG
!                       struct ipaddr_str buf;
! #endif
! 		      OLSR_PRINTF(3, "MPR OPTIMIZE: removiong mpr %s\n\n", olsr_ip_to_string(&buf, &a_neighbor->neighbor_main_addr));
  		      a_neighbor->is_mpr = OLSR_FALSE;
  		    }
***************
*** 598,619 ****
  #ifndef NODEBUG
    /* The whole function makes no sense without it. */
!   int index;
  
    OLSR_PRINTF(1, "MPR SET: ");
  
!   for(index=0;index<HASHSIZE;index++)
!     {
!       struct neighbor_entry *a_neighbor;
!       for(a_neighbor = neighbortable[index].next;
! 	  a_neighbor != &neighbortable[index];
! 	  a_neighbor = a_neighbor->next)
! 	{ 
! 	  /* 
! 	   * Remove MPR settings
! 	   */
! 	  if(a_neighbor->is_mpr)
! 	    OLSR_PRINTF(1, "[%s] ", olsr_ip_to_string(&a_neighbor->neighbor_main_addr));
! 	}
      }
    OLSR_PRINTF(1, "\n");
  #endif
--- 607,626 ----
  #ifndef NODEBUG
    /* The whole function makes no sense without it. */
!   int idx;
  
    OLSR_PRINTF(1, "MPR SET: ");
  
!   for(idx = 0; idx < HASHSIZE; idx++) {
!     struct neighbor_entry *a_neighbor;
!     for(a_neighbor = neighbortable[idx].next; a_neighbor != &neighbortable[idx]; a_neighbor = a_neighbor->next) { 
!       /* 
!        * Remove MPR settings
!        */
!       if(a_neighbor->is_mpr) {
!         struct ipaddr_str buf;
!         OLSR_PRINTF(1, "[%s] ", olsr_ip_to_string(&buf, &a_neighbor->neighbor_main_addr));
!       }
      }
+   }
    OLSR_PRINTF(1, "\n");
  #endif

Index: tc_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** tc_set.c	4 Nov 2007 17:52:13 -0000	1.35
--- tc_set.c	8 Nov 2007 22:47:41 -0000	1.36
***************
*** 46,50 ****
  #include "lq_route.h"
  #include "lq_avl.h"
! #include "assert.h"
  
  /* Root of the link state database */
--- 46,52 ----
  #include "lq_route.h"
  #include "lq_avl.h"
! #include "net_olsr.h"
! 
! #include <assert.h>
  
  /* Root of the link state database */
***************
*** 56,60 ****
   *
   */
! int
  olsr_init_tc(void)
  {
--- 58,62 ----
   *
   */
! void
  olsr_init_tc(void)
  {
***************
*** 69,73 ****
     */
    tc_myself = olsr_add_tc_entry(&olsr_cnf->main_addr);
-   return 1;
  }
  
--- 71,74 ----
***************
*** 82,90 ****
  
    if (tc_myself) {
- 
      /*
       * Check if there was a change.
       */
!     if (COMP_IP(&tc_myself->addr, &olsr_cnf->main_addr)) {
        return;
      }
--- 83,90 ----
  
    if (tc_myself) {
      /*
       * Check if there was a change.
       */
!     if (ipequal(&tc_myself->addr, &olsr_cnf->main_addr)) {
        return;
      }
***************
*** 115,121 ****
  olsr_delete_tc_entry(struct tc_entry *tc)
  {
- 
  #if 0
!   OLSR_PRINTF(1, "TC: del entry %s\n", olsr_ip_to_string(&tc->addr));
  #endif
  
--- 115,121 ----
  olsr_delete_tc_entry(struct tc_entry *tc)
  {
  #if 0
!   struct ipaddr_str buf;
!   OLSR_PRINTF(1, "TC: del entry %s\n", olsr_ip_to_string(%buf, &tc->addr));
  #endif
  
***************
*** 160,166 ****
  olsr_getnext_tc_entry(struct tc_entry *tc)
  {
!   struct avl_node *node;
! 
!   node = avl_walk_next(&tc->vertex_node);
  
    if (node) {
--- 160,164 ----
  olsr_getnext_tc_entry(struct tc_entry *tc)
  {
!   struct avl_node *node = avl_walk_next(&tc->vertex_node);
  
    if (node) {
***************
*** 181,187 ****
  {
    struct tc_entry *tc;
- 
  #if 0
!   OLSR_PRINTF(1, "TC: add entry %s\n", olsr_ip_to_string(adr));
  #endif
  
--- 179,185 ----
  {
    struct tc_entry *tc;
  #if 0
!   struct ipaddr_str buf;
!   OLSR_PRINTF(1, "TC: add entry %s\n", olsr_ip_to_string(&buf, adr));
  #endif
  
***************
*** 193,197 ****
  
    /* Fill entry */
!   COPY_IP(&tc->addr, adr);
    tc->vertex_node.data = tc;
    tc->vertex_node.key = &tc->addr;
--- 191,196 ----
  
    /* Fill entry */
!   //COPY_IP(&tc->addr, adr);
!   tc->addr = *adr;
    tc->vertex_node.data = tc;
    tc->vertex_node.key = &tc->addr;
***************
*** 216,233 ****
  olsr_tc_edge_to_string(struct tc_edge_entry *tc_edge)
  {
!   struct tc_entry *tc;
!   static char buff[128];
! 
!   tc = tc_edge->tc;
  
!   snprintf(buff, sizeof(buff),
             "%s > %s, lq %.3f, inv-lq %.3f, etx %.3f",
!            olsr_ip_to_string(&tc->addr),
!            olsr_ip_to_string(&tc_edge->T_dest_addr),
             tc_edge->link_quality,
             tc_edge->inverse_link_quality,
             tc_edge->etx);
  
!   return buff;
  }
  
--- 215,231 ----
  olsr_tc_edge_to_string(struct tc_edge_entry *tc_edge)
  {
!   static char buf[128];
!   struct ipaddr_str addrbuf, dstbuf;
!   struct tc_entry *tc = tc_edge->tc;
  
!   snprintf(buf, sizeof(buf),
             "%s > %s, lq %.3f, inv-lq %.3f, etx %.3f",
!            olsr_ip_to_string(&addrbuf, &tc->addr),
!            olsr_ip_to_string(&dstbuf, &tc_edge->T_dest_addr),
             tc_edge->link_quality,
             tc_edge->inverse_link_quality,
             tc_edge->etx);
  
!   return buf;
  }
  
***************
*** 282,286 ****
  
    /* Fill entry */
!   COPY_IP(&tc_edge->T_dest_addr, addr);
    olsr_set_tc_edge_timer(tc_edge, vtime*1000);
    tc_edge->T_seq = ansn;
--- 280,285 ----
  
    /* Fill entry */
!   //COPY_IP(&tc_edge->T_dest_addr, addr);
!   tc_edge->T_dest_addr = *addr;
    olsr_set_tc_edge_timer(tc_edge, vtime*1000);
    tc_edge->T_seq = ansn;
***************
*** 289,296 ****
  
    if (olsr_cnf->lq_level > 0) {
- 
      tc_edge->link_quality = neigh_link_quality;
      tc_edge->inverse_link_quality = link_quality;
- 
    } else {
  
--- 288,293 ----
***************
*** 323,327 ****
    tc_neighbor = olsr_lookup_tc_entry(&tc_edge->T_dest_addr);
    if (tc_neighbor) {
- 
  #if 0
      OLSR_PRINTF(1, "TC:   found neighbor tc_entry %s\n",
--- 320,323 ----
***************
*** 331,335 ****
      tc_edge_inv = olsr_lookup_tc_edge(tc_neighbor, &tc->addr);
      if (tc_edge_inv) {
- 
  #if 0
        OLSR_PRINTF(1, "TC:   found inverse edge for %s\n",
--- 327,330 ----
***************
*** 411,415 ****
  {
    struct tc_edge_entry *tc_edge;
!   int retval;
  
  #if 0
--- 406,410 ----
  {
    struct tc_edge_entry *tc_edge;
!   int retval = 0;
  
  #if 0
***************
*** 417,426 ****
  #endif
  
-   retval = 0;
- 
    OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) {
- 
      if (SEQNO_GREATER_THAN(msg->ansn, tc_edge->T_seq)) {
- 
        /*
         * Do not delete the edge now, just mark the edge as down.
--- 412,417 ----
***************
*** 591,608 ****
  {
    struct tc_entry *tc;
-   struct tc_edge_entry *tc_edge;
  
!   OLSR_FOR_ALL_TC_ENTRIES(tc)
      OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) {
! 
!     /*
!      * Delete outdated edges.
!      */
!     if(TIMED_OUT(tc_edge->T_time)) {
!       olsr_delete_tc_edge_entry(tc_edge);
!       changes_topology = OLSR_TRUE;
!     }
!   } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge);
!   OLSR_FOR_ALL_TC_ENTRIES_END(tc)
  }
  
--- 582,598 ----
  {
    struct tc_entry *tc;
  
!   OLSR_FOR_ALL_TC_ENTRIES(tc) {
!     struct tc_edge_entry *tc_edge;
      OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) {
!       /*
!        * Delete outdated edges.
!        */
!       if(TIMED_OUT(tc_edge->T_time)) {
!         olsr_delete_tc_edge_entry(tc_edge);
!         changes_topology = OLSR_TRUE;
!       }
!     } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge);
!   } OLSR_FOR_ALL_TC_ENTRIES_END(tc)
  }
  
***************
*** 627,633 ****
      struct tc_edge_entry *tc_edge;
      OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) {
        OLSR_PRINTF(1, "%-*s %-*s  %5.3f  %5.3f  %.2f\n",
!                   ipwidth, olsr_ip_to_string(&tc->addr),
!                   ipwidth, olsr_ip_to_string(&tc_edge->T_dest_addr),
                    tc_edge->link_quality,
                    tc_edge->inverse_link_quality,
--- 617,624 ----
      struct tc_edge_entry *tc_edge;
      OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) {
+       struct ipaddr_str addrbuf, dstaddrbuf;
        OLSR_PRINTF(1, "%-*s %-*s  %5.3f  %5.3f  %.2f\n",
!                   ipwidth, olsr_ip_to_string(&addrbuf, &tc->addr),
!                   ipwidth, olsr_ip_to_string(&dstaddrbuf, &tc_edge->T_dest_addr),
                    tc_edge->link_quality,
                    tc_edge->inverse_link_quality,

Index: mpr_selector_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/mpr_selector_set.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** mpr_selector_set.c	21 Oct 2007 20:55:11 -0000	1.19
--- mpr_selector_set.c	8 Nov 2007 22:47:41 -0000	1.20
***************
*** 45,48 ****
--- 45,49 ----
  #include "olsr.h"
  #include "scheduler.h"
+ #include "net_olsr.h"
  
  static olsr_u16_t ansn;
***************
*** 102,113 ****
  olsr_add_mpr_selector(const union olsr_ip_addr *addr, float vtime)
  {
    struct mpr_selector *new_entry;
  
!   OLSR_PRINTF(1, "MPRS: adding %s\n", olsr_ip_to_string(addr));
  
    new_entry = olsr_malloc(sizeof(struct mpr_selector), "Add MPR selector");
  
    /* Fill struct */
!   COPY_IP(&new_entry->MS_main_addr, addr);
    new_entry->MS_time = GET_TIMESTAMP(vtime*1000);
  
--- 103,118 ----
  olsr_add_mpr_selector(const union olsr_ip_addr *addr, float vtime)
  {
+ #ifndef NODEBUG
+   struct ipaddr_str buf;
+ #endif
    struct mpr_selector *new_entry;
  
!   OLSR_PRINTF(1, "MPRS: adding %s\n", olsr_ip_to_string(&buf, addr));
  
    new_entry = olsr_malloc(sizeof(struct mpr_selector), "Add MPR selector");
  
    /* Fill struct */
!   //COPY_IP(&new_entry->MS_main_addr, addr);
!   new_entry->MS_main_addr = *addr;
    new_entry->MS_time = GET_TIMESTAMP(vtime*1000);
  
***************
*** 143,147 ****
  
    for (mprs = mprs_list.next; mprs != &mprs_list; mprs = mprs->next) {
!     if(COMP_IP(&mprs->MS_main_addr, addr)) {
        //OLSR_PRINTF(1, "MATCH\n");
        return mprs;
--- 148,152 ----
  
    for (mprs = mprs_list.next; mprs != &mprs_list; mprs = mprs->next) {
!     if(ipequal(&mprs->MS_main_addr, addr)) {
        //OLSR_PRINTF(1, "MATCH\n");
        return mprs;
***************
*** 165,171 ****
  olsr_update_mprs_set(const union olsr_ip_addr *addr, float vtime)
  {
    struct mpr_selector *mprs = olsr_lookup_mprs_set(addr);
  
!   OLSR_PRINTF(5, "MPRS: Update %s\n", olsr_ip_to_string(addr));
  
    if(mprs == NULL) {
--- 170,179 ----
  olsr_update_mprs_set(const union olsr_ip_addr *addr, float vtime)
  {
+ #ifndef NODEBUG
+   struct ipaddr_str buf;
+ #endif
    struct mpr_selector *mprs = olsr_lookup_mprs_set(addr);
  
!   OLSR_PRINTF(5, "MPRS: Update %s\n", olsr_ip_to_string(&buf, addr));
  
    if(mprs == NULL) {
***************
*** 193,199 ****
  	  /* Dequeue */
  	  struct mpr_selector *mprs_to_delete = mprs;
  	  mprs = mprs->next;
  
! 	  OLSR_PRINTF(1, "MPRS: Timing out %s\n", olsr_ip_to_string(&mprs_to_delete->MS_main_addr));
  
  	  DEQUEUE_ELEM(mprs_to_delete);
--- 201,210 ----
  	  /* Dequeue */
  	  struct mpr_selector *mprs_to_delete = mprs;
+ #ifndef NODEBUG
+           struct ipaddr_str buf;
+ #endif
  	  mprs = mprs->next;
  
! 	  OLSR_PRINTF(1, "MPRS: Timing out %s\n", olsr_ip_to_string(&buf, &mprs_to_delete->MS_main_addr));
  
  	  DEQUEUE_ELEM(mprs_to_delete);
***************
*** 216,221 ****
    struct mpr_selector *mprs;
    OLSR_PRINTF(1, "MPR SELECTORS: ");
!   for (mprs = mprs_list.next; mprs != &mprs_list; mprs = mprs->next) {
!     OLSR_PRINTF(1, "%s ", olsr_ip_to_string(&mprs->MS_main_addr));
    }
    OLSR_PRINTF(1, "\n");
--- 227,235 ----
    struct mpr_selector *mprs;
    OLSR_PRINTF(1, "MPR SELECTORS: ");
!   for(mprs = mprs_list.next; mprs != &mprs_list; mprs = mprs->next) {
! #ifndef NODEBUG
!     struct ipaddr_str buf;
! #endif
!     OLSR_PRINTF(1, "%s ", olsr_ip_to_string(&buf, &mprs->MS_main_addr));
    }
    OLSR_PRINTF(1, "\n");

Index: parser.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/parser.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** parser.c	8 May 2007 23:34:52 -0000	1.35
--- parser.c	8 Nov 2007 22:47:41 -0000	1.36
***************
*** 52,55 ****
--- 52,56 ----
  #include "log.h"
  #include "print_packet.h"
+ #include "net_olsr.h"
  
  #ifdef WIN32
***************
*** 98,102 ****
  
  void
! olsr_parser_add_function(void (*function)(union olsr_message *, struct interface *, union olsr_ip_addr *), olsr_u32_t type, int forwarding)
  {
    struct parse_function_entry *new_entry;
--- 99,103 ----
  
  void
! olsr_parser_add_function(parse_function *function, olsr_u32_t type, int forwarding)
  {
    struct parse_function_entry *new_entry;
***************
*** 122,126 ****
  
  int
! olsr_parser_remove_function(void (*function)(union olsr_message *, struct interface *, union olsr_ip_addr *), olsr_u32_t type, int forwarding)
  {
    struct parse_function_entry *entry, *prev;
--- 123,127 ----
  
  int
! olsr_parser_remove_function(parse_function *function, olsr_u32_t type, int forwarding)
  {
    struct parse_function_entry *entry, *prev;
***************
*** 182,193 ****
    if (ntohs(olsr->olsr_packlen) != size)
      {
        OLSR_PRINTF(1, "Size error detected in received packet.\nRecieved %d, in packet %d\n", size, ntohs(olsr->olsr_packlen));
  	    
        olsr_syslog(OLSR_LOG_ERR, " packet length error in  packet received from %s!",
! 	     olsr_ip_to_string(from_addr));
        return;
      }
  
!   //printf("Message from %s\n\n", olsr_ip_to_string(from_addr)); 
        
    /* Display packet */
--- 183,195 ----
    if (ntohs(olsr->olsr_packlen) != size)
      {
+       struct ipaddr_str buf;
        OLSR_PRINTF(1, "Size error detected in received packet.\nRecieved %d, in packet %d\n", size, ntohs(olsr->olsr_packlen));
  	    
        olsr_syslog(OLSR_LOG_ERR, " packet length error in  packet received from %s!",
! 	     olsr_ip_to_string(&buf, from_addr));
        return;
      }
  
!   //printf("Message from %s\n\n", olsr_ip_to_string(&buf, from_addr)); 
        
    /* Display packet */
***************
*** 245,253 ****
        if(count < 0)
  	{
  	  OLSR_PRINTF(1, "packet length error in  packet received from %s!",
! 		      olsr_ip_to_string(from_addr));
  
  	  olsr_syslog(OLSR_LOG_ERR, " packet length error in  packet received from %s!",
! 		 olsr_ip_to_string(from_addr));
  	  break;
  	}
--- 247,256 ----
        if(count < 0)
  	{
+           struct ipaddr_str buf;
  	  OLSR_PRINTF(1, "packet length error in  packet received from %s!",
! 		      olsr_ip_to_string(&buf, from_addr));
  
  	  olsr_syslog(OLSR_LOG_ERR, " packet length error in  packet received from %s!",
! 		 olsr_ip_to_string(&buf, from_addr));
  	  break;
  	}
***************
*** 260,266 ****
  	  if (m->v4.ttl <= 0 && olsr_cnf->lq_fish == 0)
  	    {
  	      OLSR_PRINTF(2, "Dropping packet type %d from neigh %s with TTL 0\n", 
  			  m->v4.olsr_msgtype,
! 			  olsr_ip_to_string(from_addr));
  	      continue;
  	    }
--- 263,272 ----
  	  if (m->v4.ttl <= 0 && olsr_cnf->lq_fish == 0)
  	    {
+ #ifndef NODEBUG
+               struct ipaddr_str buf;
+ #endif
  	      OLSR_PRINTF(2, "Dropping packet type %d from neigh %s with TTL 0\n", 
  			  m->v4.olsr_msgtype,
! 			  olsr_ip_to_string(&buf, from_addr));
  	      continue;
  	    }
***************
*** 271,277 ****
  	  if (m->v6.ttl <= 0 && olsr_cnf->lq_fish == 0) 
  	    {
  	      OLSR_PRINTF(2, "Dropping packet type %d from %s with TTL 0\n", 
  			  m->v4.olsr_msgtype,
! 			  olsr_ip_to_string(from_addr));
  	      continue;
  	    }
--- 277,286 ----
  	  if (m->v6.ttl <= 0 && olsr_cnf->lq_fish == 0) 
  	    {
+ #ifndef NODEBUG
+               struct ipaddr_str buf;
+ #endif
  	      OLSR_PRINTF(2, "Dropping packet type %d from %s with TTL 0\n", 
  			  m->v4.olsr_msgtype,
! 			  olsr_ip_to_string(&buf, from_addr));
  	      continue;
  	    }
***************
*** 287,291 ****
  
        /* Should be the same for IPv4 and IPv6 */
!       if(COMP_IP(&m->v4.originator, &olsr_cnf->main_addr))
  	{
  #ifdef DEBUG
--- 296,300 ----
  
        /* Should be the same for IPv4 and IPv6 */
!       if(m->v4.originator == olsr_cnf->main_addr.v4.s_addr)
  	{
  #ifdef DEBUG
***************
*** 319,322 ****
--- 328,334 ----
        if(processed == 0)
  	{
+ #ifndef NODEBUG
+           struct ipaddr_str buf;
+ #endif
  	  unk_chgestruct(&unkpacket, m);
  	  
***************
*** 324,331 ****
  		      m->v4.olsr_msgtype,
  		      size,
! 		      olsr_ip_to_string(&unkpacket.originator));
  
  	  /* Forward message */
! 	  if(!COMP_IP(&unkpacket.originator, &olsr_cnf->main_addr))
  	    {	      
  	      /* Forward */
--- 336,343 ----
  		      m->v4.olsr_msgtype,
  		      size,
! 		      olsr_ip_to_string(&buf, &unkpacket.originator));
  
  	  /* Forward message */
! 	  if(!ipequal(&unkpacket.originator, &olsr_cnf->main_addr))
  	    {	      
  	      /* Forward */
***************
*** 358,365 ****
  olsr_input(int fd)
  {
-   /* sockaddr_in6 is bigger than sockaddr !!!! */
-   struct sockaddr_storage from;
-   socklen_t fromlen;
-   int cc;
    struct interface *olsr_in_if;
    union olsr_ip_addr from_addr;
--- 370,373 ----
***************
*** 368,371 ****
--- 376,387 ----
    for (;;) 
      {
+ #if !defined(NODEBUG) && defined(DEBUG)
+       struct ipaddr_str buf;
+ #endif
+       /* sockaddr_in6 is bigger than sockaddr !!!! */
+       struct sockaddr_storage from;
+       socklen_t fromlen;
+       int cc;
+ 
        if (32 < ++cpu_overload_exit)
        {
***************
*** 375,379 ****
        
        fromlen = sizeof(struct sockaddr_storage);
- 
        cc = olsr_recvfrom(fd, 
  			 inbuf, 
--- 391,394 ----
***************
*** 392,410 ****
  	  break;
  	}
- 
        if(olsr_cnf->ip_version == AF_INET)
  	{
  	  /* IPv4 sender address */
! 	  COPY_IP(&from_addr, &((struct sockaddr_in *)&from)->sin_addr.s_addr);
  	}
        else
  	{
  	  /* IPv6 sender address */
! 	  COPY_IP(&from_addr, &((struct sockaddr_in6 *)&from)->sin6_addr);
  	}
        
        
  #ifdef DEBUG
!       OLSR_PRINTF(5, "Recieved a packet from %s\n", olsr_ip_to_string((union olsr_ip_addr *)&((struct sockaddr_in *)&from)->sin_addr.s_addr));
  #endif
  	
--- 407,426 ----
  	  break;
  	}
        if(olsr_cnf->ip_version == AF_INET)
  	{
  	  /* IPv4 sender address */
! 	  //COPY_IP(&from_addr, &((struct sockaddr_in *)&from)->sin_addr.s_addr);
! 	  from_addr.v4 = ((struct sockaddr_in *)&from)->sin_addr;
  	}
        else
  	{
  	  /* IPv6 sender address */
! 	  //COPY_IP(&from_addr, &((struct sockaddr_in6 *)&from)->sin6_addr);
! 	  from_addr.v6 = ((struct sockaddr_in6 *)&from)->sin6_addr;
  	}
        
        
  #ifdef DEBUG
!       OLSR_PRINTF(5, "Recieved a packet from %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&((struct sockaddr_in *)&from)->sin_addr.s_addr));
  #endif
  	
***************
*** 420,428 ****
        if((olsr_in_if = if_ifwithsock(fd)) == NULL)
  	{
  	  OLSR_PRINTF(1, "Could not find input interface for message from %s size %d\n",
! 		      olsr_ip_to_string(&from_addr),
  		      cc);
  	  olsr_syslog(OLSR_LOG_ERR, "Could not find input interface for message from %s size %d\n",
! 		 olsr_ip_to_string(&from_addr),
  		 cc);
  	  return ;
--- 436,445 ----
        if((olsr_in_if = if_ifwithsock(fd)) == NULL)
  	{
+           struct ipaddr_str buf;
  	  OLSR_PRINTF(1, "Could not find input interface for message from %s size %d\n",
! 		      olsr_ip_to_string(&buf, &from_addr),
  		      cc);
  	  olsr_syslog(OLSR_LOG_ERR, "Could not find input interface for message from %s size %d\n",
! 		 olsr_ip_to_string(&buf, &from_addr),
  		 cc);
  	  return ;
***************
*** 456,460 ****
    struct sockaddr_storage from;
    socklen_t fromlen;
-   int cc;
    struct interface *olsr_in_if;
    union olsr_ip_addr from_addr;
--- 473,476 ----
***************
*** 464,471 ****
       direct link */
  
!   if((cc = recv(fd, from_addr.v6.s6_addr, olsr_cnf->ipsize, 0)) != (int)olsr_cnf->ipsize)
      {
        fprintf(stderr, "Error receiving host-client IP hook(%d) %s!\n", cc, strerror(errno));
!       COPY_IP(&from_addr, &((struct olsr *)inbuf)->olsr_msg->originator);
      }
  
--- 480,489 ----
       direct link */
  
!   int cc = recv(fd, from_addr.v6.s6_addr, olsr_cnf->ipsize, 0);
!   if(cc != (int)olsr_cnf->ipsize)
      {
        fprintf(stderr, "Error receiving host-client IP hook(%d) %s!\n", cc, strerror(errno));
!       //COPY_IP(&from_addr, &((struct olsr *)inbuf)->olsr_msg->originator);
!       memcpy(&from_addr, &((struct olsr *)inbuf)->olsr_msg->originator, olsr_cnf->ipsize);
      }
  
***************
*** 518,526 ****
    if((olsr_in_if = if_ifwithsock(fd)) == NULL)
      {
        OLSR_PRINTF(1, "Could not find input interface for message from %s size %d\n",
! 		  olsr_ip_to_string(&from_addr),
  		  cc);
        olsr_syslog(OLSR_LOG_ERR, "Could not find input interface for message from %s size %d\n",
!                   olsr_ip_to_string(&from_addr),
                    cc);
        return;
--- 536,545 ----
    if((olsr_in_if = if_ifwithsock(fd)) == NULL)
      {
+       struct ipaddr_str buf;
        OLSR_PRINTF(1, "Could not find input interface for message from %s size %d\n",
! 		  olsr_ip_to_string(&buf, &from_addr),
  		  cc);
        olsr_syslog(OLSR_LOG_ERR, "Could not find input interface for message from %s size %d\n",
!                   olsr_ip_to_string(&buf, &from_addr),
                    cc);
        return;

Index: scheduler.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/scheduler.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** scheduler.c	17 Sep 2007 22:24:22 -0000	1.43
--- scheduler.c	8 Nov 2007 22:47:41 -0000	1.44
***************
*** 52,55 ****
--- 52,56 ----
  #include "olsr.h"
  #include "build_msg.h"
+ #include "net_olsr.h"
  
  /* Timer data, global. Externed in defs.h */
***************
*** 94,118 ****
  scheduler(void)
  {
-   struct timespec remainder_spec;
-   struct timespec sleeptime_spec;
- 
-   /*
-    *Used to calculate sleep time
-    */
-   clock_t end_of_loop;
-   struct timeval time_used;
    struct timeval interval;
-   struct timeval sleeptime_val;
- 
    olsr_u32_t interval_usec;
  
-   struct event_entry *entry;
-   struct timeout_entry *time_out_entry;
- 
-   struct interface *ifn;
- 
-   /* Global buffer for times(2) calls. Do not remove - at least OpenBSD needs it. */
-   struct tms tms_buf;
-  
    link_changes = OLSR_FALSE;
  
--- 95,101 ----
***************
*** 120,124 ****
      olsr_register_scheduler_event(trigger_dijkstra, NULL, olsr_cnf->lq_dinter, 0, NULL);
  
!   interval_usec = (olsr_u32_t)(olsr_cnf->pollrate * 1000000);
  
    interval.tv_sec = interval_usec / 1000000;
--- 103,107 ----
      olsr_register_scheduler_event(trigger_dijkstra, NULL, olsr_cnf->lq_dinter, 0, NULL);
  
!   interval_usec = olsr_cnf->pollrate * 1000000;
  
    interval.tv_sec = interval_usec / 1000000;
***************
*** 131,134 ****
--- 114,129 ----
    for(;;)
      {
+       /*
+        * Used to calculate sleep time
+        */
+       clock_t end_of_loop;
+       struct timeval time_used;
+       struct event_entry *entry;
+       struct timeout_entry *time_out_entry;
+       struct interface *ifn;
+ 
+       /* Global buffer for times(2) calls. Do not remove - at least OpenBSD needs it. */
+       struct tms tms_buf;
+  
        /* Update now_times */
        now_times = times(&tms_buf);
***************
*** 136,162 ****
        /* Update the global timestamp - kept for plugin compat */
        gettimeofday(&now, NULL);
!       nowtm = localtime((time_t *)&now.tv_sec);
! 
!       while (nowtm == NULL)
! 	{
! 	  nowtm = localtime((time_t *)&now.tv_sec);
! 	}
! 
! 
!       /* Run timout functions (before packet generation) */
  
!       time_out_entry = timeout_functions;
!       
!       while(time_out_entry)
! 	{
  	  time_out_entry->function();
! 	  time_out_entry = time_out_entry->next;
! 	}
  
!       /* Update */
!       
        olsr_process_changes();
  
- 
        /* Check for changes in topology */
        if(link_changes)
--- 131,146 ----
        /* Update the global timestamp - kept for plugin compat */
        gettimeofday(&now, NULL);
!       do {
!           nowtm = localtime(&now.tv_sec);
!       } while (nowtm == NULL);
  
!       /* Run timeout functions (before packet generation) */      
!       for (time_out_entry = timeout_functions; time_out_entry != NULL; time_out_entry = time_out_entry->next) {
  	  time_out_entry->function();
!       }
  
!       /* Update */      
        olsr_process_changes();
  
        /* Check for changes in topology */
        if(link_changes)
***************
*** 169,205 ****
  
        /* Check scheduled events */
!       entry = event_functions;
! 
        /* UPDATED - resets timer upon triggered execution */
!       while(entry)
  	{
  	  entry->since_last += olsr_cnf->pollrate;
  
  	  /* Timed out */
! 	  if((entry->since_last > entry->interval) ||
! 	     /* Triggered */
! 	     ((entry->trigger != NULL) &&
! 	      (*(entry->trigger) == 1)))
! 	    {
  	      /* Run scheduled function */
  	      entry->function(entry->param);
  
  	      /* Set jitter */
! 	      entry->since_last = (float) random()/RAND_MAX;
! 	      entry->since_last *= olsr_cnf->max_jitter;
  	      
  	      /* Reset trigger */
! 	      if(entry->trigger != NULL)
! 		*(entry->trigger) = 0;
! 	      
! 	      //OLSR_PRINTF(3, "Since_last jitter: %0.2f\n", entry->since_last);
  
  	    }
- 
- 	  entry = entry->next;
  	}
  
- 
- 
        /* looping trough interfaces and emmittin pending data */
        for (ifn = ifnet; ifn ; ifn = ifn->int_next) 
--- 153,182 ----
  
        /* Check scheduled events */
!       
        /* UPDATED - resets timer upon triggered execution */
!       for (entry = event_functions; entry != NULL; entry = entry->next)
  	{
  	  entry->since_last += olsr_cnf->pollrate;
  
  	  /* Timed out */
! 	  if ((entry->since_last > entry->interval) ||
!               /* Triggered */
!               ((entry->trigger != NULL) && (*entry->trigger == 1))
!               ) {
  	      /* Run scheduled function */
  	      entry->function(entry->param);
  
  	      /* Set jitter */
! 	      entry->since_last = (float)(random() / RAND_MAX) * olsr_cnf->max_jitter;
  	      
  	      /* Reset trigger */
! 	      if(entry->trigger != NULL) {
! 		*entry->trigger = 0;
!               }
  
+ 	      //OLSR_PRINTF(3, "Since_last jitter: %0.2f\n", entry->since_last);
  	    }
  	}
  
        /* looping trough interfaces and emmittin pending data */
        for (ifn = ifnet; ifn ; ifn = ifn->int_next) 
***************
*** 220,223 ****
--- 197,203 ----
        if(timercmp(&time_used, &interval, <))
  	{
+           struct timespec remainder_spec;
+           struct timespec sleeptime_spec;
+           struct timeval sleeptime_val;
  	  timersub(&interval, &time_used, &sleeptime_val);
  	  

Index: parser.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/parser.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** parser.h	7 Jan 2006 08:16:20 -0000	1.11
--- parser.h	8 Nov 2007 22:47:41 -0000	1.12
***************
*** 49,57 ****
  #define PROMISCUOUS 0xffffffff
  
  struct parse_function_entry
  {
    olsr_u32_t type;       /* If set to PROMISCUOUS all messages will be received */
    int caller_forwarding; /* If set to 0 this entry is not registered as forwarding packets */
!   void (*function)(union olsr_message *, struct interface *, union olsr_ip_addr *);
    struct parse_function_entry *next;
  };
--- 49,59 ----
  #define PROMISCUOUS 0xffffffff
  
+ typedef void parse_function(union olsr_message *, struct interface *, union olsr_ip_addr *);
+ 
  struct parse_function_entry
  {
    olsr_u32_t type;       /* If set to PROMISCUOUS all messages will be received */
    int caller_forwarding; /* If set to 0 this entry is not registered as forwarding packets */
!   parse_function *function;
    struct parse_function_entry *next;
  };
***************
*** 73,80 ****
  
  void
! olsr_parser_add_function(void (*)(union olsr_message *, struct interface *, union olsr_ip_addr *), olsr_u32_t, int);
  
  int
! olsr_parser_remove_function(void (*)(union olsr_message *, struct interface *, union olsr_ip_addr *), olsr_u32_t, int);
  
  void
--- 75,82 ----
  
  void
! olsr_parser_add_function(parse_function, olsr_u32_t, int);
  
  int
! olsr_parser_remove_function(parse_function, olsr_u32_t, int);
  
  void

Index: hysteresis.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/hysteresis.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** hysteresis.c	2 Aug 2007 22:07:19 -0000	1.21
--- hysteresis.c	8 Nov 2007 22:47:41 -0000	1.22
***************
*** 47,50 ****
--- 47,51 ----
  #include "defs.h"
  #include "olsr.h"
+ #include "net_olsr.h"
  
  #define hscaling olsr_cnf->hysteresis_param.scaling
***************
*** 78,83 ****
        if(entry->L_link_pending == 1)
  	{
  	  OLSR_PRINTF(1, "HYST[%s] link set to NOT pending!\n", 
! 		      olsr_ip_to_string(&entry->neighbor_iface_addr));
  	  changes_neighborhood = OLSR_TRUE;
  	}
--- 79,87 ----
        if(entry->L_link_pending == 1)
  	{
+ #ifndef NODEBUG
+           struct ipaddr_str buf;
+ #endif
  	  OLSR_PRINTF(1, "HYST[%s] link set to NOT pending!\n", 
! 		      olsr_ip_to_string(&buf, &entry->neighbor_iface_addr));
  	  changes_neighborhood = OLSR_TRUE;
  	}
***************
*** 99,104 ****
        if(entry->L_link_pending == 0)
  	{
  	  OLSR_PRINTF(1, "HYST[%s] link set to pending!\n", 
! 		      olsr_ip_to_string(&entry->neighbor_iface_addr));
  	  changes_neighborhood = OLSR_TRUE;
  	}
--- 103,111 ----
        if(entry->L_link_pending == 0)
  	{
+ #ifndef NODEBUG
+           struct ipaddr_str buf;
+ #endif
  	  OLSR_PRINTF(1, "HYST[%s] link set to pending!\n", 
! 		      olsr_ip_to_string(&buf, &entry->neighbor_iface_addr));
  	  changes_neighborhood = OLSR_TRUE;
  	}
***************
*** 148,154 ****
  olsr_update_hysteresis_hello(struct link_entry *entry, double htime)
  {
! #ifdef DEBUG
!   OLSR_PRINTF(3, "HYST[%s]: HELLO update vtime %f\n", olsr_ip_to_string(&entry->neighbor_iface_addr), htime*1.5);
  #endif
    /* hello timeout = current time + hint time */
    /* SET TIMER TO 1.5 TIMES THE INTERVAL */
--- 155,162 ----
  olsr_update_hysteresis_hello(struct link_entry *entry, double htime)
  {
! #ifndef NODEBUG
!   struct ipaddr_str buf;
  #endif
+   OLSR_PRINTF(3, "HYST[%s]: HELLO update vtime %f\n", olsr_ip_to_string(&buf, &entry->neighbor_iface_addr), htime*1.5);
    /* hello timeout = current time + hint time */
    /* SET TIMER TO 1.5 TIMES THE INTERVAL */
***************
*** 167,176 ****
    struct link_entry *lnk = lookup_link_entry(remote, NULL, local);
  
!   /* Calculate new quality */      
    if(lnk != NULL)
      {
        lnk->L_link_quality = olsr_hyst_calc_stability(lnk->L_link_quality);
  #ifdef DEBUG
!       OLSR_PRINTF(3, "HYST[%s]: %0.3f\n", olsr_ip_to_string(remote), lnk->L_link_quality);
  #endif
  
--- 175,187 ----
    struct link_entry *lnk = lookup_link_entry(remote, NULL, local);
  
!   /* Calculate new quality */
    if(lnk != NULL)
      {
+ #if !defined(NODEBUG) && defined(DEBUG)
+       struct ipaddr_str buf;
+ #endif
        lnk->L_link_quality = olsr_hyst_calc_stability(lnk->L_link_quality);
  #ifdef DEBUG
!       OLSR_PRINTF(3, "HYST[%s]: %0.3f\n", olsr_ip_to_string(&buf, remote), lnk->L_link_quality);
  #endif
  
***************
*** 189,193 ****
  #ifdef DEBUG
  	      OLSR_PRINTF(5, "HYST[%s] PACKET LOSS! %0.3f\n",
! 			  olsr_ip_to_string(remote), lnk->L_link_quality);
  #endif
  	      if(lnk->L_link_quality < olsr_cnf->hysteresis_param.thr_low)
--- 200,204 ----
  #ifdef DEBUG
  	      OLSR_PRINTF(5, "HYST[%s] PACKET LOSS! %0.3f\n",
! 			  olsr_ip_to_string(&buf, remote), lnk->L_link_quality);
  #endif
  	      if(lnk->L_link_quality < olsr_cnf->hysteresis_param.thr_low)

Index: interfaces.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** interfaces.h	13 Oct 2007 12:09:11 -0000	1.43
--- interfaces.h	8 Nov 2007 22:47:41 -0000	1.44
***************
*** 122,133 ****
  /**
   *A struct containing all necessary information about each
!  *interface participating in the OLSD routing
   */
  struct interface 
  {
    /* IP version 4 */
!   struct	sockaddr int_addr;		/* address */
!   struct	sockaddr int_netmask;		/* netmask */
!   struct	sockaddr int_broadaddr;         /* broadcast address */
    /* IP version 6 */
    struct        sockaddr_in6 int6_addr;         /* Address */
--- 122,133 ----
  /**
   *A struct containing all necessary information about each
!  *interface participating in the OLSRD routing
   */
  struct interface 
  {
    /* IP version 4 */
!   struct	sockaddr_in int_addr;		/* address */
!   struct	sockaddr_in int_netmask;		/* netmask */
!   struct	sockaddr_in int_broadaddr;         /* broadcast address */
    /* IP version 6 */
    struct        sockaddr_in6 int6_addr;         /* Address */





More information about the Olsr-cvs mailing list