Bug 498658

Summary: dhclient makes system unresponsive with very short leases
Product: Red Hat Enterprise Linux 5 Reporter: Simon Matter <simon.matter>
Component: dhcpAssignee: Jiri Popelka <jpopelka>
Status: CLOSED ERRATA QA Contact: Alexander Todorov <atodorov>
Severity: medium Docs Contact:
Priority: low    
Version: 5.3CC: atodorov, ovasik
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-30 08:18:52 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
Use 60 seconds as minimum for a lease
none
RPM package patch I use for myself none

Description Simon Matter 2009-05-01 17:50:28 UTC
Created attachment 342132 [details]
Use 60 seconds as minimum for a lease

Description of problem:
When a system running dhclient gets a very short lease, it goes completely crazy and it looks like kind of a DOS.

Version-Release number of selected component (if applicable):
dhcp-3.0.5-18.el5
Note: all ISC dhcp versions seem affected, I have checked dhcp-4.1.1b1 and it seems to do exactly the same.

How reproducible:

Steps to Reproduce:
1. Configure a dhcp server with 'dhcp-lease-time 2'
2. Start 'dhclient' on a client
  
Actual results:
The client tries to renew it's lease in a loop as fast as it can. The network connection becomes almost unusable and the system becomes almost unresponsive. Of course dhclient floods the clients log and may quickly fill the /var filesystem. The system spends much time running dhclient-script for every request. The whole thing looks like a DOS.
As a side effect the same log flooding happens on the server - but he gets what he deserves.

Expected results:
dhclient should add a sanity check to make sure it doesn't bring the system down when getting short leases. The OpenBSD and other BSD folks have done so and they seems to live well with it: http://www.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c.diff?r1=1.57;r2=1.58;f=h

Additional info:
AFAIK DHCP doesn't define a minimum lease time. However, it's not good that a badly configured DHCP server can melt down it's clients so easy. I have seen this kind of 2 second leases on mobile broadband networks (GPRS/UMTS/HDSPA). I usually get leases of about 300 seconds but from time to time it is reduced to 2 seconds for whatever reason.
If, in a large corporat network, someone is able to run it's own DHCP server and configures 'dhcp-lease-time 2' on it, he may be able to make a lot of machines unusable very quickly. It just looks too easy to me.
Attached patch derived from OpenBSD uses a minimum of 60 seconds for it's lease which means it starts renewing it every ~27 seconds.

Comment 1 Simon Matter 2009-05-01 17:53:45 UTC
Created attachment 342134 [details]
RPM package patch I use for myself

Comment 2 Alexander Todorov 2010-01-26 13:49:13 UTC
Jiri,
what's the minimum max-lease-time value below which we'd like the client application to update it's lease every 30 seconds or so? I.e. if max-lease-time==10 how often should the client update?

Comment 3 Jiri Popelka 2010-01-26 13:59:05 UTC
I agree with minimum lease time set to 60 seconds.
When the server is configured with max-lease-time less then 60 seconds, client
uses 60 seconds for his lease time, which means it starts renewing it every ~27
seconds.

Comment 5 RHEL Program Management 2010-01-26 15:12:15 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 7 Alexander Todorov 2010-02-23 18:22:14 UTC
Tested with dhclient-3.0.5-23.el5 and a server configured with max-lease-time 2. 
The client is renewing its address every 30 seconds or so which matches the described behavior above. 

Just FYI the client in RHEL 5.4 was renewing the leases every 0-1 seconds. 

Moving to VERIFIED.

Comment 9 errata-xmlrpc 2010-03-30 08:18:52 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0223.html