X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=src%2Fdhcpv6.c;h=e99195840f96ed5a7474f01f35dc288ba9c42f07;hb=2cc9d0fa03c68cea04111c05b139e5eaaa999fca;hp=8be70af19797ffde5ed2ddf73646a13a90463280;hpb=e9de72f3fc41466819f8027b6cc7a978c388ed28;p=odhcp6c.git diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 8be70af..e991958 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -520,7 +520,7 @@ static int dhcpv6_handle_advert(_unused enum dhcpv6_msg orig, cand.preference -= 2000; } else if (otype == DHCPV6_OPT_PREF && olen >= 1 && cand.preference >= 0) { - cand.preference = odata[1]; + cand.preference = odata[0]; } else if (otype == DHCPV6_OPT_RECONF_ACCEPT) { cand.wants_reconfigure = true; } else if (otype == DHCPV6_OPT_IA_PD && request_prefix) { @@ -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);