summaryrefslogtreecommitdiffstats
path: root/src/core/settings.c
Commit message (Collapse)AuthorAgeFilesLines
* [settings] Allow store_setting() to access the root settings blockMichael Brown2009-02-171-3/+3
|
* [settings] Handle errors in fetchf_uristring()Michael Brown2009-02-121-1/+4
| | | | | | | | | fetchf_uristring() was failing to handle error values from fetch_setting(), resulting in its attempting to allocate extremely large temporary buffers on the stack (and so overrunning the stack and locking up the machine). Problem reported by Shao Miller <Shao.Miller@yrdsb.edu.on.ca>.
* [settings] Avoid duplicate settings block namesMichael Brown2009-01-311-0/+5
| | | | | | | Automatically unregister any settings with the same name (and position within the settings tree) as a newly registered settings block. This functionality is generalised out from dhcp.c.
* [settings] Add fetch_string_setting_copy()Michael Brown2009-01-271-0/+32
|
* [settings] Ensure fetch_string_setting() returns a NUL-terminated stringMichael Brown2008-11-071-0/+1
| | | | | | | | | | | | | | | This fixes a regression introduced in commit 612f4e7: [settings] Avoid returning uninitialised data on error in fetch_xxx_setting() in which the memset() was moved from fetch_string_setting() to fetch_setting(), in order that it would be useful for non-string setting types. However, this neglects to take into account the fact that fetch_string_setting() shrinks its buffer by one byte (to allow for the NUL) before calling fetch_setting(). Restore the memset() in fetch_string_setting(), so that the terminating NUL is guaranteed to actually be a NUL.
* [settings] Add the notion of a "tag magic" to numbered settingsMichael Brown2008-10-301-0/+1
| | | | | | | | | | | | | | | | | | | Settings can be constructed using a dotted-decimal notation, to allow for access to unnamed settings. The default interpretation is as a DHCP option number (with encapsulated options represented as "<encapsulating option>.<encapsulated option>". In several contexts (e.g. SMBIOS, Phantom CLP), it is useful to interpret the dotted-decimal notation as referring to non-DHCP options. In this case, it becomes necessary for these contexts to ignore standard DHCP options, otherwise we end up trying to, for example, retrieve the boot filename from SMBIOS. Allow settings blocks to specify a "tag magic". When dotted-decimal notation is used to construct a setting, the tag magic value of the originating settings block will be ORed in to the tag number. Store/fetch methods can then check for the magic number before interpreting arbitrarily-numbered settings.
* [settings] Avoid returning uninitialised data on error in fetch_xxx_setting()Michael Brown2008-10-221-5/+15
| | | | | | | | | | Callers (e.g. usr/autoboot.c) may not check the return values from fetch_xxx_setting(), assuming that in error cases the returned setting value will be "empty" (for some sensible value of "empty"). In particular, if the DHCP server did not specify a next-server address, this would result in gPXE using uninitialised data for the TFTP server IP address.
* [settings] Allow for setting fetchers to fail in fetchf_hex()Michael Brown2008-09-261-0/+2
|
* [settings] Add the uristring setting typeMichael Brown2008-09-241-0/+53
| | | | | | | | | | | | | | | This allows settings to be expanded in a way that is safe to include within a URI string, such as kernel http://10.0.0.1/boot.php?mf=${manufacturer:uristring} where the ${manufacturer} setting may contain characters that are not permitted (or have reserved purposes) within a URI. Since whitespace characters will be URI-encoded (e.g. "%20" for a space character), this also works around the problem that spaces within an expanded setting would cause the shell to split command-line arguments incorrectly.
* [settings] Avoid overwriting the start of .text in fetch_string_setting()Michael Brown2008-08-141-1/+2
| | | | | | | | | | fetch_string_setting() was subtracting one from the length of the to-be-NUL-terminated buffer in order to obtain the length of the unterminated buffer to be passed to fetch_setting(). This works extremely well unless the length of the to-be-NUL-terminated buffer is zero, at which point we end up giving fetch_setting() a buffer of length -1UL, thereby inviting it to overwrite as much memory as it wants...
* [Settings] Expose SMBIOS via settings APIMichael Brown2008-03-281-4/+65
| | | | In particular, expose the system UUID as a setting ("smbios/uuid").
* [Settings] find_child_settings() accepts a NULL parentMichael Brown2008-03-271-0/+4
|
* [Settings] Remove assumption that all settings have DHCP tag valuesMichael Brown2008-03-251-273/+181Star
| | | | | | | | | | | | Allow for settings to be described by something other than a DHCP option tag if desirable. Currently used only for the MAC address setting. Separate out fake DHCP packet creation code from dhcp.c to fakedhcp.c. Remove notion of settings from dhcppkt.c. Rationalise dhcp.c to use settings API only for final registration of the DHCP options, rather than using {store,fetch}_setting throughout.
* [Settings] Add named setting for next-serverMichael Brown2008-03-241-0/+6
| | | | | It's probably easier to have a named setting for next-server, rather than to explain to people why they need to pretend it is option 175.3.
* [Settings] copy_settings() should not fail if some settings are missing!Michael Brown2008-03-241-39/+17Star
|
* [Settings] Bugfix: store_setting() now applies changes even on root blockMichael Brown2008-03-221-3/+2Star
|
* [Settings] Implement simple_settings backed with extensible DHCP optionsMichael Brown2008-03-221-18/+38
|
* [Settings] DHCP is now working using the new settings API.Michael Brown2008-03-211-8/+6Star
|
* [Settings] Migrate DHCP and NVO code to the new settings API (untested)Michael Brown2008-03-211-3/+98
|
* [Settings] Convert code in src/usr to use settings API.Michael Brown2008-03-211-4/+31
|
* [Settings] Introduce settings applicators.Michael Brown2008-03-211-9/+102
| | | | | | | Convert DHCP option applicators in dns.c and iscsi.c to settings applicators. Kill off DHCP option applicators.
* [Settings] Add settings hierarchyMichael Brown2008-03-201-154/+227
| | | | | | | | Add the notion of the settings hierarchy, complete with register/unregister routines. Rename set->store and get->fetch to avoid naming conflicts with get/put as used in reference counting.
* [Settings] Start revamping the configuration settings API.Michael Brown2008-03-201-301/+606
| | | | | | | | | | | | | | | | Add the concept of an abstract configuration setting, comprising a (DHCP) tag value and an associated byte sequence. Add the concept of a settings namespace. Add functions for extracting string, IPv4 address, and signed and unsigned integer values from configuration settings (analogous to dhcp_snprintf(), dhcp_ipv4_option(), etc.). Update functions for parsing and formatting named/typed options to work with new settings API. Update NVO commands and config UI to use new settings API.
* [Settings] Allow named settings to have their type specified explicitlyMichael Brown2008-03-181-45/+48
| | | | Allow setting names such as "ip:hex".
* [Settings] Allow encapsulated options to be specified as named settingsMichael Brown2008-03-181-4/+10
| | | | | | Allow encapsulated options to be specified as e.g. "175.3". As a side-effect, change the separator character for the type field from "." to ":"; for example, the IP address pseudo-option is now "175.3:ipv4".
* [Settings] Add int16, int32 and hex-string configuration setting typesMichael Brown2008-03-181-5/+131
| | | | | | | | | | Add parse and display routines for 16-bit and 32-bit integer configuration settings. Add parse and display routines for hex-string configuration settings. Assume hex-string as a configuration setting type if no type is explicitly specified.
* [Settings] show_setting() functions return snprintf()-style length.Michael Brown2008-03-181-10/+7Star
| | | | | | show_setting() and related functions now return an "actual length" in the style of snprintf(). This is to allow consumers to allocate buffers large enough to hold the formatted setting.
* Use stdio.h instead of vsprintf.hMichael Brown2007-01-191-1/+1
|
* Having forced __table() to natural structure alignment, it now seemsMichael Brown2007-01-101-41/+43
| | | | | | that we *can* place arrays in tables, which means we can force the order within a table without having to resort to explicitly numbered sections on everything.
* Add "name" field to struct device to allow human-readable hardware deviceMichael Brown2007-01-101-8/+8
| | | | | | | | | | | names. Add "dev" pointer in struct net_device to tie network interfaces back to a hardware device. Force natural alignment of data types in __table() macros. This seems to prevent gcc from taking the unilateral decision to occasionally increase their alignment (which screws up the table packing).
* Add iSCSI initiator IQN as a settingMichael Brown2006-12-211-0/+6
|
* 8-bit integers are 1 byte long, not 8...Michael Brown2006-12-201-1/+1
|
* Added descriptive text for settings and setting types, and display it inMichael Brown2006-12-201-2/+12
| | | | the option config UI.
* Move {show,set,clear}_setting() to {show,set,clear}_named_setting().Michael Brown2006-12-201-22/+18Star
| | | | | | | | Introduce new {show,set,clear}_setting() that take a struct setting * rather than a const char *. set_setting() handles calling clear_setting() when appropriate, so that individual setting types don't have to check for empty strings.
* Use -ENOSPC rather than -ENOMEM, to distinguish the cases "generic out ofMichael Brown2006-12-201-5/+5
| | | | memory" and "no space left for DHCP options"
* Added clear_setting()Michael Brown2006-12-121-2/+25
|
* Added "priority" and "root-path" optionsMichael Brown2006-12-081-2/+94
|
* inet_aton() has a non-traditional return valueMichael Brown2006-12-061-1/+1
|
* Tied NVO commands into the human-interactable settings code that IMichael Brown2006-12-051-37/+25Star
| | | | completely forgot I'd written ages ago.
* Added cmdl_show proof-of-conceptMichael Brown2006-08-111-0/+20
|
* Added "hostname" and "ip" as sample settingsMichael Brown2006-08-111-0/+13
|
* Added ipv4 configuration typeMichael Brown2006-08-111-0/+56
|
* Add string configuration typeMichael Brown2006-08-111-5/+54
|
* Added basic infrastructure for manipulating settings.Michael Brown2006-08-111-0/+148