Bug 479639 - dhclient uses expired lease after resume from suspend/hibernate
dhclient uses expired lease after resume from suspend/hibernate
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dhcp (Show other bugs)
11
All Linux
low Severity high
: ---
: ---
Assigned To: David Cantrell
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-12 05:26 EST by Quentin Armitage
Modified: 2009-09-14 10:27 EDT (History)
8 users (show)

See Also:
Fixed In Version: 4.1.0p1-2.fc11
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-08-25 18:12:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
56dhclient (2.02 KB, text/plain)
2009-08-04 23:35 EDT, David Cantrell
no flags Details
56dhclient (2.30 KB, text/plain)
2009-08-05 23:04 EDT, David Cantrell
no flags Details
Modified 56dhclient following testing (2.14 KB, text/plain)
2009-08-06 08:52 EDT, Quentin Armitage
no flags Details
Patch to dhcp.spec to install 56dhclient (442 bytes, text/plain)
2009-09-14 10:27 EDT, Quentin Armitage
no flags Details

  None (edit)
Description Quentin Armitage 2009-01-12 05:26:31 EST
Description of problem:
If a system has been resumed following a suspend or hibernate, dhclient does not check if any leases have expired, and if any have, the system continues to use an expired lease.

Version-Release number of selected component (if applicable):
All versions

How reproducible:
Always

Steps to Reproduce:
1.Check the lease expiry time at the end of the /var/lib/dhclient/*.leases file
2.Suspend/hibernate the system
3.Restart the system after the lease expiry time
  
Actual results:
Lease is not renewed, and system continues using expired IP address

Expected results:
Lease should be renewed

Additional info:
The problem appears to relate to the use of select in function omapi_one_dispatch in omapip/dispatch.c, since the timeout does not decrease while the system is not running. A further consequence of this is that even if the lease has not expired when the system resumes, the renewal of the lease will be delayed by the amount of time that the system was suspended.
Comment 1 Bug Zapper 2009-06-09 06:40:28 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 2 David Cantrell 2009-08-04 23:33:23 EDT
This sounds like a script that pm-utils needs to provide in /usr/lib[64]/pm-utils/sleep.d

I'm going to create a script you can drop in /usr/lib[64]/pm-utils/sleep.d that should fix up the problem you are seeing.  Can you try it out and report back whether or not it works?
Comment 3 David Cantrell 2009-08-04 23:35:10 EDT
Created attachment 356265 [details]
56dhclient

Save this attachment and put it in your /usr/lib/pm-utils/sleep.d directory (or /usr/lib64/pm-utils/sleep.d if you are on a 64-bit platform).  No other configuration should be necessary.

This script will down any dhclient-controlled interfaces that are not already controlled by NetworkManager.  On resume, it will bring up only those interfaces that were downed for the suspend operation.
Comment 4 David Cantrell 2009-08-05 23:04:15 EDT
Created attachment 356455 [details]
56dhclient

Updated version of the script.  Same instructions apply.
Comment 5 Till Maas 2009-08-06 05:00:49 EDT
(In reply to comment #2)
> This sounds like a script that pm-utils needs to provide in
> /usr/lib[64]/pm-utils/sleep.d

Please ship this script in dhclient. You don't need to depend on pm-utils for directory ownership, because the directory is owned by filesystem starting with Rawhide. So you can just drop the script there and if pm-utils is installed and used, the script will be used, too.


Btw. instead of the huge sed script, you can use tr for better readability:
tr ABCDEFHLNOPST abcdefhlnopst
Comment 6 Quentin Armitage 2009-08-06 08:50:51 EDT
I have tested the script, and found that a few changes were necessary. Most are obvious, and I think the sed/tr change is only style. However, I found that /sbin/ip link show would show my wireless link (and also lo) in state UNKNOWN following booting the system, and so I have modified the script to work if the state is UNKNOWN as well as UP.

In respect of the conversion from upper to lower case, when I tested the change to tr, I edited the "no" and "dhcp" strings in the ifcfg-eth1 script, so they were upper case, and in that state, the interfaces did not come up with ifup eth1. I therefore assume that the strings are required to be lower case in the ifcfg files, and so the tanslation may be superfluous anyway.

Revised script, which works on my system, is attached.
Comment 7 Quentin Armitage 2009-08-06 08:52:13 EDT
Created attachment 356499 [details]
Modified 56dhclient following testing
Comment 8 David Cantrell 2009-08-06 16:49:14 EDT
(In reply to comment #5)
> (In reply to comment #2)
> > This sounds like a script that pm-utils needs to provide in
> > /usr/lib[64]/pm-utils/sleep.d
> 
> Please ship this script in dhclient. You don't need to depend on pm-utils for
> directory ownership, because the directory is owned by filesystem starting with
> Rawhide. So you can just drop the script there and if pm-utils is installed and
> used, the script will be used, too.

Sounds good.  I did an 'rpm -qf' on the other scripts in /usr/lib[64]/pm-utils/sleep.d and saw that pm-utils owns them.  Or at least the ones I queried, so I assumed that's where it should go.

> Btw. instead of the huge sed script, you can use tr for better readability:
> tr ABCDEFHLNOPST abcdefhlnopst  

Yeah, I know of tr.  I was unsure if the pm-utils scripts could rely on tools in /usr, especially if /usr is NFS mounted.  That's why I went with the ugly sed script.
Comment 9 David Cantrell 2009-08-06 16:53:12 EDT
(In reply to comment #6)
> I have tested the script, and found that a few changes were necessary. Most are
> obvious, and I think the sed/tr change is only style. However, I found that
> /sbin/ip link show would show my wireless link (and also lo) in state UNKNOWN
> following booting the system, and so I have modified the script to work if the
> state is UNKNOWN as well as UP.
> 
> In respect of the conversion from upper to lower case, when I tested the change
> to tr, I edited the "no" and "dhcp" strings in the ifcfg-eth1 script, so they
> were upper case, and in that state, the interfaces did not come up with ifup
> eth1. I therefore assume that the strings are required to be lower case in the
> ifcfg files, and so the tanslation may be superfluous anyway.
> 
> Revised script, which works on my system, is attached.  

Thanks for testing it out and thanks for adding the UNKNOWN state handling too.  Regarding the lowercase conversion, I think I might just drop that based on what you said.

Thanks, guys.
Comment 10 Till Maas 2009-08-06 16:57:25 EDT
(In reply to comment #8)

> Yeah, I know of tr.  I was unsure if the pm-utils scripts could rely on tools
> in /usr, especially if /usr is NFS mounted.  That's why I went with the ugly
> sed script.  

I am not sure if I am missing something like caching, but pm-utils and your script are already placed in /usr.
Comment 11 David Cantrell 2009-08-06 17:06:13 EDT
(In reply to comment #10)
> (In reply to comment #8)
> 
> > Yeah, I know of tr.  I was unsure if the pm-utils scripts could rely on tools
> > in /usr, especially if /usr is NFS mounted.  That's why I went with the ugly
> > sed script.  
> 
> I am not sure if I am missing something like caching, but pm-utils and your
> script are already placed in /usr.  

Oh right.  I'm a moron.  Well, based on the feedback from Quentin, I'm dropping the lowercase conversion anyway.

Thanks.
Comment 12 Fedora Update System 2009-08-06 17:40:56 EDT
dhcp-4.1.0p1-2.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/dhcp-4.1.0p1-2.fc11
Comment 13 Fedora Update System 2009-08-08 15:30:33 EDT
dhcp-4.1.0p1-2.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update dhcp'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-8399
Comment 14 Fedora Update System 2009-08-25 18:12:38 EDT
dhcp-4.1.0p1-2.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 15 John Gray 2009-09-14 06:54:34 EDT
The actual 56dhclient script included in the release contains the following in resume_dhclient():

    cd /etc/sysconfig/network-scripts
    while read device ; do
        /sbin/ifup ${DEVICE}
    done < ${PM_DHCLIENT_SUSPEND}

where this should of course have DEVICE capitalised in the while read:

    cd /etc/sysconfig/network-scripts
    while read DEVICE ; do
        /sbin/ifup ${DEVICE}
    done < ${PM_DHCLIENT_SUSPEND}

The effect of this bug is that the interface is not actually brought up again at all on resume - at least for me - and a usage message for ifup is logged.

I realise that this fix is present in the attachments to this bug, but it's not in the file deployed by the RPM.
Comment 16 Quentin Armitage 2009-09-14 10:27:40 EDT
Created attachment 360956 [details]
Patch to dhcp.spec to install 56dhclient

The effect of the problem identified in comment #15 is somewhat masked by 56dhclient not being installed. The attached patch corrects dhcp.spec so that 56dhclient is installed, rather than 10-dhclient being installed in two different locations.

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