Bug 1363791 - dhclient does not update routing table after the lease expiry
Summary: dhclient does not update routing table after the lease expiry
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: dhcp
Version: 7.2
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: rc
: ---
Assignee: Pavel Zhukov
QA Contact: Release Test Team
URL:
Whiteboard:
Keywords: EasyFix, Patch
Depends On:
Blocks: 1465887 1465928
TreeView+ depends on / blocked
 
Reported: 2016-08-03 14:50 UTC by Richard D Alloway
Modified: 2018-04-10 08:01 UTC (History)
5 users (show)

(edit)
undefined
Clone Of:
(edit)
Last Closed: 2018-04-10 08:00:52 UTC


Attachments (Terms of Use)
Proposed patch for dhcp-4.2.5-42 (5.04 KB, patch)
2016-08-03 14:50 UTC, Richard D Alloway
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0658 None None None 2018-04-10 08:01 UTC
CentOS 11075 None None None 2016-08-03 14:50 UTC

Description Richard D Alloway 2016-08-03 14:50:56 UTC
Created attachment 1187103 [details]
Proposed patch for dhcp-4.2.5-42

Description of problem:

(At the request of Jiri Popelka, I'm recreating bugs.centos.org ticket 0011075 here)

I run a dhcp-server and push the static routes to the clients, could see routes on the routing table but the problem is with the partial updation on the existing routes. For testing purpose, I had set the lease expiry to minimal time. so after the quick lease expiry,if at all there is a change in the gateway information on dhcp-server, it gets reflected appropriately on the client's leases file but not in the routing table

Below log confirms the renewal happens every defined interval,

Apr 29 13:27:00 dhclient[12270]: DHCPREQUEST on mgmt1 to 192.168.10.2 port 67 (xid=0x2b10e716)
Apr 29 13:27:00 dhclient[12270]: DHCPACK from 192.168.10.2 (xid=0x2b10e716)
Apr 29 13:27:01 dhclient[12270]: bound to 192.168.10.10 -- renewal in 31 seconds.


After the lease updation,

[root@host]# cat /var/lib/dhclient/dhclient-mgmt1.leases
lease {
interface "mgmt1";
fixed-address 192.168.10.10;
option subnet-mask 255.255.255.0;
option routers 192.168.10.1;
option dhcp-lease-time 60;
option dhcp-message-type 5;
option dhcp-server-identifier 192.168.10.2;
option classless-static-routes 32.169.254.169.254 192.168.10.101;
renew 5 2016/04/29 13:40:11;
rebind 5 2016/04/29 13:40:32;
expire 5 2016/04/29 13:40:40;
}

Lease file updation happens properly after the defined expiry interval, but the problem is with classless-static-routes, if there is any change with the parameter ("classless-static-routes" new gateway) leases file holds the updated information but not the routing table, can confirm that from the below table:

[root@]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
169.254.169.254 192.168.10.100 255.255.255.255 UGH 0 0 0 mgmt1

Leases file hold the updated information but routing table is not aware of the change happened within the existing route.


Version-Release number of selected component (if applicable):
dhcp-4.2.5-42

How reproducible:
Always

Steps to Reproduce:
1. setup a dhcp server and enable the option "classless-static-routes"(121).
2. configure static routes.
3. set a minimal lease expiry interval to witness the issue as early as possible
4. after the lease expiry, can see the updated file "/var/lib/dhclient/dhclient-mgmt1.leases" , but the routing table does not have the updated information.
5. manually restarting the "network" service flushes out all existing information and updates routing table as expected.

Actual results:
Updated or deleted routes are not updated or removed on the client.

Expected results:
Updated or deleted routes should be updated or removed on the client.

Additional info:
Default DHCP client version : 
[root@host ~]# dhclient --version
isc-dhclient-4.1.1-P1

Issues seen on other DHCP client versions as well,
(4.3.4, 4.2.8, 4.1-ESV-R13, 4.1.2-P1)

Can get detailed information from the following link:
https://www.centos.org/forums/viewtopic.php?f=16&t=57656



Raised this issue to ISC DHCP team as well their response as follows,


"
Thank you for your report

With the ISC DHCP client the work is split into
two parts. The protocol work is handled by
the dhclient program while updating the OS
is handled by a shell script called by dhclient.

The issues you are describing are in the
area handled by the shell script. The scripts
that we provide are rather generic and so far
as I can see don't include any that try to update
the routing table based on option 121.

The centos distribution may include a different
script that does update the routing tables based
on that option, I wasn't able to find a copy in a quick
search on line.

Given the above, while this may be a bug in the
Centos script it is probably not a bug in the script
supplied with the default client code. I am marking
this ticket as rejected - if you think this is an issue in the
default script you can re-open the ticket by replying to
this mail and include the client script you are using."

Comment 4 Pavel Zhukov 2017-04-10 10:10:46 UTC
Thank you for the report and proposed patch. 
I've checked the default behavior and seems like this bug is not reproducible with NetworkManager [1] which is run by default in RHEL 7. All changes are properly handled by nm_dispatcher without restarting of the service.
Can you please confirm you're using "legacy" networking services (aka /etc/init.d/network)?

Apr 10 11:42:21 client1.bz1354575.example.com NetworkManager[629]: <info>  [1491817341.2902] dhcp4 (eth0):   classless static route 10.100.1.0/24 gw 192.168.77.2
Apr 10 11:46:08 client1.bz1354575.example.com NetworkManager[629]: <info>  [1491817568.1510] dhcp4 (eth0):   classless static route 10.100.1.0/24 gw 192.168.77.3

Comment 5 Richard D Alloway 2017-04-10 13:17:39 UTC
Hi Pavel!

You are correct;  the routes are updated properly with NetworkManager.  The only time this issue is occurs is when "NM_CONTROLLED=no" is used and dhclient is used to manage the network configuration.

While I was investigating the bug report that was filed against CentOS 6, I also checked the CentOS 7 behavior.  Since 7 also had the same issue, I submitted dhcp patches for 6 and 7 at the same time in hopes that the issue could be resolved in both releases. 

In case it is of any help, here is my BZ for CentOS 6 (my patch was included in dhcp-4.1.1-53.P1.el6 for CentOS 6.9):  https://bugzilla.redhat.com/show_bug.cgi?id=1363790

Let me know if I can do anything else to help.

Thanks!

-Rich Alloway (RogueWave)

Comment 15 errata-xmlrpc 2018-04-10 08:00:52 UTC
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.

https://access.redhat.com/errata/RHBA-2018:0658


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