dhcpd: reply with NAK to clients in INIT-REBOOT state w/o existing lease
We were not responding to them at all. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
1c31e9e82b
commit
713d241852
@ -448,9 +448,9 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
/* Get SERVER_ID if present */
|
/* Get SERVER_ID if present */
|
||||||
server_id_opt = udhcp_get_option(&packet, DHCP_SERVER_ID);
|
server_id_opt = udhcp_get_option(&packet, DHCP_SERVER_ID);
|
||||||
if (server_id_opt) {
|
if (server_id_opt) {
|
||||||
uint32_t server_id_net;
|
uint32_t server_id_network_order;
|
||||||
move_from_unaligned32(server_id_net, server_id_opt);
|
move_from_unaligned32(server_id_network_order, server_id_opt);
|
||||||
if (server_id_net != server_config.server_nip) {
|
if (server_id_network_order != server_config.server_nip) {
|
||||||
/* client talks to somebody else */
|
/* client talks to somebody else */
|
||||||
log1("server ID doesn't match, ignoring");
|
log1("server ID doesn't match, ignoring");
|
||||||
continue;
|
continue;
|
||||||
@ -584,11 +584,15 @@ o DHCPREQUEST generated during REBINDING state:
|
|||||||
send_ACK(&packet, lease->lease_nip);
|
send_ACK(&packet, lease->lease_nip);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (server_id_opt) {
|
/* No lease for this MAC, or lease IP != requested IP */
|
||||||
/* client was talking specifically to us.
|
|
||||||
* "No, we don't have this IP for you". */
|
if (server_id_opt /* client is in SELECTING state */
|
||||||
|
|| requested_ip_opt /* client is in INIT-REBOOT state */
|
||||||
|
) {
|
||||||
|
/* "No, we don't have this IP for you" */
|
||||||
send_NAK(&packet);
|
send_NAK(&packet);
|
||||||
}
|
} /* else: client is in RENEWING or REBINDING, do not answer */
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DHCPDECLINE:
|
case DHCPDECLINE:
|
||||||
|
Loading…
Reference in New Issue
Block a user