[PATCH] add IP check functionality to udhcpc
Jonas Danielsson
jonas.danielsson at axis.com
Wed Nov 21 13:48:10 UTC 2007
Hi,
as part of a project at Axis I've modified the busybox udhcp client to
make it perform a final check of
the offered IP.
The final check is mentioned in the DHCP rfc as:
The client SHOULD perform a check on the suggested address to
ensure that the address is not already in use. For example, if the
client is on a network that supports ARP, the client may issue an
ARP request for the suggested request. When broadcasting an ARP
request for the suggested address, the client must fill in its own
hardware address as the sender's hardware address, and 0 as the
sender's IP address, to avoid confusing ARP caches in other hosts
on the same subnet. If the network address appears to be in use,
the client MUST send a DHCPDECLINE message to the server. The
client SHOULD broadcast an ARP reply to announce the client's new
IP address and clear any outdated ARP cache entries in hosts on the
client's subnet.
I've added a CONFIGURE_FEATURE_UDHCPC_ARPING to enable this
functionality and
command-line-options -a, --arping to use it. I've also added a -W,
--wait to set how long to wait after sending
the DHCPDECLINE before restarting the discovery process (minimum 10
seconds).
The client uses the arpping function from arpping.c. And I've modified
the arpping function.
Why? The arpping-function performed validation on the arp reply by
checking the target hardware address field in
the arp reply against the client mac address. This will not work when
working with Linux machines.
When the Linux kernel receives an arp probe (arp request with sender ip
0) it will return an arp reply with the target ip field and target
hardware field set to the same as the source fields. I've sent a patch
to the Linux kernel to fix this, the discussion about it
can be seen here: http://thread.gmane.org/gmane.linux.kernel/603586. The
patch has been applied to David Millers tree.
In the discussion I mention the check performed in udhcp arping (and
also dhcpcd from Debian) and got the following response from Alexey
Kuznetov:
"Do not do this. Mainly, because you already know that this does not work
with linux. :-) Logically, target hw address in arp reply is just
a nonsensial redundancy, it should not be checked and even looked at."
So the check of target hardware address in arpping has been removed in
my patch.
Revision used: The patch is from the daily snapshot from 071120.
Is this something you would consider to apply?
- Jonas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-udhcpc-arping.patch
Type: text/x-patch
Size: 8341 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20071121/c20aa116/attachment-0002.bin
More information about the busybox
mailing list