Bug 55348 - dhcpcd obtains invalid lease upon restart
Summary: dhcpcd obtains invalid lease upon restart
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: dhcpcd
Version: 7.2
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Elliot Lee
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-10-30 00:54 UTC by Patrick J. LoPresti
Modified: 2007-04-18 16:37 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-06-28 17:08:42 UTC
Embargoed:


Attachments (Terms of Use)

Description Patrick J. LoPresti 2001-10-30 00:54:41 UTC
Description of Problem:
If you restart dhcpcd, it obtains a new lease with a negative lease time.

How Reproducible:
Completely.

Steps to Reproduce:
1. Boot a Red Hat 7.2 system which uses dhcpcd to obtain an IP
address.  Examine the /var/state/dhcp/dhcpd.leases file on the DHCP
server to see that the lease looks good.
2. Reboot the system, or just do "/etc/rc.d/init.d/network restart".
3. Look at dhcpd.leases again, remembering that the *last* entry for
any particular lease is the operative one.  Observe that the lease
expires before it was issued.

Actual Results:
The second lease expires before it was issued.

Expected Results:
The second lease should expire at the same time or later than the
first lease.

Additional Information:
If you do "/etc/rc.d/init.d/network stop", then "rm -f /etc/dhcpc/*",
then "/etc/rc.d/init.d/network start", the new lease is correct.  So
this has something to do with dhcpcd's use of its state files when
obtaining a lease.

Our DHCP server is Red Hat 6.2, using the dhcp-2.0-3 RPM.  It has been
serving leases flawlessly for years to 250+ machines of various
operating systems, so I highly suspect this is a problem with the
dhcpcd client.

Note that the DHCP server really does think the lease has expired, and
it is willing to hand out the same IP address to another machine.
This is bad enough that I consider this a "High" severity bug.

Let me know if you require additional information.

Comment 1 Dan Anderson 2001-10-30 08:16:11 UTC
This happened to me too.  I upgraded from RH 7.1 to RH 7.2.
Everything worked perfectly after the upgrade.
I didn't reboot, but restarted all the daemons by hand to make sure things were
going OK.

THEN I REBOOTED.

The system (RH 7.2) hung during booting at this message:
Bringing up interface eth0

Then I booted single user  and did a "init 3".
It still hung.  I broke out of it and reran the "/etc/init.d/network start"
command.  It worked.  Looking further, I see the /etc/init.d/network
startup script hangs at this command:

/sbin/dhcpcd -n eth0

I edited the /etc/sysconfig/network-scripts/ifcfg-eth0 script and disabled
dhcp and enabled static IP addresses.  I can do this as I have a
Linksys DSL router/firewall.  If you can't use static IP addresses
(say because your ISP won't give them one to you), I do NOT recommend
upgrading to RedHat 7.2, at least yet.

If I run "/etc/init.d/network start", then type cntl-c and run it 
(/etc/init.d/network start) again, it works
(i.e., eth0 is configured and I can ping and so on).


Comment 2 Olivier Baudron 2001-12-29 21:56:04 UTC
For the lease time bug, I think the problem is on the dhcp server side.
/etc/dhcpc/dhcpcd-*.cache is only used by dhcpcd to remember the IP adress and
ask for the same one if the PC reboots. Also, there is no notion of absolute
time in dhcpcd. As is said in rfc 2131, the client may ask for a lease time,
represented by an _unsigned_ int (0xffffffff means infinite). So, if the server
assigns an expiration lease time in the past, there is a problem with it.

Comment 3 Elliot Lee 2002-01-04 19:50:35 UTC
If you would care to try some solutions, you can rebuild dhcp-3.0-3 or
dhcpcd-1.3.21pl2-1 from rawhide...

Comment 4 Jason Gilbert 2002-02-14 22:44:06 UTC
<i>As is said in rfc 2131, the client may ask for a lease time,
represented by an _unsigned_ int (0xffffffff means infinite). So, if the server
assigns an expiration lease time in the past, there is a problem with it.
</i>

This is what I assumed.  Most likely your server does not have a
default-lease-time or max-lease-time configured.  dhcpcd must have been changed
to not request a lease time or an infinite lease.  Adding both of these options
worked for me.

I noticed this because I had a script that was updating DNS and wasn't adding
7.2 machines anymore.  I assume the script thought the infinite leases were
actually expired leases.

Works for me now.

jason


Note You need to log in before you can comment on or make changes to this bug.