Minor changes to log messages and comments.

This commit is contained in:
Nicholas J. Kain 2015-02-18 09:56:38 -05:00
parent 3ede5fbe33
commit a627e9dc9c

View File

@ -245,19 +245,20 @@ static int extend_packet(struct client_state_t cs[static 1],
return ANP_IGNORE; return ANP_IGNORE;
get_leasetime(cs, packet); get_leasetime(cs, packet);
// Only check if we are either in the REQUESTING state, or if we // Did we receive a lease with a different IP than we had before?
// have received a lease with a different IP than what we had before.
if (memcmp(&packet->yiaddr, &cs->clientAddr, 4)) { if (memcmp(&packet->yiaddr, &cs->clientAddr, 4)) {
char clibuf[INET_ADDRSTRLEN]; char clibuf[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &(struct in_addr){.s_addr=cs->clientAddr}, inet_ntop(AF_INET, &(struct in_addr){.s_addr=cs->clientAddr},
clibuf, sizeof clibuf); clibuf, sizeof clibuf);
log_line("%s: Accepted a firm offer for %s. Validating...", log_line("%s: Server is now offering IP %s. Validating...",
client_config.interface, clibuf); client_config.interface, clibuf);
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.",
client_config.interface, cs->lease); client_config.interface, cs->lease);
arp_set_defense_mode(cs); // XXX: Can return error: fail to open if (arp_set_defense_mode(cs) < 0)
log_warning("%s: Failed to create ARP defense socket.",
client_config.interface);
stop_dhcp_listen(cs); stop_dhcp_listen(cs);
return ANP_SUCCESS; return ANP_SUCCESS;
} }