Hide Forgot
+++ This bug was initially created as a clone of Bug #756490 +++ Description of problem: When dhclient is invoked with the "-1" command line option, and then issues a DHCPDECLINE message it continues to try to obtain a lease. Despite the fact that "-1" should "Try to get a lease once. On failure exit with code 2." (from man page) Version-Release number of selected component (if applicable): dhclient-3.0.5-21.el5 How reproducible: Consistently at customer Steps to Reproduce: 1. Configure a DHCP server to hand out an IP address to clientA. 2. Statically configure clientB with that same IP address. 3. Run 'dhclient -1 -cf /tmp/dhcp.conf -pf /var/run/dhclient.pid -lf /var/lib/dhclient/dhclient.leases eth0' on clientA. Actual results: ClientA detects the duplicate IP address, issues a DHCPDECLINE message, and then continues to try and get a new IP address over and over again, despite the "-1" command line option. Expected results: ClientA detects the duplicate IP address, issues a DHCPDECLINE message, and then stops trying to obtain a lease.
Created attachment 535897 [details] Send DHCPDECLINE and exit(2) when duplicate address has been detected and dhclient was started with '-1'.
It doesn't seem that dhclient DAD's working in dhclient-3.0.5-31.el5, thus I'm unable to reproduce if the dhclient behaves correctly. Here's what I tried on RHEL5.9-Server-20120417.1.n, dhclient-.0.5-31.el5.x86_64: # ip a s dev eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 52:54:00:63:02:ab brd ff:ff:ff:ff:ff:ff # dhclient -1 -pf /var/run/dhclient.pid -lf /var/lib/dhclient/dhclient.leases eth0 Internet Systems Consortium DHCP Client V3.0.5-RedHat Copyright 2004-2006 Internet Systems Consortium. All rights reserved. For info, please visit http://www.isc.org/sw/dhcp/ Listening on LPF/eth0/52:54:00:63:02:ab Sending on LPF/eth0/52:54:00:63:02:ab Sending on Socket/fallback DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5 (xid=0x68886723) DHCPOFFER from 192.168.1.40 DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x68886723) DHCPACK from 192.168.1.40 (xid=0x68886723) bound to 192.168.1.1 -- renewal in 299 seconds. And output from tcpdump running on the client that ran the dhclient: # tcpdump -s0 -vvvni eth0 udp port 67 or udp port 68 or arp tcpdump: WARNING: eth0: no IPv4 address assigned tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 15:27:42.321853 IP (tos 0x10, ttl 16, id 0, offset 0, flags [none], proto: UDP (17), length: 328) 0.0.0.0.bootpc > 255.255.255.255.bootps: [udp sum ok] BOOTP/DHCP, Request from 52:54:00:63:02:ab, length: 300, xid:0x23678868, flags: [none] (0x0000) Client Ethernet Address: 52:54:00:63:02:ab Vendor-rfc1048: DHCP:DISCOVER RQ:192.168.1.1 PR:SM+BR+TZ+DG+DN+NS+HN+YD+YS+NTP+MTU 15:27:42.322348 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto: UDP (17), length: 328) 192.168.1.40.bootps > 192.168.1.1.bootpc: [udp sum ok] BOOTP/DHCP, Reply, length: 300, xid:0x23678868, flags: [none] (0x0000) Your IP: 192.168.1.1 Client Ethernet Address: 52:54:00:63:02:ab Vendor-rfc1048: DHCP:OFFER SID:192.168.1.40 LT:600 SM:255.255.255.0 DN:"example.org" NS:10.34.255.7,10.34.255.6 15:27:42.323497 IP (tos 0x10, ttl 16, id 0, offset 0, flags [none], proto: UDP (17), length: 328) 0.0.0.0.bootpc > 255.255.255.255.bootps: [udp sum ok] BOOTP/DHCP, Request from 52:54:00:63:02:ab, length: 300, xid:0x23678868, flags: [none] (0x0000) Client Ethernet Address: 52:54:00:63:02:ab Vendor-rfc1048: DHCP:REQUEST SID:192.168.1.40 RQ:192.168.1.1 PR:SM+BR+TZ+DG+DN+NS+HN+YD+YS+NTP+MTU 15:27:42.324905 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto: UDP (17), length: 328) 192.168.1.40.bootps > 192.168.1.1.bootpc: [udp sum ok] BOOTP/DHCP, Reply, length: 300, xid:0x23678868, flags: [none] (0x0000) Your IP: 192.168.1.1 Client Ethernet Address: 52:54:00:63:02:ab Vendor-rfc1048: DHCP:ACK SID:192.168.1.40 LT:600 SM:255.255.255.0 DN:"example.org" NS:10.34.255.7,10.34.255.6 Aside from this, notice different xid in UDP packets and xid reported by dhclient itself.
Please scratch the comment #5. The issue was originally reported for version 3.x of dhclient which is part of RHEL5 and I thought that 3.x is what needs to be tested. I have re-verified it on RHEL6.3-20120411.1, dhclient-4.1.1-30.P1.el6. Actual behaviour is correct, dhclient detects that IP address is in use and sends DHCPDECLINE and exits with code 2.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0793.html