[ipxe-devel] DHCP/ProxyDHCP settings ordering bug

Michael Brown mcb30 at ipxe.org
Fri Jun 7 12:28:13 UTC 2013


On 06/06/13 23:37, Alex Williamson wrote:
> When iPXE tries to boot in the above environment, it tries to load
> tftp://10.0.0.1/pxelinux.0 as the boot file.  The next-server comes from
> server1's DHCP packet and filename comes from server2's.  Clearly this
> is wrong.
>
> From what I can gather, this is a result of neither packet having a
> priority and the ordering of adding the settings from the DHCP packet
> before the ProxyDHCP packet.  list_add_tail bites us.  DHCP packets
> don't support reallocation, so I can't add an artificial priority to get
> them in the correct order.  Registering the settings from the ProxyDHCP
> packet before the DHCP packet does work, but it's ugly and prone to
> being broken by changes to the list manipulation code in settings.
> Suggestions?

You could work around it by adding an artifical priority to "net0".  The 
DHCP settings will show up as "net0.dhcp" while the ProxyDHCP settings 
will show up as just "proxydhcp" (outside the scope of "net0"); setting 
"net0/priority" will therefore affect "net0.dhcp" but not "proxydhcp". 
This is an ugly hack and I wouldn't suggest using it, but it can be done.

As for a proper fix: it's difficult to reconcile the conflicting 
requirements of the PXE spec (which conflicts with itself) and iPXE's 
settings model (which incorporates multiple sources of settings not 
envisioned by the PXE spec).  The best solution I can think of off-hand 
would be for fetch_next_server_and_filename() to ensure that both 
next-server and filename come from the same settings block.

This could be done by using fetch_setting_origin() to determine the 
settings block containing the filename and then using that as the 
settings block when fetching next-server.  (As in your example, some 
DHCP servers will provide a spurious next-server defaulting to the DHCP 
server's own IP address; it therefore seems sensible to treat the 
presence of a filename as indicating the intended presence of a 
next-server+filename pair.)

Thoughts?

Michael



More information about the ipxe-devel mailing list