From: Paul Donald <newt...@gmail.com> ra_lifetime no longer holds negative values, because we no longer do 'init' when we do calc_ra_lifetime.
Signed-off-by: Paul Donald <newt...@gmail.com> --- src/odhcpd.h | 2 +- src/router.c | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/odhcpd.h b/src/odhcpd.h index 7a82e98..09cd4f1 100644 --- a/src/odhcpd.h +++ b/src/odhcpd.h @@ -314,7 +314,7 @@ struct interface { int route_preference; int ra_maxinterval; int ra_mininterval; - int ra_lifetime; + uint32_t ra_lifetime; uint32_t ra_reachabletime; uint32_t ra_retranstime; uint32_t ra_hoplimit; diff --git a/src/router.c b/src/router.c index 96237d6..b859c46 100644 --- a/src/router.c +++ b/src/router.c @@ -366,17 +366,14 @@ static int calc_adv_interval(struct interface *iface, uint32_t lowest_found_life static uint32_t calc_ra_lifetime(struct interface *iface, uint32_t maxival) { - uint32_t lifetime = 3*maxival; - - if (iface->ra_lifetime >= 0) { - lifetime = iface->ra_lifetime; - if (lifetime > 0 && lifetime < maxival) - lifetime = maxival; - /* // RouterLifetime is a 16 bit packet field: skip this check - else if (lifetime > RouterLifetime_MAX) - lifetime = RouterLifetime_MAX; - */ - } + uint32_t lifetime = iface->ra_lifetime; + + if (lifetime > 0 && lifetime < maxival) + lifetime = maxival; + /* // RouterLifetime is a 16 bit packet field: skip this check + else if (lifetime > RouterLifetime_MAX) + lifetime = RouterLifetime_MAX; + */ return lifetime; } -- 2.44.0 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel