How to configure dhclient to send option#82

Peter Rathlev peter at rathlev.dk
Tue Feb 7 18:47:38 UTC 2012


On Thu, 2012-02-02 at 09:51 +0200, David Ganor wrote:
> I need to configure a dhclient to send option#82 with a specific
> sub-option #9 in the DHCPDiscover and in the DHCPRequest messages.
> 
> I've tried setting this up in the *.conf file without success (.conf
> file is attached): all other set options are sent.

Taking a look at the dhcp-4.2.3-P2 source, in include/dhcp.h option 82
is defined as DHO_DHCP_AGENT_OPTIONS. This is mentioned in
common/options.c in the function "cons_options". The options that the
client should to send seem to be parsed from line 702 and 78 lines
forward.

Every option parsing loop in that section specifically excludes
DHO_DHCP_AGENT_OPTIONS (lines 732, 753, 767+768).

As a test I tried simply adding it explcitely like it's done for
DHO_VENDOR_ENCAPSULATED_OPTIONS:

--- common/options.c	2012-02-07 19:39:57.620496910 +0100
+++ common/options.c.prathlev	2012-02-07 19:39:52.896746785 +0100
@@ -780,0 +781,4 @@
+
+		if (priority_len < PRIORITY_COUNT)
+			priority_list[priority_len++] =
+				DHO_DHCP_AGENT_OPTIONS;

This seems to make the client send the option when using the
configuration file from the original post:

# tcpdump -nneli eth0 -s0 -v
tcpdump: WARNING: eth0: no IPv4 address assigned
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
19:03:42.038225 00:1e:37:8c:1d:fa > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 412: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 398)
    0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:1e:37:8c:1d:fa, length 370, xid 0x7663f25c, Flags [none]
	  Client-Ethernet-Address 00:1e:37:8c:1d:fa
	  Vendor-rfc1048 Extensions
	    Magic Cookie 0x63825363
	    DHCP-Message Option 53, length 1: Discover
	    Lease-Time Option 51, length 4: 7200
	    Hostname Option 12, length 3: "vCM"
	    Parameter-Request Option 55, length 15: 
	      BR, Subnet-Mask, Time-Zone, Time-Server
	      Default-Gateway, LOG, Lease-Time, Server-ID
	      Hostname, MTU, Classless-Static-Route, BF
	      TFTP, Option 122, Option 125
	    Vendor-Class Option 60, length 9: "docsis3.0"
	    Client-ID Option 61, length 6: "^D^R^R ^Q"
	    T125 Option 125, length 14: 0,4491,2305,256,516,0,0
	    Vendor-Option Option 43, length 48: 2.3.118.67.77.4.8.79.108.105.118.101.114.48.49.5.3.49.46.48.6.3.49.46.48.7.3.49.46.48.8.3.1.2.3.9.3.48.46.48.10.6.79.108.105.118.101.114
	    Agent-Information Option 82, length 11: 
	      Unknown SubOption 9, length 9: 
		0x0000:  0000 118b 0402 0201 00

I'm almost certain that this way of manually adding the option is wrong
but I'm not well enough versed in the source code to assess how to do it
right.

-- 
Peter





More information about the dhcp-users mailing list