dhcpv6: fix calculation of T1 and T2
authorSteven Barth <steven@midlink.org>
Sat, 18 Oct 2014 15:46:34 +0000 (17:46 +0200)
committerSteven Barth <steven@midlink.org>
Sat, 18 Oct 2014 15:46:34 +0000 (17:46 +0200)
src/dhcpv6-ia.c

index 6ece528bd6e71fd6e1ca3a946d2371508f3ccdae..b21b39e1007fca8ada8663689d8019e43b33cbc1 100644 (file)
@@ -800,9 +800,6 @@ static size_t append_reply(uint8_t *buf, size_t buflen, uint16_t status,
 #endif
                                        datalen += entrlen + 4;
                                } else {
-                                       if (!a->accept_reconf && iface->managed < RELAYD_MANAGED_NO_AFLAG)
-                                               prefix_pref = 1;
-
                                        struct dhcpv6_ia_addr n = {
                                                .type = htons(DHCPV6_OPT_IA_ADDR),
                                                .len = htons(sizeof(n) - 4),
@@ -813,6 +810,9 @@ static size_t append_reply(uint8_t *buf, size_t buflen, uint16_t status,
                                        n.addr.s6_addr32[3] = htonl(a->assigned);
                                        size_t entrlen = sizeof(n) - 4;
 
+                                       if (!a->accept_reconf && iface->managed < RELAYD_MANAGED_NO_AFLAG)
+                                               n.preferred = htonl(1);
+
 #ifdef DHCPV6_OPT_PREFIX_CLASS
                                        if (iface->ia_addr[i].has_class) {
                                                entrlen += sizeof(pclass);