Subject: [dhcwg] Any documentation for handling /32 IPv4 assignments from DHCP?

From: Matthew Dempsky <[email-masked]>
Date: Thu, 5 Dec 2013 10:18:18 -0800

In dhcp-4.2.5-P1/client/scripts/linux, there's this code for adding
routes based on the Router (3) and Subnet Mask (1) options:

    for router in $new_routers; do
      if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
        route add -host $router dev $interface
      fi
      route add default gw $router $metric_arg dev $interface
    done

Is this special case logic for subnet_mask==255.255.255.255 codified
anywhere?  I'm working on adding similar logic to OpenBSD's DHCP
client (so OpenBSD can connect to a network currently supported by ISC
DHCP on Linux), but I'm having trouble finding any authoritative
documentation explaining the correct behavior here.

In particular, ISC DHCP 4.2.5-P1 only adds the "dev" route for Router
(3), but I'm wondering if they should be added for Static Route (33)
and/or Classless Static Route Option (121) too?

Thanks

---

From: Alexandru Petrescu <[email-masked]>
Date: Fri, 06 Dec 2013 17:20:06 +0100

Hello Matthew,

I see no other answer, but I have some thoughts.

First, I am not sure why this script is written that way.  When a router 
address is allocated by DHCP ('option routers') it is typically a 
default router, and hence it must have that 'default' qualifier in the 
subsequent route add command.  The first lines of the script would be 
nonsense.

On another hand, one may allocate a prefix (instead of an address), and 
hence it would need that prefix to be reachable through that router.

>          route add -host $router dev $interface

I wonder whether those two lines above have anything to do with IPv4 
Subnet Allocation RFC6656 "Description of Cisco Systems' Subnet 
Allocation Option for DHCPv4" INFORMATIONAL.

> anywhere?

I dont know.

>  I'm working on adding similar logic to OpenBSD's DHCP
> DHCP on Linux),

That is a very good goal.

> but I'm having trouble finding any authoritative

Maybe one would ask the author of that script why did s/he write it that 
way?  Does the script have a author name in the head.

> and/or Classless Static Route Option (121) too?

I dont know.

Alex

>
> Thanks
> _______________________________________________
> dhcwg mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/dhcwg
>
>

---

From: Matthew Dempsky <[email-masked]>
Date: Fri, 6 Dec 2013 11:59:19 -0800

On Fri, Dec 6, 2013 at 8:20 AM, Alexandru Petrescu
<[email-masked]> wrote:
> address is allocated by DHCP ('option routers') it is typically a default
> router, and hence it must have that 'default' qualifier in the subsequent
> route add command.  The first lines of the script would be nonsense.

Oh, sorry, I should have provided some more background information.

On Linux, a command like "route add -host 5.6.7.8 dev eth0" tells the
Linux kernel that IP address 5.6.7.8 is directly addressable via eth0,
even if there's no otherwise appropriate IP/netmask assignment on eth0
that includes 5.6.7.8.

E.g., the network I'm trying to connect to is giving a DHCP lease like
"IP: 1.2.3.4, Subnet Mask: 255.255.255.255, Router: 5.6.7.8".  The
issue is if you simply configure the interface like

    ifconfig eth0 inet 1.2.3.4 netmask 255.255.255.255
    route add default 5.6.7.8

then there's no existing route for 5.6.7.8, so the default route is
rejected as invalid.

ISC DHCP has that extra netmask==255.255.255.255 check so that it
instead executes

    ifconfig eth0 inet 1.2.3.4 netmask 255.255.255.255
    route add -host 5.6.7.8 dev eth0
    route add default 5.6.7.8

which allows the default route to then be added successfully, because
5.6.7.8 is now reachable via eth0 (using srcip 1.2.3.4).  Effectively,
eth0 is now treated as a point-to-point network consisting of only
1.2.3.4 and 5.6.7.8.

> I wonder whether those two lines above have anything to do with IPv4 Subnet
> Allocation RFC6656 "Description of Cisco Systems' Subnet Allocation Option
> for DHCPv4" INFORMATIONAL.

I don't think so.  The network I'm using doesn't send a DHCP response
with option 220, and ISC DHCP doesn't appear to support it either.

> way?  Does the script have a author name in the head.

I'll try tracking down an ISC DHCP author.  (I was kinda hoping maybe
one would be on dhcwg.)

Thanks