[git commit master 1/1] dhcpd: reply with NAK to clients in INIT-REBOOT state w/o existing lease
Denys Vlasenko
vda.linux at googlemail.com
Sun Nov 28 22:01:18 UTC 2010
commit: http://git.busybox.net/busybox/commit/?id=713d241852ec726ad07920476fa18d0f9d455246
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
We were not responding to them at all.
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
networking/udhcp/dhcpd.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index ac77b51..6fb48a1 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -448,9 +448,9 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
/* Get SERVER_ID if present */
server_id_opt = udhcp_get_option(&packet, DHCP_SERVER_ID);
if (server_id_opt) {
- uint32_t server_id_net;
- move_from_unaligned32(server_id_net, server_id_opt);
- if (server_id_net != server_config.server_nip) {
+ uint32_t server_id_network_order;
+ move_from_unaligned32(server_id_network_order, server_id_opt);
+ if (server_id_network_order != server_config.server_nip) {
/* client talks to somebody else */
log1("server ID doesn't match, ignoring");
continue;
@@ -584,11 +584,15 @@ o DHCPREQUEST generated during REBINDING state:
send_ACK(&packet, lease->lease_nip);
break;
}
- if (server_id_opt) {
- /* client was talking specifically to us.
- * "No, we don't have this IP for you". */
+ /* No lease for this MAC, or lease IP != requested IP */
+
+ 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);
- }
+ } /* else: client is in RENEWING or REBINDING, do not answer */
+
break;
case DHCPDECLINE:
--
1.7.2.2
More information about the busybox-cvs
mailing list