[ipxe-devel] DHCP - Support of vendor-encapsulated-options ?

Michael Brown mcb30 at ipxe.org
Tue Jun 21 13:07:12 UTC 2016


On 21/06/16 07:18, Agrain Patrick wrote:
> This works well, even for the option 43 (0x2b) defined in the dhcpd.conf file like above.
>
> Now, booting a Mohon Peak with iPXE and the same dhcpd.conf file shows that all option, except 43, are passed to our installer.
>
> Is there a special handling in iPXE and/or in the dhcpd.conf file to get this string passed along with the 'vendor-encapsulated-options' ?

OK, I see the problem now.

Option 43 is an encapsulated-options field for PXE, meaning that the 
contents are expected to conform to the "encapsulated vendor-specific 
extensions" format as defined in RFC2132 section 8.4.

In your configuration, option 43 is not a valid encapsulated-options 
field, and so iPXE ends up treating it as invalid.

The relevant code is in copy_encap_settings() in net/fakedhcp.c.  This 
is the code used to construct the DHCP packets that iPXE exposes via 
PXENV_GET_CACHED_INFO.  As you can see from that code, options 43 and 
175 will be treated as encapsulated-options fields and all other options 
will be copied verbatim.

iPXE does not simply pass through the entire DHCP packet verbatim, 
because it supports functionality such as static IP address assignment. 
  For example, if you use an embedded script containing

   #!ipxe
   ifopen net0
   set net0/ip 192.168.0.100
   set net0/netmask 255.255.255.0
   set net0/gateway 192.168.0.1
   set next-server 192.168.0.1
   set filename pxelinux.0
   chain ${filename}

then pxelinux.0 will call PXENV_GET_CACHED_INFO and will see a 
constructed DHCPACK containing yiaddr = 192.168.0.100, filename = 
pxelinux.0, option 1 (subnet mask) = 255.255.255.0, option 3 (routers) = 
192.168.0.1, etc, even though no DHCP transaction ever took place.

Similarly, you can override individual DHCP options, including 
sub-options of option 43 or option 175.  For example:

   #!ipxe
   dhcp net0
   set net0/43.6:uint8 0x01  # Inhibit PXE boot server broadcast discovery
   chain ${filename}

The simplest solution would be to use the encapsulated-options format 
for your vendor-encapsulated-options field.

Michael



More information about the ipxe-devel mailing list