[ipxe-devel] DHCP/ProxyDHCP settings ordering bug
Alex Williamson
alex.williamson at redhat.com
Fri Jun 7 14:45:14 UTC 2013
On Fri, 2013-06-07 at 13:28 +0100, Michael Brown wrote:
> 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.
We'd actually want to de-prioritize net0 though, which I'm not sure we
can do since priority is a uint8_t.
> 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?
I like it. It seems like a good idea in general that next-server should
come from the same settings block as filename. The PXE spec doesn't
specify which to use if both dhcp and proxydhcp packets specify a
filename, so I guess it's just an implementation detail that iPXE would
use net0.dhcp in that case. Thanks,
Alex
More information about the ipxe-devel
mailing list