[gPXE] PATCH: Allow "dhcp" command to iterate over multiple interfaces like autoboot()
Stefan Hajnoczi
stefanha at gmail.com
Sat Jul 24 13:58:03 EDT 2010
On Fri, Jul 23, 2010 at 2:47 AM, Lars Kellogg-Stedman <lars at oddbit.com> wrote:
> Hello all,
>
> I was reading http://www.etherboot.org/wiki/appnotes/autobootchainurl,
> and figured that as long as I was going to be modifying the code I
> might as well try a cleaner solution. Attached to this message is a
> patch that makes the following changes:
>
> 1) Allow the "dhcp" command to accept a list of interfaces and to try
> them in order until it succeeds, e.g.:
>
> gPXE> dhcp net0 net1 net2
>
> In order to preserve the original syntax of the command, this will
> fail on an unknown interface name:
>
> gPXE> dhcp foo net0
> No such interface: foo
> gPXE>
>
> The "-c" flag allows it to continue:
>
> gPXE> dhcp -c foo net0
> No such interface: foo
> DHCP (net0 xx:xx:xx:xx:xx:xx).... ok
> gPXE>
Can you explain why -c is necessary to stay compatible with the
current command? The current command takes one argument and fails if
the interface doesn't exist.
The new command would still behave correctly even without '-c':
gPXE> dhcp foo
No such interface: foo
[at this point there are no more interfaces left to try so return failure]
> 2) If given the single parameter "any" as an interface name, iterate
> over all known interfaces in a manner similar to autoboot():
>
> gPXE> dhcp any
> DHCP (net0 xx:xx:xx:xx:xx:xx)........ Connection timed out (...)
> Could not configure net0: Connection timed out (...)
> DHCP (net1 xx:xx:xx:xx:xx:xx).... ok
> gPXE>
>
> I think this manages to preserve the syntax of the existing "dhcp"
> command while making the magic of autoboot available to gpxe scripts.
> Please let me know if you have any comments. This code has only had
> limited testing, and I'm not terribly familiar with the gPXE code
> base. Please excuse any stylistic problems; I'd be happy to fix
> anything that needs fixing.
I think this is a useful enhancement.
Stefan
More information about the gPXE
mailing list