MID database now also uses reverse lookpu to find main addresses
authorAndreas Tonnesen <andreto@olsr.org>
Sat, 22 Jan 2005 00:09:18 +0000 (00:09 +0000)
committerAndreas Tonnesen <andreto@olsr.org>
Sat, 22 Jan 2005 00:09:18 +0000 (00:09 +0000)
src/defs.h
src/link_set.c
src/lq_route.c
src/mid_set.c
src/mid_set.h
src/neighbor_table.c
src/routing_table.c
src/two_hop_neighbor_table.c

index 99121d7..9e19a18 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: defs.h,v 1.32 2005/01/16 19:49:28 kattemat Exp $
+ * $Id: defs.h,v 1.33 2005/01/22 00:09:18 kattemat Exp $
  */
 
 #ifndef _OLSR_DEFS
@@ -96,16 +96,6 @@ struct olsrd_config *olsr_cnf;
 /* Global tick resolution */
 olsr_u16_t system_tick_divider;
 
-/*
- * Generic address list elem
- */
-struct addresses 
-{
-  union olsr_ip_addr address;
-  struct addresses *next;
-};
-
-
 int exit_value; /* Global return value for process termination */
 
 
index 62e7a44..88d934f 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: link_set.c,v 1.40 2005/01/17 20:18:20 kattemat Exp $
+ * $Id: link_set.c,v 1.41 2005/01/22 00:09:18 kattemat Exp $
  */
 
 
@@ -181,7 +181,7 @@ get_neighbor_status(union olsr_ip_addr *address)
   /* Loop trough local interfaces to check all possebilities */
   for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next)
     {
-      struct addresses   *aliases;
+      struct mid_address   *aliases;
       struct link_entry  *link;
 
       //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr));
@@ -195,11 +195,11 @@ get_neighbor_status(union olsr_ip_addr *address)
       /* Get aliases */
       for(aliases = mid_lookup_aliases(main_addr);
          aliases != NULL;
-         aliases = aliases->next)
+         aliases = aliases->next_alias)
        {
          //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr));
          //printf("%s : ", olsr_ip_to_string(&aliases->address)); 
-         if((link = lookup_link_entry(&aliases->address, &ifs->ip_addr)) != NULL)
+         if((link = lookup_link_entry(&aliases->alias, &ifs->ip_addr)) != NULL)
            {
              //printf("%d\n", lookup_link_status(link));
 
@@ -240,7 +240,7 @@ get_neighbor_nexthop(union olsr_ip_addr *address)
   /* Loop trough local interfaces to check all possebilities */
   for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next)
     {
-      struct addresses   *aliases;
+      struct mid_address *aliases;
       struct link_entry  *link;
       //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr));
       //printf("%s : ", olsr_ip_to_string(main_addr)); 
@@ -253,16 +253,16 @@ get_neighbor_nexthop(union olsr_ip_addr *address)
       /* Get aliases */
       for(aliases = mid_lookup_aliases(main_addr);
          aliases != NULL;
-         aliases = aliases->next)
+         aliases = aliases->next_alias)
        {
          //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr));
          //printf("%s : ", olsr_ip_to_string(&aliases->address)); 
-         if((link = lookup_link_entry(&aliases->address, &ifs->ip_addr)) != NULL)
+         if((link = lookup_link_entry(&aliases->alias, &ifs->ip_addr)) != NULL)
            {
              //printf("%d\n", lookup_link_status(link));
 
              if(lookup_link_status(link) == SYM_LINK)
-               return &aliases->address;
+               return &aliases->alias;
            }
        }
     }
index daa2065..44978c9 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: lq_route.c,v 1.19 2004/12/06 13:01:15 tlopatic Exp $
+ * $Id: lq_route.c,v 1.20 2005/01/22 00:09:18 kattemat Exp $
  */
 
 #include "defs.h"
@@ -304,7 +304,7 @@ void olsr_calculate_lq_routing_table(void)
   struct dijk_vertex *myself;
   struct dijk_vertex *walker;
   int hops;
-  struct addresses *mid_walker;
+  struct mid_address *mid_walker;
   float etx;
 
   // initialize the graph
@@ -460,8 +460,8 @@ void olsr_calculate_lq_routing_table(void)
     // add routes to the remaining interfaces of the destination node
 
     for (mid_walker = mid_lookup_aliases(&vert->addr); mid_walker != NULL;
-         mid_walker = mid_walker->next)
-      olsr_insert_routing_table(&mid_walker->address,
+         mid_walker = mid_walker->next_alias)
+      olsr_insert_routing_table(&mid_walker->alias,
                                 get_neighbor_nexthop(&walker->addr), hops);
   }
 
index d3528ea..d1e6d65 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: mid_set.c,v 1.11 2005/01/17 20:18:21 kattemat Exp $
+ * $Id: mid_set.c,v 1.12 2005/01/22 00:09:18 kattemat Exp $
  */
 
 #include "defs.h"
@@ -68,6 +68,9 @@ olsr_init_mid_set()
     {
       mid_set[index].next = &mid_set[index];
       mid_set[index].prev = &mid_set[index];
+
+      reverse_mid_set[index].next = &reverse_mid_set[index];
+      reverse_mid_set[index].prev = &reverse_mid_set[index];
     }
 
   return 1;
@@ -86,13 +89,14 @@ olsr_init_mid_set()
  */
 
 void 
-insert_mid_tuple(union olsr_ip_addr *m_addr, struct addresses *alias, float vtime)
+insert_mid_tuple(union olsr_ip_addr *m_addr, struct mid_address *alias, float vtime)
 {
   struct mid_entry *tmp;
-  struct addresses *tmp_adr;
-  olsr_u32_t hash;
+  struct mid_address *tmp_adr;
+  olsr_u32_t hash, alias_hash;
 
   hash = olsr_hashing(m_addr);
+  alias_hash = olsr_hashing(&alias->alias);
 
   /* Check for registered entry */
   for(tmp = mid_set[hash].next;
@@ -108,7 +112,9 @@ insert_mid_tuple(union olsr_ip_addr *m_addr, struct addresses *alias, float vtim
     {
       tmp_adr = tmp->aliases;
       tmp->aliases = alias;
-      alias->next = tmp_adr;
+      alias->main_entry = tmp;
+      QUEUE_ELEM(reverse_mid_set[alias_hash], alias);
+      alias->next_alias = tmp_adr;
       tmp->ass_timer = GET_TIMESTAMP(vtime*1000);
     }
       /*Create new node*/
@@ -117,16 +123,12 @@ insert_mid_tuple(union olsr_ip_addr *m_addr, struct addresses *alias, float vtim
       tmp = olsr_malloc(sizeof(struct mid_entry), "MID new alias");
 
       tmp->aliases = alias;
+      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 */
       QUEUE_ELEM(mid_set[hash], tmp);
-      /*
-      tmp->next = mid_set[hash].next;
-      tmp->prev = &mid_set[hash];
-      mid_set[hash].next->prev = tmp;
-      mid_set[hash].next = tmp;
-      */
     }
   
 
@@ -147,9 +149,9 @@ insert_mid_tuple(union olsr_ip_addr *m_addr, struct addresses *alias, float vtim
       struct neighbor_entry *tmp_neigh, *real_neigh;
 
       /* Delete possible 2 hop neighbor */
-      if((tmp_2_neighbor = olsr_lookup_two_hop_neighbor_table_mid(&tmp_adr->address)) != NULL)
+      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->address));
+         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);
@@ -158,11 +160,11 @@ insert_mid_tuple(union olsr_ip_addr *m_addr, struct addresses *alias, float vtim
        }
 
       /* Delete a possible neighbor entry */
-      if(((tmp_neigh = olsr_lookup_neighbor_table_alias(&tmp_adr->address)) != NULL)
+      if(((tmp_neigh = olsr_lookup_neighbor_table_alias(&tmp_adr->alias)) != NULL)
         && ((real_neigh = olsr_lookup_neighbor_table_alias(m_addr)) != NULL))
 
        {
-         olsr_printf(1, "[MID]Deleting bogus neighbor entry %s real ", olsr_ip_to_string(&tmp_adr->address));
+         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);
@@ -175,7 +177,7 @@ insert_mid_tuple(union olsr_ip_addr *m_addr, struct addresses *alias, float vtim
          changes_neighborhood = OLSR_TRUE;
        }
       
-      tmp_adr = tmp_adr->next;
+      tmp_adr = tmp_adr->next_alias;
     }
 
 
@@ -196,24 +198,24 @@ insert_mid_tuple(union olsr_ip_addr *m_addr, struct addresses *alias, float vtim
 void
 insert_mid_alias(union olsr_ip_addr *main_add, union olsr_ip_addr *alias, float vtime)
 {
-  struct addresses *adr;
-
-  adr = olsr_malloc(sizeof(struct addresses), "Insert MID alias");
+  struct mid_address *adr;
 
+  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->address, alias);
-  adr->next = NULL;
-
+  COPY_IP(&adr->alias, alias);
+  adr->next_alias = NULL;
+  
   insert_mid_tuple(main_add, adr, vtime);
-
+  
   /*
    *Recalculate topology
    */
   changes_neighborhood = OLSR_TRUE;
   changes_topology = OLSR_TRUE;
-
+  
   //print_mid_list();
 }
 
@@ -231,31 +233,19 @@ insert_mid_alias(union olsr_ip_addr *main_add, union olsr_ip_addr *alias, float
 union olsr_ip_addr *
 mid_lookup_main_addr(union olsr_ip_addr *adr)
 {
-  int index;
+  olsr_u32_t hash;
+  struct mid_address *tmp_list;
 
-  for(index=0;index<HASHSIZE;index++)
-    {
-      struct mid_entry *tmp_list = mid_set[index].next;
-      /*Traverse MID list*/
-      while(tmp_list != &mid_set[index])
+#warning MID SET NOW HAS REVERSE INDEXING!
+  hash = olsr_hashing(adr);
+  /*Traverse MID list*/
+  for(tmp_list = reverse_mid_set[hash].next; 
+      tmp_list != &reverse_mid_set[hash];
+      tmp_list = tmp_list->next)
        {
-         struct addresses *tmp_addr;
-
-         if(COMP_IP(&tmp_list->main_addr, adr))
-           return NULL;
-
-         tmp_addr = tmp_list->aliases;
-         /*And all aliases registered on them*/
-         while(tmp_addr)
-           {
-             if(COMP_IP(&tmp_addr->address, adr))
-               return &tmp_list->main_addr;
-             tmp_addr = tmp_addr->next;
-           }
-
-         tmp_list = tmp_list->next;
+         if(COMP_IP(&tmp_list->alias, adr))
+           return &tmp_list->main_entry->main_addr;
        }
-    }
   return NULL;
 
 }
@@ -270,7 +260,7 @@ mid_lookup_main_addr(union olsr_ip_addr *adr)
  *
  *@return a linked list of addresses structs
  */
-struct addresses *
+struct mid_address *
 mid_lookup_aliases(union olsr_ip_addr *adr)
 {
   struct mid_entry *tmp_list;
@@ -377,14 +367,15 @@ olsr_time_out_mid_set(void *foo)
 int
 mid_delete_node(struct mid_entry *entry)
 {
-  struct addresses *aliases;
+  struct mid_address *aliases;
 
   /* Free aliases */
   aliases = entry->aliases;
   while(aliases)
     {
-      struct addresses *tmp_aliases = aliases;
-      aliases = aliases->next;
+      struct mid_address *tmp_aliases = aliases;
+      aliases = aliases->next_alias;
+      DEQUEUE_ELEM(tmp_aliases);
       free(tmp_aliases);
     }
   /* Dequeue */
@@ -415,13 +406,13 @@ olsr_print_mid_set()
          tmp_list != &mid_set[index];
          tmp_list = tmp_list->next)
        {
-         struct addresses *tmp_addr = tmp_list->aliases;
+         struct mid_address *tmp_addr = tmp_list->aliases;
 
          olsr_printf(1, "%s: ", olsr_ip_to_string(&tmp_list->main_addr));        
          while(tmp_addr)
            {
-             olsr_printf(1, " %s ", olsr_ip_to_string(&tmp_addr->address));
-             tmp_addr = tmp_addr->next;
+             olsr_printf(1, " %s ", olsr_ip_to_string(&tmp_addr->alias));
+             tmp_addr = tmp_addr->next_alias;
            }
          olsr_printf(1, "\n");
          
index 8ad61f1..6686dfd 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: mid_set.h,v 1.9 2005/01/16 19:49:28 kattemat Exp $
+ * $Id: mid_set.h,v 1.10 2005/01/22 00:09:18 kattemat Exp $
  */
 
 
 
 #include "hashing.h"
 
+struct mid_address
+{
+  union olsr_ip_addr  alias;
+  struct mid_entry   *main_entry;
+
+  struct mid_address *next_alias;
+
+  /* These are for the reverse list */
+  struct mid_address *prev;
+  struct mid_address *next;
+};
+
 /*
  *Contains the main addr of a node and a list of aliases
  */
 struct mid_entry
 {
-  union olsr_ip_addr main_addr;
-  struct addresses  *aliases;
-  struct mid_entry  *prev;
-  struct mid_entry  *next;
-  clock_t            ass_timer;  
+  union olsr_ip_addr  main_addr;
+  struct mid_address *aliases;
+  struct mid_entry   *prev;
+  struct mid_entry   *next;
+  clock_t             ass_timer;  
 };
 
 
 struct mid_entry mid_set[HASHSIZE];
 
+struct mid_address reverse_mid_set[HASHSIZE];
+
 int
 olsr_init_mid_set(void);
 
 void 
-insert_mid_tuple(union olsr_ip_addr *, struct addresses *, float);
+insert_mid_tuple(union olsr_ip_addr *, struct mid_address *, float);
 
 void
 insert_mid_alias(union olsr_ip_addr *, union olsr_ip_addr *, float);
@@ -73,7 +87,7 @@ insert_mid_alias(union olsr_ip_addr *, union olsr_ip_addr *, float);
 union olsr_ip_addr *
 mid_lookup_main_addr(union olsr_ip_addr *);
 
-struct addresses *
+struct mid_address *
 mid_lookup_aliases(union olsr_ip_addr *);
 
 void
index 71f4bd0..38b5a07 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: neighbor_table.c,v 1.23 2005/01/17 20:18:21 kattemat Exp $
+ * $Id: neighbor_table.c,v 1.24 2005/01/22 00:09:18 kattemat Exp $
  */
 
 
@@ -273,7 +273,6 @@ olsr_lookup_neighbor_table(union olsr_ip_addr *dst)
 {
   struct neighbor_entry  *entry;
   olsr_u32_t             hash;
-  //struct addresses       *adr;
   union olsr_ip_addr     *tmp_ip;
 
   /*
@@ -315,7 +314,6 @@ olsr_lookup_neighbor_table_alias(union olsr_ip_addr *dst)
 {
   struct neighbor_entry  *entry;
   olsr_u32_t             hash;
-  //struct addresses       *adr;
   
   hash = olsr_hashing(dst);
 
@@ -325,7 +323,7 @@ olsr_lookup_neighbor_table_alias(union olsr_ip_addr *dst)
       entry != &neighbortable[hash];
       entry = entry->next)
     {
-      //printf("Checking %s\n", olsr_ip_to_string(&neighbor_table_tmp->neighbor_main_addr));
+      //printf("Checking %s\n", olsr_ip_to_string(&entry->neighbor_main_addr));
       if(COMP_IP(&entry->neighbor_main_addr, dst))
        return entry;
       
index b59acfa..ed0197b 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: routing_table.c,v 1.12 2005/01/17 20:18:22 kattemat Exp $
+ * $Id: routing_table.c,v 1.13 2005/01/22 00:09:18 kattemat Exp $
  */
 
 
@@ -245,26 +245,26 @@ olsr_fill_routing_table_with_neighbors()
 
          if(neighbor->status == SYM)
            {
-             static struct addresses addrs;
-             struct addresses *addrs2;
+             static struct mid_address addrs;
+             struct mid_address *addrs2;
 
              /*
               *Insert all the neighbors addresses
               */
 
-             COPY_IP(&addrs.address, &neighbor->neighbor_main_addr);
-             addrs.next = mid_lookup_aliases(&neighbor->neighbor_main_addr);
+             COPY_IP(&addrs.alias, &neighbor->neighbor_main_addr);
+             addrs.next_alias = mid_lookup_aliases(&neighbor->neighbor_main_addr);
              addrs2 = &addrs;
 
              while(addrs2!=NULL)
                {
 #ifdef DEBUG
-                 olsr_printf(7, "(ROUTE)Adding neighbor %s\n", olsr_ip_to_string(&addrs->address));
+                 olsr_printf(7, "(ROUTE)Adding neighbor %s\n", olsr_ip_to_string(&addrs->alias));
 #endif
                  /* New in 0.4.6 */
-                 new_route_entry = olsr_insert_routing_table(&addrs2->address, get_neighbor_nexthop(&addrs2->address), 1);
+                 new_route_entry = olsr_insert_routing_table(&addrs2->alias, get_neighbor_nexthop(&addrs2->alias), 1);
              
-                 addrs2 = addrs2->next;
+                 addrs2 = addrs2->next_alias;
                }
            }
        }
@@ -312,8 +312,8 @@ olsr_fill_routing_table_with_two_hop_neighbors()
            {
              olsr_bool neighbor_ok;
              union olsr_ip_addr *n2_addr;
-             static struct addresses addrs;
-             struct addresses *addrsp;
+             static struct mid_address addrs;
+             struct mid_address *addrsp;
              struct neighbor_list_entry *neighbors;
              
              n2_addr = &neigh_2_list->neighbor_2->neighbor_2_addr;
@@ -348,19 +348,19 @@ olsr_fill_routing_table_with_two_hop_neighbors()
                  continue;
                }
 
-             COPY_IP(&addrs.address, n2_addr);
-             addrs.next = mid_lookup_aliases(n2_addr);
+             COPY_IP(&addrs.alias, n2_addr);
+             addrs.next_alias = mid_lookup_aliases(n2_addr);
              addrsp = &addrs;
 
              while(addrsp!=NULL)
                {
                  struct rt_entry *new_route_entry = NULL;
 #ifdef DEBUG
-                 olsr_printf(7, "(ROUTE)Adding neighbor %s\n", olsr_ip_to_string(&addrsp->address));
+                 olsr_printf(7, "(ROUTE)Adding neighbor %s\n", olsr_ip_to_string(&addrsp->alias));
 #endif
                  /* New in 0.4.6 */
                  new_route_entry = 
-                   olsr_insert_routing_table(&addrsp->address, 
+                   olsr_insert_routing_table(&addrsp->alias, 
                                              get_neighbor_nexthop(&neighbor->neighbor_main_addr), 
                                              2);
 
@@ -374,7 +374,7 @@ olsr_fill_routing_table_with_two_hop_neighbors()
                      list_destination_tmp->next = list_destination_n;
                      list_destination_n = list_destination_tmp;
                    }
-                 addrsp = addrsp->next; 
+                 addrsp = addrsp->next_alias
                }
            }
        }
@@ -424,8 +424,8 @@ olsr_calculate_routing_table()
              /* Loop trough this nodes MPR selectors */
              while(topo_dest != &topo_entry->destinations)
                {
-                 static struct addresses tmp_addrs;
-                 struct addresses *tmp_addrsp;
+                 static struct mid_address tmp_addrs;
+                 struct mid_address *tmp_addrsp;
                  
                  /* Do not add ourselves */
                  if(if_ifwithaddr(&topo_dest->T_dest_addr))
@@ -435,25 +435,25 @@ olsr_calculate_routing_table()
                    }
                  
                  /* Find mid nodes */            
-                 COPY_IP(&tmp_addrs.address, &topo_dest->T_dest_addr);
-                 tmp_addrs.next = mid_lookup_aliases(&topo_dest->T_dest_addr);
+                 COPY_IP(&tmp_addrs.alias, &topo_dest->T_dest_addr);
+                 tmp_addrs.next_alias = mid_lookup_aliases(&topo_dest->T_dest_addr);
                  tmp_addrsp = &tmp_addrs;
                  
                  while(tmp_addrsp!=NULL)
                    {
-                     if(NULL==olsr_lookup_routing_table(&tmp_addrsp->address))
+                     if(NULL==olsr_lookup_routing_table(&tmp_addrsp->alias))
                        {
                          /* PRINT OUT: Last Hop to Final Destination */
                          /* The function ip_to_string has to be seperately */
                          olsr_printf(3, "%s -> ", olsr_ip_to_string(&list_destination_n->destination->rt_dst));
-                         olsr_printf(3, "%s\n", olsr_ip_to_string(&tmp_addrsp->address) );
+                         olsr_printf(3, "%s\n", olsr_ip_to_string(&tmp_addrsp->alias));
                          
                          destination_n_1 = olsr_malloc(sizeof(struct destination_n), 
                                                        "Calculate routing table 2");
                          
                          /* Add this entry to the "outer rim" */
                          destination_n_1->destination = 
-                           olsr_insert_routing_table(&tmp_addrsp->address, 
+                           olsr_insert_routing_table(&tmp_addrsp->alias, 
                                                      &list_destination_n->destination->rt_router, 
                                                      list_destination_n->destination->rt_metric+1);
                          if(destination_n_1->destination != NULL)
@@ -462,7 +462,7 @@ olsr_calculate_routing_table()
                              list_destination_n_1=destination_n_1;
                            }
                        }
-                     tmp_addrsp = tmp_addrsp->next;
+                     tmp_addrsp = tmp_addrsp->next_alias;
                    }
                  
                  /* Next MPR selector */
index a6f0ff6..af9cce1 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: two_hop_neighbor_table.c,v 1.12 2005/01/17 20:18:22 kattemat Exp $
+ * $Id: two_hop_neighbor_table.c,v 1.13 2005/01/22 00:09:18 kattemat Exp $
  */
 
 
@@ -181,7 +181,7 @@ olsr_lookup_two_hop_neighbor_table(union olsr_ip_addr *dest)
       neighbor_2 != &two_hop_neighbortable[hash];
       neighbor_2 = neighbor_2->next)
     {
-      struct addresses *adr;
+      struct mid_address *adr;
 
       //printf("Checking %s\n", olsr_ip_to_string(dest));
       if (COMP_IP(&neighbor_2->neighbor_2_addr, dest))
@@ -191,9 +191,9 @@ olsr_lookup_two_hop_neighbor_table(union olsr_ip_addr *dest)
 
       while(adr)
        {
-         if(COMP_IP(&adr->address, dest))
+         if(COMP_IP(&adr->alias, dest))
            return neighbor_2;
-         adr = adr->next;
+         adr = adr->next_alias;
        } 
     }