}
}
- bool update_state = false;
if (msg == DHCPV4_MSG_DISCOVER || msg == DHCPV4_MSG_REQUEST) {
bool assigned = !!a;
size_t hostlen = strlen(hostname) + 1;
a = NULL;
}
- if (a)
- update_state = true;
-
if (assigned && a)
lease = a;
} else if (msg == DHCPV4_MSG_RELEASE) {
if (a) {
a->valid_until = 0;
- update_state = true;
}
} else if (msg == DHCPV4_MSG_DECLINE) {
memset(a->hwaddr, 0, sizeof(a->hwaddr));
a->valid_until = now + 3600; // Block address for 1h
- update_state = true;
}
- if (update_state)
- dhcpv6_write_statefile();
+ dhcpv6_write_statefile();
return lease;
}
goto out;
update(iface);
- bool update_state = false;
struct dhcpv6_assignment *first = NULL;
dhcpv6_for_each_option(start, end, otype, olen, odata) {
}
a->accept_reconf = accept_reconf;
apply_lease(iface, a, true);
- update_state = true;
} else if (!assigned && a && a->managed_size == 0) { // Cleanup failed assignment
free_dhcpv6_assignment(a);
}
} else if (hdr->msg_type == DHCPV6_MSG_RELEASE) {
a->valid_until = 0;
apply_lease(iface, a, false);
- update_state = true;
} else if (hdr->msg_type == DHCPV6_MSG_DECLINE && a->length == 128) {
a->clid_len = 0;
a->valid_until = now + 3600; // Block address for 1h
- update_state = true;
}
} else if (hdr->msg_type == DHCPV6_MSG_CONFIRM && ia_addr_present) {
// Send NOTONLINK for CONFIRM with addr present so that clients restart connection
response_len += 6;
}
- if (update_state)
- dhcpv6_write_statefile();
+ dhcpv6_write_statefile();
out:
return response_len;