summaryrefslogtreecommitdiffstats
path: root/src/core
Commit message (Collapse)AuthorAgeFilesLines
...
* [ipv6] Rename ipv6_scope to dhcpv6_scopeMichael Brown2016-07-161-1/+1
| | | | | | | | The settings scope ipv6_scope refers specifically to IPv6 settings that have a corresponding DHCPv6 option. Rename to dhcpv6_scope to more accurately reflect this purpose. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [acpi] Add support for ACPI power offMichael Brown2016-07-111-0/+274
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [downloader] Treat redirection failures as fatalMichael Brown2016-07-041-2/+6
| | | | | Debugged-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Send intf_close() if redirection failsMichael Brown2016-07-041-0/+5
| | | | | | | | | | A redirection failure is fatal, but provides no opportunity for the caller of xfer_[v]redirect() to report the failure since the interface will already have been disconnected. Fix by sending intf_close() from within the default xfer_vredirect() handler. Debugged-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [time] Allow system clock to be adjusted at runtimeMichael Brown2016-06-131-0/+3
| | | | | | | | | | Provide a mechanism to allow an arbitrary adjustment to be applied to all subsequent calls to time(). Note that the underlying clock source (e.g. the RTC clock) will not be changed; only the time as reported within iPXE will be affected. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Support systems with multiple PCI root bridgesMichael Brown2016-06-091-2/+11
| | | | | | | | | Extend the 16-bit PCI bus:dev.fn address to a 32-bit seg:bus:dev.fn address, assuming a segment value of zero in contexts where multiple segments are unsupported by the underlying data structures (e.g. in the iBFT or BOFM tables). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Always use a non-zero seed for the (non-crypto) RNGMichael Brown2016-06-091-0/+2
| | | | | | | | | | | | | | The non-cryptographic RNG implemented by random() has the property that a seed value of zero will result in a generated sequence of all-zero values. This situation can arise if currticks() returns zero at start of day. Work around this problem by falling back to a fixed non-zero seed if necessary. This has no effect on the separate DRBG used by cryptographic code. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Work around broken UEFI keyboard driversMichael Brown2016-05-261-2/+7
| | | | | | | | | | | | Some UEFI keyboard drivers are blissfully unaware of the existence of either Ctrl key, and will report "Ctrl-<key>" as just "<key>". This breaks substantial portions of the iPXE user interface. Work around these broken UEFI drivers by allowing "ESC <key>" to be used as a substitute for "Ctrl-<key>". Tested-by: Dreamcat4 <dreamcat4@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Extend numerical setting tags to "unsigned long"Michael Brown2016-05-202-3/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Avoid implicit assumptions about potentially-optimised memcpy()Michael Brown2016-05-091-1/+1
| | | | | | | | Do not assume that an architecture-specific optimised memcpy() will have the same properties as generic_memcpy() in terms of handling overlapping regions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Skip misleading "format not recognised" error messageMichael Brown2016-04-281-1/+1
| | | | | | | | | | | | Return success (rather than failure) after an image format has been correctly identified. This has no practical effect, since the return value from image_probe() is deliberately never used, but avoids a somewhat surprising and misleading "format not recognised" error message when debugging is enabled. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Print "<NULL>" for wide-character NULL stringsMichael Brown2016-04-121-2/+4
| | | | | | | | The existing code intends to print NULL strings as "<NULL>" (for the sake of debug messages), but the logic is incorrect when handling wide-character strings. Fix the logic and add applicable unit tests. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Make sleep() interruptibleMichael Brown2016-03-222-17/+21
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [gdb] Add support for x86_64Michael Brown2016-03-221-4/+7
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Support "file:" URIs describing relative pathsMichael Brown2016-03-141-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Support URIs containing only scheme and path componentsMichael Brown2016-03-131-3/+2Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [serial] Add missing #include <string.h>Michael Brown2016-03-121-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pixbuf] Check for unsigned integer overflow on multiplicationMichael Brown2016-03-121-0/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pcbios] Restrict external memory allocations to the low 4GBMichael Brown2016-03-081-85/+0Star
| | | | | | | | | | | | When running the 64-bit BIOS version of iPXE, restrict external memory allocations to the low 4GB to ensure that allocations (such as for initrds) fall within our identity-mapped memory region, and will be accessible to the potentially 32-bit operating system. Move largest_memblock() back to memtop_umalloc.c, since this change imposes a restriction that applies only to BIOS builds. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ioapi] Split ioremap() out to a separate IOMAP APIMichael Brown2016-02-261-0/+36
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iobuf] Improve robustness of I/O buffer allocationMichael Brown2016-02-111-9/+34
| | | | | | | | | | | | | Guard against various corner cases (such as zero-length buffers, zero alignments, and integer overflow when rounding up allocation lengths and alignments) and ensure that the struct io_buffer is correctly aligned even when the caller requests a non-zero alignment for the I/O buffer itself. Add self-tests to verify that the resulting alignments and lengths are correct for a range of allocations. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Guard against unsigned integer overflowMichael Brown2016-02-061-2/+13
| | | | | | | | | | | | | Commit f3fbb5f ("[malloc] Avoid integer overflow for excessively large memory allocations") fixed signed integer overflow issues caused by the use of ssize_t, but did not guard against unsigned integer overflow. Add explicit checks for unsigned integer overflow where needed. As a side bonus, erroneous calls to malloc_dma() with an (illegal) size of zero will now fail cleanly. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Apply URI decoding for all parsed URIsMichael Brown2016-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The various early-exit paths in parse_uri() accidentally bypass the URI field decoding. The result is that opaque or relative URIs do not undergo URI field decoding, resulting in double-encoding when the URIs are subsequently used. For example: #!ipxe set mac ${macstring} imgfetch /boot/by-mac/${mac:uristring} would result in an HTTP GET such as GET /boot/by-mac/00%253A0c%253A29%253Ac5%253A39%253Aa1 HTTP/1.1 rather than the expected GET /boot/by-mac/00%3A0c%3A29%3Ac5%3A39%3Aa1 HTTP/1.1 Fix by ensuring that URI decoding is always applied regardless of the URI format. Reported-by: Andrew Widdersheim <awiddersheim@inetu.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tftp] Mangle initial slash on TFTP URIsMichael Brown2016-01-211-21/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TFTP URIs are intrinsically problematic, since: - TFTP servers may use either normal slashes or backslashes as a directory separator, - TFTP servers allow filenames to be specified using relative paths (with no initial directory separator), - TFTP filenames present in a DHCP filename field may use special characters such as "?" or "#" that prevent parsing as a generic URI. As of commit 7667536 ("[uri] Refactor URI parsing and formatting"), we have directly constructed TFTP URIs from DHCP next-server and filename pairs, avoiding the generic URI parser. This eliminated the problems related to special characters, but indirectly made it impossible to parse a "tftp://..." URI string into a TFTP URI with a non-absolute path. Re-introduce the convention of requiring an extra slash in a "tftp://..." URI string in order to specify a TFTP URI with an initial slash in the filename. For example: tftp://192.168.0.1/boot/pxelinux.0 => RRQ "boot/pxelinux.0" tftp://192.168.0.1//boot/pxelinux.0 => RRQ "/boot/pxelinux.0" This is ugly, but there seems to be no other sensible way to provide the ability to specify all possible TFTP filenames. A side-effect of this change is that format_uri() will no longer add a spurious initial "/" when formatting a relative URI string. This improves the console output when fetching an image specified via a relative URI. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Avoid potentially large stack allocationMichael Brown2016-01-211-9/+12
| | | | | | Avoid potentially large stack allocation in resolve_path(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [debug] Allow debug colourisation to be disabledMichael Brown2016-01-121-3/+9
| | | | | | | | | | Some BIOS console redirection capabilities do not work well with the colourised debug messages used by iPXE. We already allow the range of colours to be controlled via the DBGCOL=... build parameter. Extend this syntax to allow DBGCOL=0 to be used to mean "disable colours". Requested-by: Wissam Shoukair <wissams@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [downloader] Update image URI in response to a redirectionMichael Brown2016-01-091-6/+41
| | | | | | | | | | | | | | Update the image's recorded URI when a download redirection occurs. This ensures that URIs relative to a redirected download are resolved correctly. In particular, this allows for the use of relative URIs in scripts that are themselves downloaded via a redirection, such as the HTTP 301 redirection used to fix up URIs pointing to directories but omitting the trailing slash (e.g. "http://boot.ipxe.org/demo", which will be redirected to "http://boot.ipxe.org/demo/"). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Provide image_set_uri() to modify an image's URIMichael Brown2016-01-091-10/+28
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [fbcon] Move margin calculations to fbcon.cMichael Brown2015-10-141-14/+36
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [fbcon] Allow character height to be selected at runtimeMichael Brown2015-10-141-10/+9Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Avoid integer overflow for excessively large memory allocationsMichael Brown2015-09-291-48/+49
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Generalise tftp_uri() to pxe_uri()Michael Brown2015-09-021-16/+37
| | | | | | | | | | | | | | | | | | Merge the functionality of parse_next_server_and_filename() and tftp_uri() into a single pxe_uri(), which takes a server address (IPv4/IPv6/none) and a filename, and produces a URI using the rule: - if the filename is a hierarchical absolute URI (i.e. includes a scheme such as "http://" or "tftp://") then use that URI and ignore the server address, - otherwise, if the server address is recognised (according to sa_family) then construct a TFTP URI based on the server address, port, and filename - otherwise fail. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Re-add "uristring" setting typeMichael Brown2015-08-252-27/+104
| | | | | | | | | | | | | | | | | | | | Commit 09b057c ("[settings] Remove "uristring" setting type") removed support for URI-encoded settings via the "uristring" setting type, on the basis that such encoding was no longer necessary to avoid problems with the command line parser. Other valid use cases for the "uristring" setting type do exist: for example, a password containing a '/' character expanded via chain http://username:${password:uristring}@server.name/boot.php Restore the existence of the "uristring" setting, avoiding the potentially large stack allocations that were used in the old code prior to commit 09b057c ("[settings] Remove "uristring" setting type"). Requested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Detect image type when image is first registeredMichael Brown2015-08-211-41/+42
| | | | | | | | | | | | | | | | | | | The current usage pattern of image_probe() is a legacy from the time before commit 34b6ecb ("[image] Simplify image management") when loading an image to its executable location in memory was a separate action from actually executing the image. Call image_probe() as soon as an image is registered. This allows "imgstat" to display image type information for all images and allows image-consuming code to assume that image->type is already set correctly. Ignore failures if image_probe() does not recognise the image, since we do expect to handle unrecognised images (initrds, modules, etc). Unrecognised images will be left with a NULL image->type, which image-consuming code can easily check. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Allow self-tests to report exit status when running under LinuxMichael Brown2015-08-211-3/+6
| | | | | | | | | Allow the return status from an embedded image to propagate out to the eventual return status from main(). When running under Linux, this allows the pass/fail result of unit tests to be observable without having to visually inspect the console output. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Add generic block device translatorMichael Brown2015-08-161-0/+261
| | | | | | | Add a generic mechanism for providing block devices on top of a data transfer interface (such as HTTP). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [serial] Check for UART existence in uart_select()Michael Brown2015-07-311-7/+25
| | | | | | | | | | | Check for existence of the UART in uart_select(), not just in uart_init(). This allows uart_select() to refuse to set a non-working address in uart->base, which in turns means that the serial console code will not attempt to use a non-existent UART. Reported-by: Torgeir Wulfsberg <Torgeir.Wulfsberg@kongsberg.com> Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linebuf] Support buffering of multiple linesMichael Brown2015-07-281-13/+40
| | | | | | | | Allow line buffer to accumulate multiple lines, with buffered_line() returning each freshly-completed line as it is encountered. This allows buffered lines to be subsequently processed as a group. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pool] Add a generic concept of a pooled connectionMichael Brown2015-07-281-0/+114
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Fix compiler warnings on some gcc versionsMichael Brown2015-07-271-1/+1
| | | | | | | | | | | | | | | | | | xfer_buffer() uses intf_get_dest_op() to obtain the destination interface for xfer_deliver(), in order to check that this is the same interface which provides xfer_buffer(). The return value from intf_get_dest_op() (which contains the actual method implementing xfer_deliver()) is not used. On some gcc versions, this triggers a "value computed is not used" warning, since the explicit type cast included within the intf_get_dest_op() macro is treated as a "value computed". Fix by explicitly casting the result of intf_get_dest_op() to void. Reported-by: Matthew Helton <mwhelton@gmail.com> Reported-by: James A. Peltier <jpeltier@sfu.ca> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [downloader] Provide direct access to the underlying data transfer bufferMichael Brown2015-07-221-0/+14
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [downloader] Use generic data-transfer buffer mechanismMichael Brown2015-07-221-74/+18Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xferbuf] Add xfer_buffer() to provide direct access to underlying bufferMichael Brown2015-07-221-0/+39
| | | | | | | Allow data transfer buffer users to provide direct access to their underlying data transfer buffer. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xferbuf] Generalise to handle umalloc()-based buffersMichael Brown2015-07-221-22/+195
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Add xfer_check_order() utility functionMichael Brown2015-07-221-0/+31
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Use intf_poke() to implement xfer_window_changed()Michael Brown2015-07-221-11/+1Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [interface] Add intf_poke() helperMichael Brown2015-07-221-0/+25
| | | | | | | Reduce the cost of implementing object methods which convey no information beyond the fact that the method has been called. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [fault] Add inject_corruption() to randomly corrupt dataMichael Brown2015-07-221-0/+29
| | | | | | | Provide an inject_corruption() function that can be used to randomly corrupt data bytes with configurable probabilities. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [fault] Generalise NETDEV_DISCARD_RATE fault injection mechanismMichael Brown2015-07-221-0/+53
| | | | | | | Provide a generic inject_fault() function that can be used to inject random faults with configurable probabilities. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [gdb] Allow gdbstub to be started on an arbitrary serial portMichael Brown2015-06-291-7/+36
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>