Bug 199378 - [patch] dhclient violates RFC2131 when sending early DHCPREQUEST message to re-obtain old IP
Summary: [patch] dhclient violates RFC2131 when sending early DHCPREQUEST message to r...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: David Bright
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-04-11 14:26 UTC by J.R. Oldroyd
Modified: 2018-03-09 14:40 UTC (History)
1 user (show)

See Also:
dab: mfc-stable11+
dab: mfc-stable10+


Attachments
patch to cause early DHCPREQUEST broadcasts to be sent using source IP 0.0.0.0 (500 bytes, patch)
2015-04-11 14:26 UTC, J.R. Oldroyd
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description J.R. Oldroyd 2015-04-11 14:26:49 UTC
Created attachment 155476 [details]
patch to cause early DHCPREQUEST broadcasts to be sent using source IP 0.0.0.0

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 the message also uses 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.

The attached patch fixes things to use 0.0.0.0 as the source IP without removing any existing functionality.  Any previously-used old IP is still requested in the body of an early DHCPREQUEST message.
Comment 1 commit-hook freebsd_committer freebsd_triage 2018-02-27 22:00:05 UTC
A commit references this bug:

Author: dab
Date: Tue Feb 27 21:59:23 UTC 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

Changes:
  head/sbin/dhclient/dhclient.c
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-03-09 14:38:58 UTC
A commit references this bug:

Author: dab
Date: Fri Mar  9 14:38:47 UTC 2018
New revision: 330692
URL: https://svnweb.freebsd.org/changeset/base/330692

Log:
  MFC r330085:

  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>
  Sponsored by:   Dell EMC

Changes:
_U  stable/11/
  stable/11/sbin/dhclient/dhclient.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-03-09 14:40:01 UTC
A commit references this bug:

Author: dab
Date: Fri Mar  9 14:39:29 UTC 2018
New revision: 330693
URL: https://svnweb.freebsd.org/changeset/base/330693

Log:
  MFC r330085:

  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>
  Sponsored by:   Dell EMC

Changes:
_U  stable/10/
  stable/10/sbin/dhclient/dhclient.c