Fix timing issues with large T1 and T2 values
authorSteven Barth <steven@midlink.org>
Fri, 8 Mar 2013 07:53:13 +0000 (08:53 +0100)
committerSteven Barth <steven@midlink.org>
Fri, 8 Mar 2013 07:53:13 +0000 (08:53 +0100)
src/dhcpv6.c

index 8be70af19797ffde5ed2ddf73646a13a90463280..da920ce21c06aa405feee11652f7317502d1a5a2 100644 (file)
@@ -623,7 +623,7 @@ static int dhcpv6_handle_reply(enum dhcpv6_msg orig,
                if (t3 < 0)
                        t3 = 0;
        } else {
-               t1 = t2 = t3 = 86400;
+               t1 = t2 = t3 = UINT32_MAX;
        }
 
        if (opt) {
@@ -674,6 +674,12 @@ static int dhcpv6_handle_reply(enum dhcpv6_msg orig,
                        if (n < t3)
                                t3 = n;
 
+                       if (t2 >= t3)
+                               t2 = 8 * t3 / 10;
+
+                       if (t1 >= t2)
+                               t1 = 5 * t2 / 8;
+
                } else if (otype == DHCPV6_OPT_DNS_SERVERS) {
                        if (olen % 16 == 0)
                                odhcp6c_add_state(STATE_DNS, odata, olen);