dhcpv6: only refresh timers when reconfigure is valid
authorHans Dedecker <dedeckeh@gmail.com>
Thu, 3 Dec 2020 20:28:41 +0000 (21:28 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Thu, 3 Dec 2020 21:21:47 +0000 (22:21 +0100)
Refresh timers only when a valid DHCPv6 msg-type has been received
in the received DHCPv6 reconfigure

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/dhcpv6.c

index 370c9eaede62d86aa4d75ae0ee5637ad122d7a50..11cc8b6280e16f65c7a11f9f4581d7442be84a24 100644 (file)
@@ -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