From: Hans Dedecker Date: Thu, 3 Dec 2020 20:28:41 +0000 (+0100) Subject: dhcpv6: only refresh timers when reconfigure is valid X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=faed29a;p=project%2Fodhcp6c.git dhcpv6: only refresh timers when reconfigure is valid Refresh timers only when a valid DHCPv6 msg-type has been received in the received DHCPv6 reconfigure Signed-off-by: Hans Dedecker --- diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 370c9ea..11cc8b6 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -840,7 +840,7 @@ static int dhcpv6_handle_reconfigure(enum dhcpv6_msg orig, const int rc, { uint16_t otype, olen; uint8_t *odata; - int msg = -1; + enum dhcpv6_msg msg = DHCPV6_MSG_UNKNOWN; dhcpv6_for_each_option(opt, end, otype, olen, odata) { if (otype == DHCPV6_OPT_RECONF_MESSAGE && olen == 1) { @@ -866,9 +866,10 @@ static int dhcpv6_handle_reconfigure(enum dhcpv6_msg orig, const int rc, } } - dhcpv6_handle_reply(orig, rc, NULL, NULL, NULL); + if (msg != DHCPV6_MSG_UNKNOWN) + dhcpv6_handle_reply(orig, rc, NULL, NULL, NULL); - return msg; + return (msg == DHCPV6_MSG_UNKNOWN? -1: 1); } // Collect all advertised servers