Bug 769463

Summary: Classless Static Route with 0.0.0.0 GW Fails
Product: [Fedora] Fedora Reporter: James Cape <jamescape777>
Component: dhcpAssignee: Jiri Popelka <jpopelka>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 16CC: jpopelka
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: dhcp-4.2.3-6.P2.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1527995 (view as bug list) Environment:
Last Closed: 2012-01-28 03:32:00 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:
Bug Depends On:    
Bug Blocks: 1527995    

Description James Cape 2011-12-20 22:28:03 UTC
Description of problem:

When providing a classless static route with a 0.0.0.0 next-hop address, dhclient fails. Unfortunately, multicast routes *must* have an empty next-hop address otherwise Linux will send the frame to the gateway, rather than the group MAC address.

The exact issue is at line 430 of dhclient-script, which tests if a gateway is reachable. It should special-case out 0.0.0.0 to allow static routing for link-local addresses (including IPv4 multicast) which will not have a next-hop. DHCPd does not reject these items.

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

dhclient-4.2.3-4.P1.fc16.x86_64

How reproducible:

Always

Steps to Reproduce:
1. Add option 121 to a server
2. Try to get a lease with option 121
  
Actual results:

Routes with a 0.0.0.0 next-hop are not added.

Expected results:

Routes with a 0.0.0.0 next-hop should be added as link-local/gateway-less routes.

Additional info:

Patch to dhclient-script:


--- /sbin/dhclient-script	2011-12-09 15:56:49.000000000 -0500
+++ dhclient-script	2011-12-20 17:12:46.002690685 -0500
@@ -427,7 +427,13 @@
                 fi
                 gateway=${static_routes[$i+1]}
 
-                if is_router_reachable ${gateway}; then
+		if [ "${gateway}" = "0.0.0.0" ]; then
+			valid_gateway=0
+		else
+			is_router_reachable ${gateway}
+			valid_gateway=$?
+		fi
+                if [ ${valid_gateway} -eq 0 ]; then
                     metric=''
                     for t in ${route_targets[@]}; do
                         if [ ${t} = ${target} ]; then

Comment 1 Jiri Popelka 2011-12-21 11:10:34 UTC
Thanks. What about ?

diff --git a/dhclient-script b/dhclient-script
@@ -427,7 +427,8 @@ dhconfig() {
                 fi
                 gateway=${static_routes[$i+1]}
 
-                if is_router_reachable ${gateway}; then
+                if [ "${gateway}" = "0.0.0.0" ] ||
+                   is_router_reachable ${gateway}; then
                     metric=''
                     for t in ${route_targets[@]}; do
                         if [ ${t} = ${target} ]; then

Comment 2 James Cape 2011-12-21 11:28:43 UTC
Looks like it will work. I've coiped/pasted the static routes section into /etc/dhcp/dhclient-up-hook (or whatever it's called), so I'll test with it later today.

Latest dhcpd can be used to test this by doing this:

scope ... {
  // static route for 224.0.0.0/4 to 0.0.0.0
  option classless-static-routes 4.224 0.0.0.0;
}

should end up with:

$ ip route
...
224.0.0.0/4 dev em2  proto static
$ 

on the client.

Comment 3 Fedora Update System 2012-01-23 15:28:18 UTC
dhcp-4.2.3-6.P2.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/dhcp-4.2.3-6.P2.fc16

Comment 4 Fedora Update System 2012-01-23 21:54:36 UTC
Package dhcp-4.2.3-6.P2.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dhcp-4.2.3-6.P2.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-0822/dhcp-4.2.3-6.P2.fc16
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2012-01-28 03:32:00 UTC
dhcp-4.2.3-6.P2.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.