Hello,

I ran into problems lately with using udhcpd with
ENABLE_FEATURE_UDHCPC_ARPING enabled. Most times the DHCP-client uses
the IP-address given by the server, but in some cases it was rejected
with a DHCP-DECLINE message. I checked the code and found that in
dhcpc.c:1417 the check is performed.
There is a call to arpping() which checks whether or not the IP given by
the server is in use.

   if (!arpping(packet.yiaddr,
           NULL,
           (uint32_t) 0,
           client_config.client_mac,
           client_config.interface)
   ) {
        bb_info_msg("Offered address is in use "
        "(got ARP reply), declining");
        send_decline(xid, server_addr, packet.yiaddr);
        ...

Now look at the second parameter of arpping() which is NULL. If you look
into the code of arpping.c you can see that this is the parameter
safe_mac, a pointer in fact. In arpping.c:115 a check is performed,
whether or not safe_mac is NULL, if not a memcmp is done:

   if (!safe_mac || memcmp(safe_mac, arp.sHaddr, 6) != 0)
        rv = 0;

If safe_mac is NULL, the if-statement will always be true and reset rv
from 1 to 0 which leads the client send its DECLINE. I asume this is not
the intend. In the cas safe_mac is NULL, no memcmp should be done, but
also rv should remain 1. Especially as the comment above dhcpc:1417
says: "...
At this point, the client is configured. If the client detects that ...".
For my understanding this means that an ARP-reply will be received
normally from ourself.

I'm not into the whole ARP and DHCP stuff, am I right so far or did I
miss some protocol things? What I don't understand is, that it works
most time.
I'm also pretty sure that the DHCP-server was right and no one else uses
this IP. If I'm right so far, can somebody explain me why its working
the most time?
Thank you!


Best regards

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

Reply via email to