Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Apr 2015 10:03:49 +0200
From:      "J.R. Oldroyd" <fbsd@opal.com>
To:        Brooks Davis <brooks@freebsd.org>
Cc:        Yuri <yuri@rawbw.com>, net@freebsd.org
Subject:   Re: [BUG?] dhclient sends packets with source IP address that has been deleted
Message-ID:  <20150408100349.31a74103@shibato>
In-Reply-To: <20150407145354.GA9746@spindle.one-eyed-alien.net>
References:  <55234B74.5020506@rawbw.com> <20150407145354.GA9746@spindle.one-eyed-alien.net>

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

On Tue, 7 Apr 2015 14:53:54 +0000 Brooks Davis <brooks@freebsd.org> wrote:
>
> On Mon, Apr 06, 2015 at 08:13:56PM -0700, Yuri wrote:
> > I am observing what dhclient sends to the server. Source IP of the=20
> > packet it sends is the previous DHCP lease. This address doesn't exist=
=20
> > any more, because I manually deleted it with 'ifconfig em0 remove <IP>'=
=20
> > command. Yet, when I rerun dhclient, it takes this address from=20
> > /var/db/dhclient.leases.em0 and sends the UDP packet with this=20
> > non-existent IP as source address in IP header.
> >=20
> > This looks very weird to me, though I am not sure what the practical=20
> > implications of this might be. My guess is that it is able to do this=20
> > because it injects packets with bpf.
> > Should this thing be fixed, or this is harmless?
> >=20
> > Some other host might have this IP address by the time dhclient runs,=20
> > and this might cause confusion somewhere.
>=20
> I suppose that since dhclient has been killed and restarted it can't
> know it's on the same network, but in practice you want to try to get
> the same lease again and fall back if it turns out you've moved or your d=
hcp
> server is broken and lost state.  I don't see how this would hurt anythin=
g.
>=20
> -- Brooks

This bit me, too, some time back, when I was writing some custom dhcpd
back-end scripts.

dhclient is broadcasting (to 255.255.255.255) an initial DHCPREQUEST
to try to re-obtain its old IP.  The old IP is used as the source IP
and the message body also contains the old IP request.

=46rom RFC2131, section 4.1:

   DHCP messages broadcast by a client prior to that client obtaining
   its IP address must have the source address field in the IP header
   set to 0.

Note the "must" there.

So the current behavior looks like an error, to me.

If the re-obtaining of the old IP fails, DHCPDISCOVER messages are
then sent and these do have source 0.0.0.0 which is per the standard.

	-jr

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

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

iEYEARECAAYFAlUk4OoACgkQls33urr0k4kNlwCfR8IXSPnjhyPcLX2UhhmjNox+
9FgAnRBqsJaJU7pSinoBwil7MnnraQUW
=Wq2K
-----END PGP SIGNATURE-----

--Sig_/q39P7DUM2TL0ieEE8Zo497T--



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