Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Apr 2015 10:40:17 +0200
From:      "J.R. Oldroyd" <fbsd@opal.com>
To:        Kevin Oberman <rkoberman@gmail.com>
Cc:        Yuri <yuri@rawbw.com>, Brooks Davis <brooks@freebsd.org>, "freebsd-net@freebsd.org" <net@freebsd.org>
Subject:   Re: [BUG?] dhclient sends packets with source IP address that has been deleted
Message-ID:  <20150409104017.0cd5c909@shibato>
In-Reply-To: <CAN6yY1t13ogzM9=S2B7m-ac4W2h69EdVwxT7OqXSuga%2B-4MLJQ@mail.gmail.com>
References:  <55234B74.5020506@rawbw.com> <20150407145354.GA9746@spindle.one-eyed-alien.net> <20150408100349.31a74103@shibato> <CAN6yY1t13ogzM9=S2B7m-ac4W2h69EdVwxT7OqXSuga%2B-4MLJQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/Bn1Zy/M7J9lqQOzGibDudTT
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Wed, 8 Apr 2015 20:47:56 -0700 Kevin Oberman <rkoberman@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 syst=
em
> 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.
>=20
> >From the RFC 4.3.2 DHCPREQUEST message:
> 'requested IP address' option MUST be filled in with client's notion of i=
ts
> previously assigned address.
>=20

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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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));
=20
-	if (ip->client->state !=3D S_REQUESTING)
+	if (ip->client->state !=3D S_REQUESTING &&
+	    ip->client->state !=3D S_REBOOTING)
 		memcpy(&from, ip->client->active->address.iabuf,
 		    sizeof(from));
 	else

--Sig_/Bn1Zy/M7J9lqQOzGibDudTT
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUmOvsACgkQls33urr0k4neZQCfUg6I2WmBwYwq+zmg18c5syOV
1UYAnR5ZmrgJPjeVpKYutqfYOunX1pRG
=2g1Q
-----END PGP SIGNATURE-----

--Sig_/Bn1Zy/M7J9lqQOzGibDudTT--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150409104017.0cd5c909>