[BUG?] dhclient sends packets with source IP address that has been deleted

J.R. Oldroyd fbsd at opal.com
Thu Apr 9 08:56:18 UTC 2015


On Wed, 8 Apr 2015 20:47:56 -0700 Kevin Oberman <rkoberman at gmail.com> wrote:
>
The
> idea is that a system should attempt to maintain the same address, if
> possible. That is why the dhclient.leases files are there. Even if a system
> has its interface shut down or is rebooted, the file contains the last
> assigned address. If it issues a request and the network is different, it
> will not get the address. If it is on the same network, it will get it's
> old address.
> 
> >From the RFC 4.3.2 DHCPREQUEST message:
> 'requested IP address' option MUST be filled in with client's notion of its
> previously assigned address.
> 

The data from the leases file is used to fill in the requested IP
address in the message body.  The source address of the packet should
be set to 0.

The fix appears to be pretty trivial:

Index: sbin/dhclient/dhclient.c
===================================================================
--- sbin/dhclient/dhclient.c	(revision 280783)
+++ sbin/dhclient/dhclient.c	(working copy)
@@ -1460,7 +1460,8 @@
 		memcpy(&to.s_addr, ip->client->destination.iabuf,
 		    sizeof(to.s_addr));
 
-	if (ip->client->state != S_REQUESTING)
+	if (ip->client->state != S_REQUESTING &&
+	    ip->client->state != S_REBOOTING)
 		memcpy(&from, ip->client->active->address.iabuf,
 		    sizeof(from));
 	else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20150409/45f334e7/attachment.sig>


More information about the freebsd-net mailing list