ra: don't set nd_ra_{reachable,retransmit} to 0
authorSteven Barth <steven@midlink.org>
Wed, 5 Mar 2014 08:11:24 +0000 (09:11 +0100)
committerSteven Barth <steven@midlink.org>
Wed, 5 Mar 2014 08:11:24 +0000 (09:11 +0100)
src/ra.c

index 560552fcbd5bb4149bb9f2df8043bd30394ee76a..3e36f94692e14921cb9aa94132d032181cf654e1 100644 (file)
--- a/src/ra.c
+++ b/src/ra.c
@@ -311,11 +311,13 @@ bool ra_process(void)
                        update_proc("conf", "hop_limit", adv->nd_ra_curhoplimit);
 
                // Parse ND parameters
-               if (ntohl(adv->nd_ra_reachable) <= 3600000)
-                       update_proc("neigh", "base_reachable_time_ms", ntohl(adv->nd_ra_reachable));
+               uint32_t reachable = ntohl(adv->nd_ra_reachable);
+               if (reachable > 0 && reachable <= 3600000)
+                       update_proc("neigh", "base_reachable_time_ms", reachable);
 
-               if (ntohl(adv->nd_ra_retransmit) <= 60000)
-                       update_proc("neigh", "retrans_time_ms", ntohl(adv->nd_ra_retransmit));
+               uint32_t retransmit = ntohl(adv->nd_ra_retransmit);
+               if (retransmit > 0 && retransmit <= 60000)
+                       update_proc("neigh", "retrans_time_ms", retransmit);
 
 
                // Evaluate options