summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* [parseopt] Add parse_setting()Michael Brown2013-07-222-1/+70
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Move parse_settings() to parseopt.cMichael Brown2013-07-223-23/+25
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Allow parsed option to be modifiedMichael Brown2013-07-226-26/+25Star
| | | | | | | Parsing a setting name requires the ability to modify the text being parsed. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Remove now-unused store_named_setting()Michael Brown2013-07-192-48/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Eliminate call to store_named_setting() in nslookup.cMichael Brown2013-07-191-6/+17
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Eliminate call to fetchf_named_setting() in expand_settings()Michael Brown2013-07-191-22/+25
| | | | | | | | | | Use parse_setting_name() and fetchf_setting_copy() in expand_settings(), to eliminate the call to fetchf_named_setting(). This change also eliminates the potentially large stack-allocated buffer in expand_settings(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add fetchf_setting_copy()Michael Brown2013-07-192-2/+41
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Change "not-found" semantics of fetch_setting_copy()Michael Brown2013-07-193-47/+8Star
| | | | | | | | | | | | | | | | | | | | | | | | | fetch_settings_copy() currently returns success and a NULL data pointer to indicate a non-existent setting. This is intended to allow the caller to differentiate between a non-existent setting and an error in allocating memory for the copy of the setting. The underlying settings blocks' fetch() methods provide no way to perform an existence check separate from an attempt to fetch the setting. A "non-existent setting" therefore means simply a setting for which an error was encountered when attempting to fetch from every settings block within the subtree. Since any underlying error within a settings block (e.g. a GuestRPC failure when attempting to retrieve a VMware GuestInfo setting) will produce the effect of a "non-existent setting", it seems somewhat meaningless to give special treatment to memory allocation errors within fetch_setting_copy(). Remove the special treatment and simplify the semantics of fetch_setting_copy() by directly passing through any underlying error (including non-existence) encountered while fetching the setting. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Expose parse_setting_name()Michael Brown2013-07-192-12/+13
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Remove default_type parameter from parse_setting_name()Michael Brown2013-07-191-9/+20
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Remove temporary name buffer parameter from parse_setting_name()Michael Brown2013-07-181-22/+40
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Avoid potentially large stack allocationsMichael Brown2013-07-181-26/+43
| | | | | | | Avoid potentially large stack allocations in fetchf_setting() and storef_setting(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Clarify usage of the term "named setting"Michael Brown2013-07-184-17/+16Star
| | | | | | | | | | | | There are currently two conflicting usages of the term "named setting" within iPXE: one refers to predefined settings (such as show up in the "config" UI), the other refers to settings identified by a name (such as "net0.dhcp/ip"). Split these usages into the term "predefined setting" and "named setting" to avoid ambiguity. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Fix %.licence build targetMichael Brown2013-07-167-13/+31
| | | | | | | | | | | | | | | | | | | | | | | | Our use of --gc-sections causes the linker to discard the symbols defined by FILE_LICENCE(), meaning that the resulting licence determination is incomplete. We must use the KEEP() directive in the linker script to force the linker to not discard the licence symbols. Using KEEP(*(COMMON)) would be undesirable, since there are some symbols in COMMON which we may wish to discard. Fix by placing symbols defined by PROVIDE_SYMBOL() (which is used by FILE_LICENCE()) into a special ".provided" section, which we then mark with KEEP(). All such symbols are zero-length, so there is no cost in terms of the final binary size. Since the symbols are no longer in COMMON, the linker will reject symbols with the same name coming from multiple objects. We therefore append the object name to the licence symbol, to ensure that it is unique. Reported-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add missing FILE_LICENCE declarationsMichael Brown2013-07-162-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [script] Avoid trying to read final character of a zero-length stringMichael Brown2013-07-151-2/+2
| | | | | | Detected using Valgrind. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [nfs] Add support for NFS protocolMarin Hannache2013-07-1521-5/+2238
| | | | | | Tested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ifmgmt] Avoid relying on global variable within ifcommon_exec()Michael Brown2013-07-151-4/+3Star
| | | | | | | | | | | | | | | The getopt API defines optind as a global variable. When used by the "autoboot" command, the payload function passed to ifcommon_exec() may result in a new iPXE script being executed; the commands therein would then overwrite the value of optind. On returning, ifcommon_exec() would continue processing the list of interfaces from an undefined point. Fix by using a local variable to hold the index within the list of interfaces. Reported-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Include ipxe.pxe in default buildRobin Smidsrød2013-07-151-1/+1
| | | | | Signed-off-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Add "poweroff" commandMarin Hannache2013-07-159-0/+226
| | | | | | Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add missing FILE_LICENCE declarationsMarin Hannache2013-07-1511-0/+22
| | | | | Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Allow extra space in RX buffersMichael Brown2013-07-151-1/+2
| | | | | | | | | | | Some hardware (observed with an onboard RTL8168) will erroneously report a buffer overflow error if the received packet exactly fills the receive buffer. Fix by adding an extra four bytes of padding to each receive buffer. Debugged-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add support for navigation keys in "config" user interfaceMichael Brown2013-07-151-9/+27
| | | | | | | | Add support for page up, page down, home and end keys, matching the navigation logic used in the menu user interface. Originally-implemented-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [velocity] Rewrite VIA Velocity driverAdrian Jamróz2013-07-155-3860/+1164Star
| | | | | | | Signed-off-by: Adrian Jamróz <adrian.jamroz@gmail.com> Modified-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [script] Allow for backslash continuation of script linesMichael Brown2013-07-151-13/+41
| | | | | | | | | | | Allow long script lines to be broken up using backslash continuation. For example: choose --default linux --timeout 3000 os \ && goto boot_${os} || goto cancelled Requested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Report RX error detail in debug messagesMichael Brown2013-07-151-3/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [base16] Ensure base16_encode() always terminates its result stringMichael Brown2013-07-151-0/+4
| | | | | | | | | | | | | base16_encode() will fail to generate a terminating NUL if the length of the raw data is zero, since the loop calling sprintf() will never execute. Fix by explicitly terminating the result with a NUL. Reported-by: Marin Hannache <git@mareo.fr> Debugged-by: Marin Hannache <git@mareo.fr> Tested-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add FILE_LICENCE for ath9k driver headersMarin Hannache2013-07-1413-0/+26
| | | | | | Signed-off-by: Marin Hannache <git@mareo.fr> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add FILE_LICENCE for core/errno.cMarin Hannache2013-07-141-0/+2
| | | | | Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add FILE_LICENCE for valgrind headersMarin Hannache2013-07-142-0/+4
| | | | | Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linux] Add missing #include <stddef.h>Marin Hannache2013-07-142-0/+2
| | | | | Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Incorporate ring producer and consumer counters in diagnosticsMichael Brown2013-07-141-1/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rhine] Rewrite VIA Rhine driverAdrian Jamróz2013-07-144-1448/+1038Star
| | | | | | | | | | | | | | | | | | | | | | | Replace the old via-rhine driver with a new version using the iPXE API. Includes fixes by Thomas Miletich for: - MMIO access - Link detection - RX completion in RX overflow case - Reset and EEPROM reloading - CRC stripping - Missing cpu_to_le32() calls - Missing memory barriers Signed-off-by: Adrian Jamróz <adrian.jamroz@gmail.com> Modified-by: Thomas Miletich <thomas.miletich@gmail.com> Tested-by: Thomas Miletich <thomas.miletich@gmail.com> Tested-by: Robin Smidsrød <robin@smidsrod.no> Modified-by: Michael Brown <mcb30@ipxe.org> Tested-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [lotest] Include sequence number within loopback test packetsMichael Brown2013-07-141-8/+18
| | | | | | | | Include a sequence number as the first four bytes of the loopback test packet payload. When a content mismatch occurs, this gives some information about the source of the mismatched packet. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add "version" builtin settingRobin Smidsrød2013-07-131-0/+22
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Accept "netX" in iPXE commandsMichael Brown2013-07-131-0/+5
| | | | | | | Allow any iPXE command expecting a network device name to accept "netX" as a synonym for "most recently opened network device". Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Make "netX" settings block function as a symbolic linkMichael Brown2013-07-134-24/+107
| | | | | | | | | | | | | | Add a facility for settings blocks to act as symbolic links to other settings blocks, and reimplement the "netX" virtual settings block using this facility. The primary advantage of this approach is that unscoped settings such as ${mac} and ${filename} will now reflect the settings obtained from the most recently opened network device: in most cases, this will mean the settings obtained from the most recent DHCP attempt. This should improve conformance to the principle of least astonishment. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Expose PCI configuration space via settings mechanismMichael Brown2013-07-134-0/+129
| | | | | | | | | | | | | | | | Allow values to be read from PCI configuration space using the syntax ${pci/<busdevfn>.<offset>.<length>} where <busdevfn> is the bus:dev.fn address of the PCI device (expressed as a single integer, as returned by ${net0/busloc}), <offset> is the offset within PCI configuration space, and <length> is the length within PCI configuration space. Values are returned in reverse byte order, since PCI configuration space is little-endian by definition. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add config/settings.hMichael Brown2013-07-133-2/+22
| | | | | | | | | | Move VMWARE_SETTINGS build configuration option from config/sideband.h to a new config/settings.h. Existing instances of config/local/sideband.h will not be affected, since config.c still #includes config/sideband.h. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linux] Add support for accessing PCI configuration space via /proc/bus/pciMichael Brown2013-07-138-0/+332
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add "busdevfn" setting typeMichael Brown2013-07-123-0/+58
| | | | | | | Allow network device's "busloc" setting to be formatted as a PCI bus:dev.fn address using e.g. ${net0/busloc:busdevfn}. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Add "bustype" and "busloc" settingsMichael Brown2013-07-121-0/+60
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add "hexraw" setting typeMichael Brown2013-07-123-0/+50
| | | | | Originally-implemented-by: Jeppe Toustrup <ipxe@tenzer.dk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Use hex_decode() to parse hex settingsMichael Brown2013-07-122-39/+38Star
| | | | | | | | | | Use hex_decode() to parse "hex" and "hexhyp" settings. Note that this parser is stricter than the old parser; it now requires exactly two hex digits for each byte. (The old parser was based upon strtoul() and so would allow leading whitespace and a leading plus or minus sign.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [base16] Generalise base16_decode() to hex_decode()Michael Brown2013-07-124-37/+64
| | | | | | | Provide a generic hex_decode() routine which can be shared between the Base16 code and the "hex" and "hexhyp" settings parsers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add self-tests for base16Michael Brown2013-07-122-0/+122
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tcp] Fix comment to match code behaviourMichael Brown2013-07-121-1/+1
| | | | | Reported-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tcp] Do not send RST for unrecognised connectionsMichael Brown2013-07-121-1/+0Star
| | | | | | | | | | | | On large networks with substantial numbers of monitoring agents, unwanted TCP connection attempts may end up flooding iPXE's ARP cache. Fix by silently dropping packets received for unrecognised TCP connections. This should not cause problems, since many firewalls will also silently drop any such packets. Reported-by: Jarrod Johnson <jarrod.b.johnson@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Use next-server from filename's settings blockMichael Brown2013-06-241-14/+25
| | | | | | | | | | | Locate the settings block containing the filename, and search only that settings block for the next-server address. This avoids problems caused by misconfigured DHCP servers which provide a next-server address (often defaulting to the DHCP server's own IP address) even when not providing a filename. Originally-implemented-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Work around bug in gcc >= 4.8Michael Brown2013-06-071-3/+5
| | | | | | | | | | | | | | | | | | | gcc 4.8 and 4.9 fail to compile pxe_call.c with the error "bp cannot be used in asm here". Other points in the codebase which use "ebp" in the asm clobber list do not seem to be affected. Unfortunately gcc provides no way to specify %ebp as an output register, so we cannot use this as a workaround. The only viable solution is to explicitly push/pop %ebp within the asm itself. This is ugly for two reasons: firstly, it may be unnecessary; secondly, it may cause gcc to generate invalid %esp-relative addresses if the asm happens to use memory operands. This specific block of asm uses no memory operands and so will not generate invalid code. Reported-by: Daniel P. Berrange <berrange@redhat.com> Reported-by: Christian Hesse <list@eworm.de> Originally-fixed-by: Christian Hesse <list@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>