dhcpv6: respect renew end point when handling reconfigure message
authorHans Dedecker <dedeckeh@gmail.com>
Wed, 22 Mar 2017 12:58:04 +0000 (13:58 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Wed, 22 Mar 2017 13:01:27 +0000 (14:01 +0100)
Set T1 to 0 when receiving reconfigure message with as msg type renew;
this keeps the renew end point fixed meaning rebinding is started at T2
as initially calculated.

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

index d63d551e0f492354717a88b34c38417a4553619b..6dc227fe6f37f77895f21473e4059fbb85bac39d 100644 (file)
@@ -805,10 +805,20 @@ static int dhcpv6_handle_reconfigure(enum dhcpv6_msg orig, const int rc,
        int msg = -1;
 
        dhcpv6_for_each_option(opt, end, otype, olen, odata) {
-               if (otype == DHCPV6_OPT_RECONF_MESSAGE && olen == 1 && (
-                               odata[0] == DHCPV6_MSG_RENEW ||
-                               odata[0] == DHCPV6_MSG_INFO_REQ))
-                       msg = odata[0];
+               if (otype == DHCPV6_OPT_RECONF_MESSAGE && olen == 1) {
+                       switch (odata[0]) {
+                       case DHCPV6_MSG_RENEW:
+                               if (t1 != UINT32_MAX)
+                                       t1 = 0;
+                       // Fall through
+                       case DHCPV6_MSG_INFO_REQ:
+                               msg = odata[0];
+                               break;
+
+                       default:
+                               break;
+                       }
+               }
        }
 
        dhcpv6_handle_reply(orig, rc, NULL, NULL, NULL);