Advance the xid after we consume a DHCPACK or DHCPNAK.

This isn't strictly required by the RFC but it is good practice.
This commit is contained in:
Nicholas J. Kain 2022-08-28 03:40:59 -04:00
parent 6446f80a02
commit d43fc12306
No known key found for this signature in database

View File

@ -223,6 +223,7 @@ static int extend_packet(struct client_state_t *cs,
clibuf, sizeof clibuf); clibuf, sizeof clibuf);
log_line("%s: Server is now offering IP %s. Validating...", log_line("%s: Server is now offering IP %s. Validating...",
client_config.interface, clibuf); client_config.interface, clibuf);
cs->xid = nk_random_u32(&cs->rnd_state);
return ANP_CHECK_IP; return ANP_CHECK_IP;
} else { } else {
log_line("%s: Lease refreshed to %u seconds.", log_line("%s: Lease refreshed to %u seconds.",
@ -231,6 +232,7 @@ static int extend_packet(struct client_state_t *cs,
log_line("%s: Failed to create ARP defense socket.", log_line("%s: Failed to create ARP defense socket.",
client_config.interface); client_config.interface);
stop_dhcp_listen(cs); stop_dhcp_listen(cs);
cs->xid = nk_random_u32(&cs->rnd_state);
return ANP_SUCCESS; return ANP_SUCCESS;
} }
} else if (msgtype == DHCPNAK) { } else if (msgtype == DHCPNAK) {