[Olsr-dev] [PATCH v1 1/5] ifnet: also store the HNA validity time in msec

Ferry Huberts (spam-protected)
Fri May 8 10:12:37 CEST 2015


From: Ferry Huberts <(spam-protected)>

For performance reasons in a later patch.

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 src/interfaces.h | 1 +
 src/unix/ifnet.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/interfaces.h b/src/interfaces.h
index e50e54e..90472c3 100644
--- a/src/interfaces.h
+++ b/src/interfaces.h
@@ -100,6 +100,7 @@ struct vtimes {
   uint8_t tc;
   uint8_t mid;
   uint8_t hna;
+  uint32_t hna_reltime;
 };
 
 /* Output buffer structure. This should actually be in net_olsr.h but we have circular references then.
diff --git a/src/unix/ifnet.c b/src/unix/ifnet.c
index 45318af..252be24 100644
--- a/src/unix/ifnet.c
+++ b/src/unix/ifnet.c
@@ -496,6 +496,7 @@ add_hemu_if(struct olsr_if *iface)
   ifp->valtimes.tc = reltime_to_me(iface->cnf->tc_params.validity_time * MSEC_PER_SEC);
   ifp->valtimes.mid = reltime_to_me(iface->cnf->mid_params.validity_time * MSEC_PER_SEC);
   ifp->valtimes.hna = reltime_to_me(iface->cnf->hna_params.validity_time * MSEC_PER_SEC);
+  ifp->valtimes.hna_reltime = me_to_reltime(ifp->valtimes.hna);
 
   ifp->mode = iface->cnf->mode;
 
@@ -839,6 +840,7 @@ chk_if_up(struct olsr_if *iface, int debuglvl __attribute__ ((unused)))
   ifp->valtimes.tc = reltime_to_me(iface->cnf->tc_params.validity_time * MSEC_PER_SEC);
   ifp->valtimes.mid = reltime_to_me(iface->cnf->mid_params.validity_time * MSEC_PER_SEC);
   ifp->valtimes.hna = reltime_to_me(iface->cnf->hna_params.validity_time * MSEC_PER_SEC);
+  ifp->valtimes.hna_reltime = me_to_reltime(ifp->valtimes.hna);
 
   ifp->mode = iface->cnf->mode;
 
-- 
2.1.0





More information about the Olsr-dev mailing list