Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Feb 2018 21:59:23 +0000 (UTC)
From:      David Bright <dab@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330085 - head/sbin/dhclient
Message-ID:  <201802272159.w1RLxNj8038348@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dab
Date: Tue Feb 27 21:59:23 2018
New Revision: 330085
URL: https://svnweb.freebsd.org/changeset/base/330085

Log:
  dhclient violates RFC2131 when sending early DHCPREQUEST message to re-obtain old IP
  
  When dhclient first starts, if an old IP address exists in the
  dhclient.leases file, dhclient(8) sends early DHCPREQUEST message(s)
  in an attempt to re-obtain the old IP address again. These messages
  contain the old IP as a requested-IP-address option in the message
  body (correct) but also use the old IP address as the packet's source
  IP (incorrect).
  
  RFC2131 sec 4.1 states:
  
    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.
  
  The use of the old IP as the packet's source address is incorrect if
  (a) the computer is now on a different network or (b) it is on the
  same network, but the old IP has been reallocated to another host.
  
  Fix dhclient to use 0.0.0.0 as the source IP in this circumstance
  without removing any existing functionality. Any previously-used old
  IP is still requested in the body of an early DHCPREQUEST message.
  
  PR:		199378
  Submitted by:	J.R. Oldroyd <fbsd@opal.com>
  Reported by:	J.R. Oldroyd <fbsd@opal.com>
  Reviewed by:	cem, asomers, vangyzen
  MFC after:	1 week
  Sponsored by:	Dell EMC
  Differential Revision:	https://reviews.freebsd.org/D14527

Modified:
  head/sbin/dhclient/dhclient.c

Modified: head/sbin/dhclient/dhclient.c
==============================================================================
--- head/sbin/dhclient/dhclient.c	Tue Feb 27 21:52:22 2018	(r330084)
+++ head/sbin/dhclient/dhclient.c	Tue Feb 27 21:59:23 2018	(r330085)
@@ -1513,7 +1513,8 @@ cancel:
 		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



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