Wind River Support Network

HomeDefectsOVP8-462
Fixed

OVP8-462 : dhclient-script does not support default routes in DHCP option 121

Created: Nov 6, 2018    Updated: May 15, 2020
Resolved Date: Mar 31, 2019
Previous ID: LIN8-10031
Found In Version: 8.0.0.27
Fix Version: 8.0.0.30
Severity: Standard
Applicable for: Wind River Linux 8
Component/s: Userspace

Description

We found that the script /sbin/dhclient-script, used by the dhclient program to configure network interfaces based on DHCP data, does not seem to properly handle DHCP option 121.

Steps to Reproduce

OVP project:
--enable-kernel=ovp --enable-rootfs=ovp-kvm --enable-checkout-all-layers=yes --enable-addons=wr-ovp

Option 121 in DHCP is used to specify classless static routes that the client should add. While attempting to add the routes provided by Openstack to our cloud nodes, we get the following error:

++ '[' 7 = 0 ']'
++ '[' 5 -ne 0 ']'
++ mask=0
++ shift
++ '[' 0 -eq 32 ']'
++ '[' 0 -gt 24 ']'
++ '[' 0 -gt 16 ']'
++ '[' 0 -gt 8 ']'
++ destination='-net 10.0.0.0/0'
++ shift
++ gateway=209.67.1.
++ shift
++ shift
++ shift
++ shift
++ route add -net 10.0.0.0/0 gw 209.67.1.
209.67.1.: Host name lookup failure

This is based on the following input:

++ add_routes 32 169 254 169 254 10 209 67 4 0 10 209 67 1

The first route (169.254.169.254/32 via 10.209.67.4) is added successfully, but the second route (10.209.67.1, default) is not added at all.

Looking at the script /etc/dhcp/dhclient-exit-hooks, it does the following:

  # Parse the arguments into a CIDR net/mask string
  if [ $mask -eq 32 ]; then
    destination="-host $1.$2.$3.$4"
    shift; shift; shift; shift
  elif [ $mask -gt 24 ]; then
    destination="-net $1.$2.$3.$4/$mask"
    shift; shift; shift; shift
  elif [ $mask -gt 16 ]; then
    destination="-net $1.$2.$3.0/$mask"
    shift; shift; shift
  elif [ $mask -gt 8 ]; then
    destination="-net $1.$2.0.0/$mask"
    shift; shift
  else
    destination="-net $1.0.0.0/$mask"
    shift
  fi


There is no special handling of the default route here (CIDR mask == 0), causing the script to shift out the initial octet of the default route, and attempt to add a broken route.

Probably the version of this script we are using is too old, so please have a look at a possible update of it.

Example DHCP data (not from same system as the above, but will cause the same issue):

07:54:40.720597 IP (tos 0xc0, ttl 64, id 25197, offset 0, flags [none], proto UDP (17), length 378)
    10.209.44.4.67 > 10.209.44.8.68: [udp sum ok] BOOTP/DHCP, Reply, length 350, xid 0x79252839, Flags [none] (0x0000)
Client-IP 10.209.44.8
Your-IP 10.209.44.8
Server-IP 10.209.44.4
Client-Ethernet-Address fa:16:3e:59:23:0b
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: ACK
Server-ID Option 54, length 4: 10.209.44.4
Lease-Time Option 51, length 4: 180
RN Option 58, length 4: 84
RB Option 59, length 4: 151
Subnet-Mask Option 1, length 4: 255.255.255.224
BR Option 28, length 4: 10.209.44.31
Domain-Name Option 15, length 14: "openstacklocal"
Hostname Option 12, length 16: "host-10-209-44-8"
Default-Gateway Option 3, length 4: 10.209.44.1
Classless-Static-Route Option 121, length 14: (169.254.169.254/32:10.209.44.4),(default:10.209.44.1)
Domain-Name-Server Option 6, length 8: 10.62.158.85,10.216.5.85
MTU Option 26, length 2: 2048 
Live chat
Online