FIX: segfault in neighbor/neighbor-2 table
authorHenning Rogge <rogge@fgan.de>
Thu, 23 Apr 2009 08:26:01 +0000 (10:26 +0200)
committerHenning Rogge <rogge@fgan.de>
Thu, 23 Apr 2009 08:26:01 +0000 (10:26 +0200)
src/neighbor_table.c
src/neighbor_table.h
src/two_hop_neighbor_table.c
src/two_hop_neighbor_table.h

index 2bf239e..b40a392 100644 (file)
@@ -106,14 +106,14 @@ olsr_del_nbr2_list(struct neighbor_2_list_entry *nbr2_list)
  * @return positive if entry deleted
  */
 int
-olsr_delete_neighbor_2_pointer(struct neighbor_entry *neighbor, union olsr_ip_addr *address)
+olsr_delete_neighbor_2_pointer(struct neighbor_entry *neighbor, struct neighbor_2_entry *neigh2)
 {
   struct neighbor_2_list_entry *nbr2_list;
 
   nbr2_list = neighbor->neighbor_2_list.next;
 
   while (nbr2_list != &neighbor->neighbor_2_list) {
-    if (ipequal(&nbr2_list->neighbor_2->neighbor_2_addr, address)) {
+    if (nbr2_list->neighbor_2 == neigh2) {
       olsr_del_nbr2_list(nbr2_list);
       return 1;
     }
@@ -190,7 +190,7 @@ olsr_delete_neighbor_table(const union olsr_ip_addr *neighbor_addr)
     two_hop_list = two_hop_list->next;
 
     two_hop_to_delete->neighbor_2->neighbor_2_pointer--;
-    olsr_delete_neighbor_pointer(two_hop_to_delete->neighbor_2, &entry->neighbor_main_addr);
+    olsr_delete_neighbor_pointer(two_hop_to_delete->neighbor_2, entry);
 
     olsr_del_nbr2_list(two_hop_to_delete);
   }
index a36339f..9a2a42c 100644 (file)
@@ -85,7 +85,7 @@ extern struct neighbor_entry neighbortable[HASHSIZE];
 
 void olsr_init_neighbor_table(void);
 
-int olsr_delete_neighbor_2_pointer(struct neighbor_entry *, union olsr_ip_addr *);
+int olsr_delete_neighbor_2_pointer(struct neighbor_entry *, struct neighbor_2_entry *);
 
 struct neighbor_2_list_entry *olsr_lookup_my_neighbors(const struct neighbor_entry *, const union olsr_ip_addr *);
 
index 55e416e..e9eb94b 100644 (file)
@@ -74,11 +74,11 @@ olsr_init_two_hop_table(void)
  */
 
 void
-olsr_delete_neighbor_pointer(struct neighbor_2_entry *two_hop_entry, const union olsr_ip_addr *address)
+olsr_delete_neighbor_pointer(struct neighbor_2_entry *two_hop_entry, struct neighbor_entry *neigh)
 {
   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)) {
+    if (entry->neighbor == neigh) {
       struct neighbor_list_entry *entry_to_delete = entry;
       entry = entry->next;
 
@@ -111,7 +111,7 @@ olsr_delete_two_hop_neighbor_table(struct neighbor_2_entry *two_hop_neighbor)
     struct neighbor_entry *one_hop_entry = one_hop_list->neighbor;
     struct neighbor_list_entry *entry_to_delete = one_hop_list;
 
-    olsr_delete_neighbor_2_pointer(one_hop_entry, &two_hop_neighbor->neighbor_2_addr);
+    olsr_delete_neighbor_2_pointer(one_hop_entry, two_hop_neighbor);
     one_hop_list = one_hop_list->next;
     /* no need to dequeue */
     free(entry_to_delete);
index 43f162e..dc50de9 100644 (file)
@@ -71,7 +71,7 @@ extern struct neighbor_2_entry two_hop_neighbortable[HASHSIZE];
 
 void olsr_init_two_hop_table(void);
 
-void olsr_delete_neighbor_pointer(struct neighbor_2_entry *, const union olsr_ip_addr *);
+void olsr_delete_neighbor_pointer(struct neighbor_2_entry *, struct neighbor_entry *);
 
 void olsr_delete_two_hop_neighbor_table(struct neighbor_2_entry *);