summaryrefslogtreecommitdiffstats
path: root/src/core
Commit message (Collapse)AuthorAgeFilesLines
...
* [malloc] Discard all cached data on shutdownMichael Brown2012-05-041-0/+25
| | | | | | | Allow detection of genuine memory leaks by ensuring that all cached data is freed on shutdown. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Avoid using stack-allocated memory in xfer_printf()Michael Brown2012-04-231-7/+19
| | | | | | | | | | | xfer_printf() occasionally has to deal with strings that are potentially long, such as HTTP URIs with multiple query parameters. Allocating these on the stack can lead to stack overruns and memory corruption. Fix by using vasprintf() instead of a stack allocation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add fetch_setting_copy()Michael Brown2012-04-191-0/+40
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tftp] Allow builds without TFTP supportMichael Brown2012-04-171-0/+8
| | | | | | | Allow TFTP to be configured out by moving the next-server setting definition (which is used by autoboot.c) from tftp.c to settings.c. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Split fetching and storing out of setting type handlersMichael Brown2012-04-172-244/+339
| | | | | | | Refactor setting type handlers to parse and format values, rather than storing and fetching formatted values. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Allow strtoul() to interpret negative numbersMichael Brown2012-04-172-0/+24
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Fix use-after-free in debug messagesMichael Brown2012-03-301-3/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [menu] Add menu commandsMichael Brown2012-03-291-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow iPXE scripts to create menus. For example: #!ipxe menu iSCSI boot demonstration item install Install Fedora to ${root-path} item --default boot Boot from ${root-path} item shell Enter iPXE shell item exit Exit to BIOS choose label && goto ${label} :boot sanboot ${root-path} :install sanhook ${root-path} chain http://${next-server}/fedora.ipxe :shell shell :exit Inspired-by: Robin Smidsrød <robin@smidsrod.no> Tested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [menu] Add the abstract concept of a menuMichael Brown2012-03-291-0/+177
| | | | | | Inspired-by: Robin Smidsrød <robin@smidsrod.no> Tested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Allow "prompt" command to accept character literals for --keyMichael Brown2012-03-291-1/+19
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Log image executionsMichael Brown2012-03-271-0/+13
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Remove "log message" usage from interactive console defaultsMichael Brown2012-03-271-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [downloader] Use a more meaningful error message when out of memoryMichael Brown2012-03-271-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [downloader] Abort download immediately if buffer resizing failsMichael Brown2012-03-271-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [downloader] Log final status of all downloadsMichael Brown2012-03-261-0/+10
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Do not share ANSI escape context between lineconsole usersMichael Brown2012-03-261-11/+1Star
| | | | | | | | An ANSI escape sequence context cannot be shared between multiple users. Make the ANSI escape sequence context part of the line console definition and provide individual contexts for each user. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Add "log message" console usage and an internal syslog() callMichael Brown2012-03-261-0/+62
| | | | | | | | | | | | | | | Provide an internal syslog() function (unrelated to the syslog console) which can be used to create log messages with specified priorities. The build-time constant LOG_LEVEL can be used to select the minimum required priority for log messages. Any messages that do not have a sufficient priority will be ignored (and will be optimised away at compile-time). The default LOG_LEVEL is LOG_NONE. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Allow usage to be defined independently for each consoleMichael Brown2012-03-263-17/+52
| | | | | | | | | | | | | | | | | | | | | Add the concept of a "console usage", such as "standard output" or "debug messages". Allow usages to be associated with each console independently. For example, to send debugging output via the serial port, while preventing it from appearing on the local console: #define CONSOLE_SERIAL CONSOLE_USAGE_ALL #define CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_DEBUG ) If no usages are explicitly specified, then a default set of usages will be applied. For example: #define CONSOLE_SERIAL will have the same affect as #define CONSOLE_SERIAL CONSOLE_USAGE_ALL Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Remove unused "btext" consoleMichael Brown2012-03-261-5039/+0Star
| | | | | | The "btext" console has been disabled by a "#if 0" since 2007. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Move putchar() and getchar() declarations to stdio.hMichael Brown2012-03-263-3/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Simplify image management commands and internal APIMichael Brown2012-03-252-41/+42
| | | | | | | | | | | | | | | | | | | | | | Remove the name, cmdline, and action parameters from imgdownload() and imgdownload_string(). These functions now simply download and return an image. Add the function imgacquire(), which will interpret a "name or URI string" parameter and return either an existing image or a newly downloaded image. Use imgacquire() to merge similar image-management commands that currently differ only by whether they take the name of an existing image or the URI of a new image to download. For example, "chain" and "imgexec" can now be merged. Extend imgstat and imgfree commands to take an optional list of images. Remove the arbitrary restriction on the length of image names. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Add concept of trusted imagesMichael Brown2012-03-221-0/+46
| | | | | | | | | | | | | | | | Trusted images may always be executed. Untrusted images may be executed only if the current image trust requirement allows untrusted images. Images can be marked as trusted using image_trust(), and marked as untrusted using image_untrust(). The current image trust requirement can be changed using image_set_trust(). It is possible to make the change permanent, in which case any future attempts to change the image trust requirement will fail. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [time] Define an API for getting the current timeMichael Brown2012-03-191-0/+29
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add mktime() functionMichael Brown2012-03-191-0/+137
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [syslog] Separate out generic line-based console functionalityMichael Brown2012-02-291-0/+76
| | | | | | | Abstract out the generic line-handling portions of the syslog putchar() routine, to allow use by other console types. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [getopt] Accept "--" as an end-of-options markerMarin Hannache2011-11-021-0/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Eliminate the register_and_xxx_image() functionsMichael Brown2011-10-251-2/+6
| | | | | | | | All users of imgdownload() require registration of the image, so make registration an integral part of imgdownload() itself and simplify the "action" parameter to be one of image_select(), image_exec() et al. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Allow "sleep" command to be interruptedMichael Brown2011-10-241-1/+8
| | | | | | Allow Ctrl-C to be used to abort a "sleep" command. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Fix up "sleep" argument parsingMichael Brown2011-10-241-2/+10
| | | | | | | Use parse_integer() rather than strtoul() to allow parsing errors to be reported in a meaningful way. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Make "sleep" command available by defaultMichael Brown2011-10-241-0/+40
| | | | | | | | | | | | | | | The "sleep" command is generally useful to have. For example: :dhcp_retry dhcp && goto dhcp_done sleep 5 goto dhcp_retry :dhcp_done Make the "sleep" command available by default, leaving TIME_CMD controlling only the (fairly specialist) "time" command. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Allow assertion failures to be countedMichael Brown2011-10-141-0/+30
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Allow for zero-padded decimals in printf()Michael Brown2011-07-061-10/+27
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hw] Eliminate polling while waiting for window to openMichael Brown2011-06-281-1/+2
| | | | | | | | | | | | | | | Polling for the data-transfer window to become open is wasteful. We can eliminate the polling loop by using hw_step() as the handler for an xfer_window_changed() event. If the window is already open at the time of instantiation, then xfer_window_changed() may never be called. We can cover this case by using hw_step() as the step() method of a one-shot process. Since the signature for an xfer_window_changed() method is identical to the signature for a process step() method, the same function can be used for both. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [resolv] Use a one-shot process for the numeric resolverMichael Brown2011-06-281-2/+1Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [process] Add support for one-shot processesMichael Brown2011-06-281-2/+6
| | | | | | | | | Some processes execute only once, and exist solely in order to defer execution until after the relevant instantiator method has returned. Such processes do not need to be automatically rescheduled when executing. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [process] Pass containing object pointer to process step() methodsMichael Brown2011-06-283-29/+47
| | | | | | | | | Give the step() method a pointer to the containing object, rather than a pointer to the process. This is consistent with the operation of interface methods, and allows a single function to serve as both an interface method and a process step() method. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Send xfer_window_changed() after xfer_vredirect()Michael Brown2011-06-281-1/+16
| | | | | | | | | | Modify the default action for xfer_vredirect() to automatically send xfer_window_changed() messages to both the new child and the parent interfaces. This will allow the elimination of processes that simply poll on xfer_window() to determine when a redirection has completed successfully. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Disambiguate the various EINVAL errorsMichael Brown2011-05-181-2/+16
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [sanboot] Add "sanhook" and "sanunhook" commandsMichael Brown2011-04-241-0/+1
| | | | | | | Expose the multiple-SAN-drive capability of the iPXE core via the iPXE command line by adding commands to hook and unhook additional drives. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Allow for pre-initialised option setsMichael Brown2011-04-241-7/+22
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Add "iseq" commandGreg Jednaszewski2011-04-081-0/+37
| | | | | Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Simplify "isset" commandMichael Brown2011-04-081-10/+3Star
| | | | | | | | There is no plausible scenario I can think of in which "isset" would be used with more than one argument. Simplify the code by specifying that exactly one argument is required. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Fix "isset" commandMichael Brown2011-04-011-2/+8
| | | | | | | | | | | | | | | Commit b5f5f73 ("[cmdline] Expand settings within each command-line token individually") introduced a regression into the "isset" command: it is now possible for command-line arguments to be empty strings, and so "isset" cannot simply check for a non-empty argument list. Restore previous behaviour by checking for the presence of any non-empty arguments, rather than checking for a non-empty argument list. Reported-by: Nemtallah Daher <n.daher@csuohio.edu> Tested-by: Nemtallah Daher <n.daher@csuohio.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [main] Add the "scriptlet" settingMichael Brown2011-03-281-4/+19
| | | | | | | | | | | | | | | | | | | A scriptlet is a single iPXE command that can be stored in non-volatile option storage and used to override the default "autoboot" behaviour without having to reflash the iPXE image. For example, a scriptlet could contain autoboot || reboot to instruct iPXE to reboot the system if booting fails. Unlike an embedded image, the presence of a scriptlet does not inhibit the initial "Press Ctrl-B..." prompt. This allows the user to recover from setting a faulty scriptlet. Originally-implemented-by: Glenn Brown <glenn@myri.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Expand settings within each command-line token individuallyMichael Brown2011-03-281-35/+79
| | | | | | | | | | | Perform settings expansion after tokenisation, and only at the point of executing each command. This allows statements such as dhcp && echo ${net0/ip} to work correctly. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Allow ";" as an unconditional command separatorMichael Brown2011-03-281-0/+14
| | | | | | | | | | | | It is currently possible to construct a sequence of commands to be executed regardless of success or failure using "|| &&" as the command separator. (The "||" captures the failure case, the blank command converts it to a success case.) Allow ";" to be used as a more visually appealing (and space-efficient) alternative. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linux] Make malloc and linux_umalloc valgrindablePiotr Jaroszyński2011-03-271-2/+57
| | | | | | | | | | Make the allocators used by malloc and linux_umalloc valgrindable. Include valgrind headers in the codebase to avoid a build dependency on valgrind. Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Allow "echo -n" to inhibit trailing newlineMichael Brown2011-03-271-3/+30
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Add support for boolean optionsMichael Brown2011-03-271-0/+15
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [monojob] Avoid overflow when calculating percentage progressMichael Brown2011-03-261-3/+7
| | | | | | | | Normalise the progress figures to ensure that multiplication by 100 (to produce a percentage) cannot result in integer overflow. Reported-by: Sven Dreyer <sven@dreyer-net.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>