You are right. RFC 2131 says:
"o DHCPREQUEST generated during INIT-REBOOT state:

    'server identifier' MUST NOT be filled in, 'requested IP address'
    option MUST be filled in with client's notion of its previously
    assigned address. 'ciaddr' MUST be zero. The client is seeking to
    verify a previously allocated, cached configuration. Server SHOULD
    send a DHCPNAK message to the client if the 'requested IP address'
    is incorrect, or is on the wrong network"

and in this case, we don't answer at all. Looks like a bug.

The minimal fix would be to at least send a NAK, forcing client
to fall back to re-negotiating DHCP form the start:



diff -ad -urpN busybox.0/networking/udhcp/dhcpd.c 
busybox.1/networking/udhcp/dhcpd.c
--- busybox.0/networking/udhcp/dhcpd.c  2010-11-27 22:25:51.000000000 +0100
+++ busybox.1/networking/udhcp/dhcpd.c  2010-11-28 21:45:13.000000000 +0100
@@ -584,11 +584,15 @@ o DHCPREQUEST generated during REBINDING
                                 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:


This solution works on 1.13.2.

Another option would be to call send_offer(&packet) and only send_NAK(&packet) if that fails. send_offer() validates the packet before it completes. However send_offer() in the git version returns void :(

Cheers

Grahame Jordan


_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to