Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 342953

Summary: net-misc/dhcp: rfc3442 (classless static routes) not supported
Product: Gentoo Linux Reporter: Alex Efros <powerman-asdf>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: CONFIRMED ---    
Severity: enhancement CC: alexanderyt
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: add request rfc3442-classless-static-routes
update routing from $new_rfc3442_classless_static_routes
update routing from $new_rfc3442_classless_static_routes
/etc/dhcp/dhclient-exit-hooks

Description Alex Efros 2010-10-27 17:18:10 UTC
Our ISP use DHCP server which send static routes to it local network using "classless_static_routes" and default route to Internet using usual "routers", and this is usual enough setup. Here is example (from dhcpcd -T output):

    new_classless_static_routes='10.0.0.0/8 10.235.144.1 192.168.0.0/16 10.235.144.1 193.138.244.0/22 10.235.144.1'
    new_routers=10.235.144.1

Current situation, as far as I understand it, is:
1) RFC3442 require DHCP clients to ignore "routes" if "classless_static_routes" used (for example, see comment 7 in bug 175053).
2) Microsoft, as usually, violate RFC, and apply both.
3) ISP must incorrectly setup DHCP servers to be compatible with Windows.
4) Some Linux distributions (like Ubuntu) also choose to violate RFC3442 in their DHCP clients to be compatible with these ISP (and because of this ISP sure they are going in right way, and only broken thing in the world is Gentoo).
5) dhcpcd is only Linux DHCP client supporting RFC3442, but it doesn't violate RFC and because of this it doesn't compatible with such ISP.
6) dhclient doesn't support RFC3442, but using special configuration we can implement RFC3442 support, even in way which compatible with such ISP.

I've prepared such configuration for dhclient (based on script from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=396545) and will attach it. Probably instead of using separate hook it have sense to update /sbin/dhclient-script.

I think such feature is critical enough and should be supported by default.

Reproducible: Always

Steps to Reproduce:
1. Run dhcpd with this config:

  option classless-static-routes code 121 = string;
  subnet 192.168.2.0 netmask 255.255.255.0 {
    range 192.168.2.200 192.168.2.250;
    option routers 192.168.2.1;
    option classless-static-routes = 18:c0:a8:03:c0:a8:02:01;
  }

2. try to apply both default and static routes using dhcpcd or dhclient
3.
Actual Results:  
- dhcpcd apply only static routes to ISP local network and doesn't set default route at all
- dhclient apply only default route and ignore static routes to ISP local network

Expected Results:  
RFC should be violated and all routes must be configured. :(
Comment 1 Alex Efros 2010-10-27 17:21:10 UTC
Created attachment 252251 [details]
add request rfc3442-classless-static-routes
Comment 2 Alex Efros 2010-10-27 17:22:28 UTC
Created attachment 252253 [details]
update routing from  $new_rfc3442_classless_static_routes
Comment 3 Alex Efros 2010-10-27 18:40:27 UTC
Created attachment 252279 [details]
update routing from $new_rfc3442_classless_static_routes

sorry, I forget to delete debug output to temp file from script
Comment 4 nE0sIghT 2014-07-07 18:10:04 UTC
Created attachment 380400 [details]
/etc/dhcp/dhclient-exit-hooks

I'm suggest to support Microsoft static classless routes as well.

Attached updated hook for dhcp that supports both classless routes options and using iproute2 or net-tools to update routes table.

/etc/dhcp/dhclient.conf must contains this lines:

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
option ms-classless-static-routes code 249 = array of unsigned integer 8;

request rfc3442-classless-static-routes, ms-classless-static-routes;
Comment 5 cilly 2014-12-03 10:45:14 UTC
(In reply to nE0sIghT from comment #4)
> Created attachment 380400 [details]
> /etc/dhcp/dhclient-exit-hooks
> 
> I'm suggest to support Microsoft static classless routes as well.
> 
> Attached updated hook for dhcp that supports both classless routes options
> and using iproute2 or net-tools to update routes table.
> 
> /etc/dhcp/dhclient.conf must contains this lines:
> 
> option rfc3442-classless-static-routes code 121 = array of unsigned integer
> 8;
> option ms-classless-static-routes code 249 = array of unsigned integer 8;
> 
> request rfc3442-classless-static-routes, ms-classless-static-routes;

Getting the following log entries with above settings:

Dec  3 11:33:02 pluto dhclient: option unknown-121 has been redefined as option rfc3442-classless-static-routes.  Please update your configs if neccessary.
Dec  3 11:33:02 pluto dhclient: /var/lib/dhcp/dhclient.leases line 10: semicolon expected.
Dec  3 11:33:02 pluto dhclient:   option unknown-121 20:
Dec  3 11:33:02 pluto dhclient:                         ^
Dec  3 11:33:03 pluto dhclient: DHCPDISCOVER on wan0.8 to 255.255.255.255 port 67 interval 3
Dec  3 11:33:06 pluto dhclient: DHCPDISCOVER on wan0.8 to 255.255.255.255 port 67 interval 3
Dec  3 11:33:06 pluto dhclient: DHCPREQUEST on wan0.8 to 255.255.255.255 port 67
Dec  3 11:33:06 pluto dhclient: DHCPOFFER from 10.232.127.254
Dec  3 11:33:06 pluto dhclient: DHCPACK from 10.232.127.254
Dec  3 11:33:06 pluto dhclient: bound to 10.232.99.220 -- renewal in 39698 seconds.

cat /var/lib/dhcp/dhclient.leases
lease {
  interface "wan0.8";
  fixed-address 10.232.99.220;
  server-name "DHMUN001";
  option subnet-mask 255.255.192.0;
  option dhcp-lease-time 86400;
  option dhcp-message-type 5;
  option dhcp-server-identifier 193.158.134.249;
  option dhcp-renewal-time 43200;
  option dhcp-rebinding-time 75600;
  renew 3 2014/11/26 19:34:18;
  rebind 3 2014/11/26 19:34:18;
  expire 3 2014/11/26 19:34:18;
}
lease {
  interface "wan0.8";
  fixed-address 10.232.99.220;
  server-name "DHMUN001";
  option subnet-mask 255.255.192.0;
  option dhcp-lease-time 86400;
  option dhcp-message-type 5;
  option dhcp-server-identifier 193.158.134.249;
  option dhcp-renewal-time 43200;
  option dhcp-rebinding-time 75600;
  option rfc3442-classless-static-routes 32,193,158,134,249,10,232,127,254,17,87,141,128,10,232,127,254;
  renew 3 2014/12/03 21:34:44;
  rebind 4 2014/12/04 07:33:06;
  expire 4 2014/12/04 10:33:06;
}

Where is the missing semicolon in line 10?
Comment 6 nE0sIghT 2015-01-18 19:05:14 UTC
(In reply to cilly from comment #5)
> 
> Getting the following log entries with above settings:

I think you must clean /var/lib/dhcp/dhclient.leases and just get new dhcp lease