Bug 479639

Summary: dhclient uses expired lease after resume from suspend/hibernate
Product: [Fedora] Fedora Reporter: Quentin Armitage <quentin>
Component: dhcpAssignee: David Cantrell <dcantrell>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: 11CC: dcantrell, john47ab, jskala, opensource, pknirsch, quentin, richard, wwoods
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 4.1.0p1-2.fc11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-08-25 22:12:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
56dhclient
none
56dhclient
none
Modified 56dhclient following testing
none
Patch to dhcp.spec to install 56dhclient none

Description Quentin Armitage 2009-01-12 10:26:31 UTC
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 10:40:28 UTC
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-05 03:33:23 UTC
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-05 03:35:10 UTC
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-06 03:04:15 UTC
Created attachment 356455 [details]
56dhclient

Updated version of the script.  Same instructions apply.

Comment 5 Till Maas 2009-08-06 09:00:49 UTC
(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 12:50:51 UTC
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 12:52:13 UTC
Created attachment 356499 [details]
Modified 56dhclient following testing

Comment 8 David Cantrell 2009-08-06 20:49:14 UTC
(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 20:53:12 UTC
(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 20:57:25 UTC
(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 21:06:13 UTC
(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 21:40:56 UTC
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 19:30:33 UTC
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 22:12:38 UTC
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 10:54:34 UTC
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 14:27:40 UTC
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.