syslog(LOG_NOTICE, "Sending %s (timeout %us)", retx->name, timeout);
- uint64_t start = adhc6c_get_milli_time(), round_start = start, elapsed;
+ uint64_t start = odhcp6c_get_milli_time(), round_start = start, elapsed;
// Generate transaction ID
uint8_t trid[3];
// Receive rounds
for (; len < 0 && round_start < round_end;
- round_start = adhc6c_get_milli_time()) {
+ round_start = odhcp6c_get_milli_time()) {
// Check for pending signal
if (odhcp6c_signal_is_pending())
return -1;
uint8_t *opt = &buf[4];
uint8_t *opt_end = opt + len - 4;
- round_start = adhc6c_get_milli_time();
+ round_start = odhcp6c_get_milli_time();
elapsed = round_start - start;
syslog(LOG_NOTICE, "Got a valid reply after "
"%ums", (unsigned)elapsed);
if (otype == DHCPV6_OPT_SERVERID && olen <= 130) {
memcpy(cand.duid, odata, olen);
cand.duid_len = olen;
- } else if (otype == DHCPV6_OPT_STATUS && olen >= 2 &&
- !odata[0] && odata[1] == DHCPV6_NoAddrsAvail) {
+ } else if (otype == DHCPV6_OPT_STATUS && olen >= 2 && !odata[0]
+ && odata[1] == DHCPV6_NoAddrsAvail) {
if (na_mode == IA_MODE_FORCE) {
return -1;
} else {
cand.has_noaddravail = true;
cand.preference -= 1000;
}
+ } else if (otype == DHCPV6_OPT_STATUS && olen >= 2 && !odata[0]
+ && odata[1] == DHCPV6_NoPrefixAvail) {
+ cand.preference -= 2000;
} else if (otype == DHCPV6_OPT_PREF && olen >= 1 &&
cand.preference >= 0) {
cand.preference = odata[1];
} else if (otype == DHCPV6_OPT_RECONF_ACCEPT) {
cand.wants_reconfigure = true;
- }
- else if (otype == DHCPV6_OPT_IA_PD && request_prefix) {
+ } else if (otype == DHCPV6_OPT_IA_PD && request_prefix) {
struct dhcpv6_ia_hdr *h = (void*)odata;
uint8_t *oend = odata + olen, *d;
dhcpv6_for_each_option(&h[1], oend, otype, olen, d) {
else if (otype == DHCPV6_OPT_STATUS &&
olen >= 2 && d[0] == 0 &&
d[1] == DHCPV6_NoPrefixAvail)
- return -1;
+ cand.preference -= 2000;
}
}
}
if (l_t2 > 0 && t2 > l_t2)
t2 = l_t2;
+ // Always report update in case we have IA_PDs so that
+ // the state-script is called with updated times
+ if (otype == DHCPV6_OPT_IA_PD && request_prefix)
+ have_update = true;
time_t n = dhcpv6_parse_ia(&ia_hdr[1], odata + olen);