Store willingness in end of NHDP 2nd pass (because its cleared at the beginning of...
authorHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Mon, 24 Aug 2015 09:25:11 +0000 (11:25 +0200)
committerHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Mon, 24 Aug 2015 09:25:11 +0000 (11:25 +0200)
src-plugins/nhdp/nhdp/nhdp_domain.c
src-plugins/nhdp/nhdp/nhdp_reader.c

index 15e2589..6d03bf0 100644 (file)
@@ -695,9 +695,14 @@ nhdp_domain_store_willingness(struct nhdp_neighbor *neigh) {
   struct nhdp_domain *domain;
 
   neigh->flooding_willingness = _flooding_domain._tmp_willingness;
+  OONF_DEBUG(LOG_NHDP_R, "Set flooding willingness: %u",
+      neigh->flooding_willingness);
+
   list_for_each_element(&_domain_list, domain, _node) {
     neighdata = nhdp_domain_get_neighbordata(domain, neigh);
     neighdata->willingness = domain->_tmp_willingness;
+    OONF_DEBUG(LOG_NHDP_R, "Set routing willingness for domain %u: %u",
+        domain->ext, neighdata->willingness);
   }
 }
 
@@ -1078,10 +1083,10 @@ static void
 _apply_mpr(struct nhdp_domain *domain, const char *mpr_name, uint8_t willingness) {
   struct nhdp_domain_mpr *mpr;
 
+  domain->local_willingness = willingness;
+
   /* check if we have to remove the old mpr first */
   if (strcasecmp(domain->mpr_name, mpr_name) == 0) {
-    domain->local_willingness = willingness;
-
     /* nothing else to do, we already have the right MPR */
     return;
   }
@@ -1108,7 +1113,6 @@ _apply_mpr(struct nhdp_domain *domain, const char *mpr_name, uint8_t willingness
   /* link domain and mpr */
   domain->mpr->_refcount--;
   domain->mpr = mpr;
-  domain->local_willingness = willingness;
 
   /* activate mpr */
   if (mpr->_refcount == 0 && mpr->enable) {
index c693902..9c83789 100644 (file)
@@ -690,9 +690,6 @@ _cb_addresstlvs_pass1_end(struct rfc5444_reader_tlvblock_context *context, bool
     }
   }
 
-  /* copy willingness to permanent storage */
-  nhdp_domain_store_willingness(_current.neighbor);
-
   OONF_DEBUG(LOG_NHDP_R, "pass1 finished");
 
   return RFC5444_OKAY;
@@ -966,6 +963,9 @@ _cb_msg_pass2_end(struct rfc5444_reader_tlvblock_context *context, bool dropped)
   /* overwrite originator of neighbor entry */
   nhdp_db_neighbor_set_originator(_current.neighbor, &context->orig_addr);
 
+  /* copy willingness to permanent storage */
+  nhdp_domain_store_willingness(_current.neighbor);
+
   /* update MPR sets and link metrics */
   nhdp_domain_neighbor_changed(_current.neighbor);