[settings] Allow "set" command to take an empty value
Allow "set <variable>" to be used to set the variable to an empty
value, if permitted by the setting type. Note that some settings
backends do not differentiate between an empty value and a
non-existent value, so this may or may not be equivalent to "clear
<variable>".
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[autoboot] Merge "netboot" command into "autoboot"
Allow "autoboot" to accept an optional list of network devices, and
remove the "netboot" command. This saves around 130 bytes.
The "netboot" command has existed for approximately 48 hours, so its
removal should not cause backwards compatibility issues for anyone.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
The "isset" command can be used to determine whether or not a setting
is present. For example:
isset ${net0/ip} || dhcp net0 # If we have no IP address, try DHCP
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Allow script labels to be defined using the syntax
:<labelname>
(nothing else allowed on the line, including whitespace). Labels are
ignored during script execution, but can be used as the target of the
"goto" command. For example:
#!ipxe
goto machine_${net0/ip} || goto machine_default
# Linux kernel boot
:machine_10.0.0.101
:machine_10.0.0.102
set filename http://my.boot.server/vmlinuz
goto done
# Default configuration
:machine_default
set filename pxelinux.0
goto done
# Boot selected configuration
:done
chain ${filename}
Originally-implemented-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Originally-implemented-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[cmdline] Add trivial logical operators to iPXE command lines
Make the "||" and "&&" operators available within iPXE commands. For
example:
dhcp net0 || set net0/ip 192.168.0.2
would attempt to acquire an IP address via DHCP, falling back to a
static address if DHCP fails.
As a side-effect, comments may now be appended to any line. For
example:
dhcp net0 || set net0/ip 192.168.0.2 # Try DHCP first, then static
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[pxe] Remove startpxe and stoppxe commands from default builds
These commands exist primarily for debugging and are not generally
useful, so save 137 bytes by removing them by default.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Command implementations tend to include a substantial amount of common
boilerplate code revolving around the parsing of command-line options
and arguments. This increases the size cost of each command.
Introduce an option-parsing library that abstracts out the common
operations involved in command implementations. This enables the size
of each individual command to be reduced, and also enhances
consistency between commands.
Total size of the library is 704 bytes, to be amortised across all
command implementations.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[netdevice] Allow per-device receive queue processing to be frozen
Several use cases (e.g. the UNDI API and the EFI SNP API) require
access to the raw network device receive queue, and so currently use
manual calls to netdev_poll() on a specific network device in order to
prevent received packets from being processed by the network stack.
As an alternative, provide a flag that allows receive queue processing
to be frozen on a per-device basis. When receive queue processing is
frozen, packets will be enqueued as normal, but will not be
automatically dequeued and passed up the network stack.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[undi] Support underlying UNDI devices that don't support interrupts
Some network cards do not generate interrupts when operated via the
UNDI API. Allow for this by waiting for the ISR to be triggered only
if the PXE stack advertises that it supports interrupts. When the PXE
stack does not advertise interrupt support, we skip the call to
PXENV_UNDI_ISR_IN_START and just poll the device using
PXENV_UNDI_ISR_IN_PROCESS. This matches the observed behaviour of at
least one other PXE NBP (emBoot's winBoot/i), so there is a reasonable
chance of this working.
Originally-implemented-by: Muralidhar Appalla <Muralidhar.Appalla@emulex.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Provide a "hexhyp" setting type, which functions identically to the
"hex" setting type except that it uses a hyphen instead of a colon as
the byte delimiter.
For example, if ${mac} expands to "52:54:00:12:34:56", then
${mac:hexhyp} will expand to "52-54-00-12-34-56".
Originally-implemented-by: Jarrod Johnson <jarrod.b.johnson@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[forcedeth] Exit poll() as early as possible if no work to do
Fix incorrect authorship attribution on commit f122515 ("[forcedeth]
Exit poll() as early as possible if no work to do").
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[list] Fix typographical error from previous commit
Fix typographical error from commit ea631f6 ("[list] Add
list_first_entry()"). The symptom was PXELINUX 3.86 causing a stack
overflow under VMware.
Tested-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Allow fc_ulp_decrement() to guarantee to fc_peer_decrement() that the
peer reference remains valid for the duration of the call, by ensuring
that ulp->peer remains valid while ulp is valid.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[fc] Hold reference to peers and ULPs while calling fc_link_examine()
Allow link examination methods to safely assume that their
self-reference remains valid for the duration of the method call.
Signed-off-by: Michael Brown <mcb30@ipxe.org>