[hipl-commit] [trunk] Rev 4709: Fixed loop on deletion from oppdb

  • From: Artturi Karila <artturi.karila@xxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Thu, 3 Jun 2010 15:43:56 +0300

Committer: Artturi Karila <artturi.karila@xxxxxxxxxx>
Date: 03/06/2010 at 15:43:56
Revision: 4709
Revision-id: artturi.karila@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  Fixed loop on deletion from oppdb
  
  hip_oppdb_entry_clean_up() and hip_del_peer_info_entry() were calling each 
other before deleting the entry. Changed it to delete the hadb entry first.

Modified:
  M  hipd/hadb.c
  M  hipd/oppdb.c

=== modified file 'hipd/hadb.c'
--- hipd/hadb.c 2010-06-02 07:30:33 +0000
+++ hipd/hadb.c 2010-06-03 12:43:56 +0000
@@ -802,13 +802,17 @@
 
 #ifdef CONFIG_HIP_OPPORTUNISTIC
     opp_entry = hip_oppdb_find_by_ip(&ha->peer_addr);
+#endif
+
+    /* Delete hadb entry before oppdb entry to avoid a loop */
+    hip_hadb_delete_state(ha);
+
+#ifdef CONFIG_HIP_OPPORTUNISTIC
     if (opp_entry) {
         hip_oppdb_entry_clean_up(opp_entry);
     }
 #endif
 
-    hip_hadb_delete_state(ha);
-
     HIP_UNLOCK_HA(ha);
 
     return 0;

=== modified file 'hipd/oppdb.c'
--- hipd/oppdb.c        2010-06-01 15:11:44 +0000
+++ hipd/oppdb.c        2010-06-03 12:43:56 +0000
@@ -113,9 +113,8 @@
         connections: a better solution might be trash collection  */
 
     HIP_ASSERT(opp_entry);
-    err = hip_del_peer_info(&opp_entry->peer_phit,
+    hip_del_peer_info(&opp_entry->peer_phit,
                             &opp_entry->our_real_hit);
-    HIP_DEBUG("Del peer info returned %d\n", err);
     hip_oppdb_del_entry_by_entry(opp_entry);
     return err;
 }

Other related posts:

  • » [hipl-commit] [trunk] Rev 4709: Fixed loop on deletion from oppdb - Artturi Karila