summaryrefslogtreecommitdiffstats
path: root/discover
Commit message (Collapse)AuthorAgeFilesLines
...
* discover/platform-powerpc: Correct aux revision formatSamuel Mendoza-Jonas2017-06-201-7/+8
| | | | | | | | The Auxiliary Firmware Revision Information should be displayed as four hexadecimal bytes if a manufacturer-specific format is not known. Update the "Firmware version" format to reflect this. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/device-handler: Include makedev() from sysmacros.hSamuel Mendoza-Jonas2017-06-201-0/+1
| | | | | | | | | | | | | | | | Include sys/sysmacros.h explicitly in response to the following error message: ../discover/device-handler.c:1001:13: warning: In the GNU C Library, "makedev" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "makedev", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "makedev", you should undefine it after including <sys/types.h>. id = makedev(1, handler->n_ramdisks); ^~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Don't fail early if nvram failsSamuel Mendoza-Jonas2017-04-271-1/+1
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Track both configured and current autoboot settingsSamuel Mendoza-Jonas2017-03-152-15/+2
| | | | | | | | | | | | | | | If autoboot is enabled but later disabled or cancelled by, for example, an IPMI override then the nc-config screen will set the autoboot widget as disabled. If the user then makes and saves a change in nc-config, autoboot will also be saved as disabled. This accidental change is particularly awkward if the user is attempting to remove an IPMI override. Instead only ever change the autoboot setting if the user explicitly changes it. Use a new helper function 'config_autoboot_active()' to determine the current autoboot status where needed. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/sysinfo: Fix useless error messageSamuel Mendoza-Jonas2017-01-311-1/+3
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* process: Cancel all asynchronous jobs on reinitv1.4.1Samuel Mendoza-Jonas2017-01-311-0/+3
| | | | | | | | | | | If an asynchronous job is running over a reinit, the process can return and run its callback function after the reinit. This becomes a problem if the callback function accesses pointers that were only valid before the reinit (eg. device structs). If a reinit is requested explicitly stop all active asynchronous jobs and clear their callback functions before the reinit. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/device-handler: Cancel pending boot on reinitSamuel Mendoza-Jonas2017-01-311-0/+6
| | | | | | | | | | When a reinit is requested device_handler_cancel_default() is called, however as the name suggests this only cancels the boot task if it is the result of a default boot option. We also want to cancel a boot task if it was executed manually because it may have outstanding asynchronous transfers running, so explicitly cancel it during reinit. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/device-handler: Process queue after device addedSamuel Mendoza-Jonas2017-01-311-2/+1
| | | | | | | | | | | | In device_handler_discover() we process the unresolved boot options queue first. However the discover_device in question has not yet been added to handler->devices so when a parser tries to search for a matching device it will fail. The discover_device will be added to the handler if it has not already in device_handler_discover_context_commit() so move the call to process_boot_option_queue() after it. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/network: Ignore interfaces with pre-existing MAC addressSamuel Mendoza-Jonas2017-01-311-1/+11
| | | | | | | | | | | | Petitboot uses the MAC address of network interfaces as a unique identifier. This can cause a crash in pb-discover on a machine that has multiple interfaces with the same MAC address. While duplicate MAC addresses are rare and imply an issue with the larger system configuration Petitboot should handle this gracefully, so log a warning and ignore any interfaces other than the first to appear that share a MAC address. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/network: Ensure interfaces have device before configuringSamuel Mendoza-Jonas2017-01-121-3/+6
| | | | | | | | | | Reorganise network_handle_nlmsg() slightly to create interface->dev just before calling configure_interface() rather than only for brand new interfaces. This ensures existing interfaces which have had ->dev removed but receive a new configure event do not access a NULL pointer during the configuration process. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/network: Search by UUID only if availableSamuel Mendoza-Jonas2017-01-121-1/+4
| | | | | | | | | When registering a new discover device it is possible the device does not have an associated UUID, for example when created via device_handler_process_url(). Fall back to find_interface_by_name() in this case. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Record IP address of network interfacesSamuel Mendoza-Jonas2016-12-204-0/+47
| | | | | | | | If an interface has a valid IP address (either via DHCP or static config) store it in the interface_info struct so it can be referenced later. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Maintain a backlog of status updatesSamuel Mendoza-Jonas2016-12-203-0/+28
| | | | | | | | | Add status updates to a persistent list in the discover_server struct, and send each client the backlog on connect. This avoids clients missing useful messages from early init. Clients will only show this in the backlog screen to avoid flooding the client's status line. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/paths: Announce download completionSamuel Mendoza-Jonas2016-12-201-0/+5
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/paths: Parse Busybox progress informationSamuel Mendoza-Jonas2016-12-201-6/+88
| | | | | | | | | | | | Several busybox utilities (tftp and wget in particular) use a common format for progress bar output. Add a stdout callback that recognises this format and passes progress information to device_handler_status_download(). If Petitboot has been explicitly built with busybox support set busybox_progress_cb() as the default stdout callback for load_url_async(). Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/device-handler: Add aggregated download progress updatesSamuel Mendoza-Jonas2016-12-202-0/+123
| | | | | | | | | | | | | | Several processes run by Petitboot output progress information while running. Add device_handler_status_download() which process callers can call to register and update progress information (percentage and current size). A list of 'progress_info' structs holds this progress information, and on each call to device_handler_status_download() the information is combined and displayed as a single status update for readability. On completion device_handler_status_download_remove() is called to remove old progress information from the list. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/paths: Add stdout callback parameter for load_url_async()Samuel Mendoza-Jonas2016-12-204-6/+20
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/boot: Improve kexec error reportingSamuel Mendoza-Jonas2016-12-201-29/+48
| | | | | | | | Update kexec_load() to preserve output from the call to `kexec -l`. On error retrieve the resulting error message and update the status line with it to provide a more informative error message. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/status: Add status messages for payload download resultsJeremy Kerr2016-12-201-2/+9
| | | | | | | ... using the URL which is now present in the load_result. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/status: Use full URL in parse status messageJeremy Kerr2016-12-201-1/+1
| | | | | | | ->conf_url is the base address, we want the actual loaded URL. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/status: Add parse status for GRUB2, yaboot & kboot parsersJeremy Kerr2016-12-203-0/+12
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/status: make boot status calls more consistentJeremy Kerr2016-12-201-14/+15
| | | | | | | | Capitals where suitable, remove underscore from kexec_load, use translated strings for payload names. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/status: report on PXE download failuresJeremy Kerr2016-12-201-2/+12
| | | | | | | | Add dev_err messages on both autoconfiguration and specified-configuration download failures. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/status: report attempts at PXE configuration downloadJeremy Kerr2016-12-201-3/+13
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/status: Be more specific about DHCP event status messageJeremy Kerr2016-12-201-1/+2
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/status: report status on link configurationJeremy Kerr2016-12-201-2/+11
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/status: remove completion messagesJeremy Kerr2016-12-201-4/+0
| | | | | | | | | The completion messages are unconditional, so don't really indicate anything. In fact, the dhcp completion status is misleading, as we may still be processing the context through pxe callbacks. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Add reference to url in load_url_resultJeremy Kerr2016-12-202-0/+2
| | | | | | | We may want to access the loaded URL in a async handler. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: add handler reference to struct discover_contextJeremy Kerr2016-12-203-4/+14
| | | | | | | | | | | | | Since the device handler provides the status message functions, we need a pointer to it for device discovery (which we use a struct discover_context for). This change adds a 'handler' member to struct discover_context, to allow status reporting. Since we now have a handler, there's no need for the network pointer, so provide an accessor function instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Use device_handler_status_dev_* for device-specific statusJeremy Kerr2016-12-202-29/+15
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Add device-specific status reporting functionsJeremy Kerr2016-12-202-0/+36
| | | | | | | | | Most of our status reporting is against a specific device, so add status reporting functions that take a struct discover_device and use a stnadard prefix. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: use helpers for status reportingJeremy Kerr2016-12-201-41/+11
| | | | | | | | Now that we have helpers for simpler status reporting, use those instead of constructing a struct status everywhere. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Add helpers for status reportingJeremy Kerr2016-12-203-4/+38
| | | | | | | | | This change adds a couple of helpers for the status reporting API, allowing callers to provide just a set of printf-style arguments, rather than having to build up a struct status. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: separate status-reporting function from boot() callbackJeremy Kerr2016-12-203-14/+19
| | | | | | | | | | | | Currently, the device_discover_boot_status function is both used for internal status updates, as well as the callback passed to boot(). This change splits this into two functions; one for the latter and one for the former. The latter just has a void * for its first argument, to match the boot_status_fn type. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* types: Remove detail and progress from struct statusJeremy Kerr2016-12-202-10/+0
| | | | | | | Nothing used these, and the serialisation was buggy anyway. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* types: shorten boot_status definitionsJeremy Kerr2016-12-207-41/+38
| | | | | | | | | | | struct boot_status is a bit misnamed; we report status on things that aren't just the boot status (eg, discovery). This change refactors struct boot_status into just struct status. We give the type enum a name, and shorten the enum values to suit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Reject bootdevs with empty UUIDsSamuel Mendoza-Jonas2016-11-241-4/+5
| | | | | | | | | | If a "uuid:" label is set in the petitboot,bootdevs parameter without a matching UUID, the UUID is unintentionally accepted and set to NULL. This can cause a segfault in nc-config when device UUIDs are compared against the autoboot option. Instead treat options like this as malformed. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Deprecate petitboot,bootdev parameterSamuel Mendoza-Jonas2016-11-241-45/+6
| | | | | | | | | The "petitboot,bootdevs" parameter has been around long enough now that there shouldn't be anyone still transitioning over from the old "petitboot,bootdev" parameter. Drop this parameter to simplify the populate_bootdev_config() logic. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Remove unused max_partition_sizeSamuel Mendoza-Jonas2016-11-241-3/+0
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Support HTTP(S) proxies when downloading resourcesSamuel Mendoza-Jonas2016-11-242-0/+36
| | | | | | | | Allow the user to specify a HTTP and HTTPS proxy server. The discover server will set the http_proxy and https_proxy environment variables, enabling the proxy servers for any further HTTP(S) requests. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/pxe-parser: Parse only the first configv1.3.1Samuel Mendoza-Jonas2016-10-111-34/+59
| | | | | | | | | | | | | | | | | | | Commit 2163af5 "discover/pxe-parser: Retrieve configs asynchronously" added asynchronous loading of remote pxe filenames, but made an unintended change in behaviour to the PXE parser. Previously the parser would try a list of possible filenames, and parse the first one it found. However the above commit spawns an asynchronous job for every filename, and parses any that can be retrieved. It is a common configuration to have a machine-specific config and a 'fallback' default config, and the change means we could erroneously retrieve and parse both configs. Update the PXE parser so that asynchronous jobs are spawned sequentially. That is, spawn a job for the first filename and if not successful spawn another job for the next filename, and so on. Once a remote config is successfully retrieved, parse it and stop. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Consolidate petitboot,tty and petitboot,consoleSamuel Mendoza-Jonas2016-09-083-9/+14
| | | | | | | | | | | | | | | | | | | | Commit ce54f86 "Add petitboot,tty and track available consoles" added the petitboot,tty parameter, but the petitboot,console parameter is also recognised by Petitboot. These are ultimately handled by the 30-add-offb and 80-set-stdout hooks respectively, but exist for mostly the same purpose. We consolidate these down to just the original petitboot,console parameter. If the contents of petitboot,console have been configured by Petitboot (ie. it is of the form /dev/dev# [ Description ]) we behave as normal, otherwise we assume that petitboot,console contains a full OF path to the intended console device and do not allow it to be modified. This follows petitboot,console's original intent to be a debug aid, and takes precedence over any other use. The 80-set-stdout hook is removed as 30-add-offb now accounts for both use cases. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Use 'consoles' instead of 'tty' to refer to interfacesSamuel Mendoza-Jonas2016-09-084-25/+25
| | | | | | | 'Console' is more readily understandable and technically more correct than 'tty' for referring to the interfaces that Petitboot starts a UI on. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Avoid writing network overrides to NVRAMSamuel Mendoza-Jonas2016-09-082-0/+10
| | | | | | | | Explicitly keep track of whether the current interface config was set by an IPMI network override, and avoid overwriting any saved config unless the override was marked persistent. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/network: Add find_interface_by_uuidSamuel Mendoza-Jonas2016-09-081-21/+40
| | | | | | | | | | Currently in network_register_device() and network_unregister_device() the appropriate interface is searched for by name. However it is possible in some scenarios for multiple interfaces to have the same name, so instead search by UUID to be sure that the correct interface is being selected. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Pass UUID to discover_device_create()Samuel Mendoza-Jonas2016-09-085-13/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently discover_device_create() will search for existing discover devices by id to determine if a new device is required. However it is possible under some circumstances for distinct devices to have the same name. This is especially troublesome if the following network events are seen in network_handle_nlmsg(): - New interface, 'foo' with uuid x:x:x:x:x:x -> new discover device created with dev->device->id = 'foo' dev->uuid = x:x:x:x:x:x - New interface, 'foo' with uuid y:y:y:y:y:y -> existing device 'foo' found dev->uuid = y:y:y:y:y:y This can occur if an interface rename event arrives *after* an old name is reused, where temporarily Petitboot will see two distinct network interfaces with the same name. Now the two interfaces point to the same discover device, which can quickly result in a segfault if a 'remove' event occurs for one of the interfaces and the discover device is freed. To generally avoid this a 'uuid' parameter is added to discover_device_create(), which if present allows existing devices to be looked up by UUID rather than just their name. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Deprecate 'conf' user eventSamuel Mendoza-Jonas2016-09-085-61/+1
| | | | | | | | | | | | The 'conf' user event is functionally very similar to the 'url' event, in that both events result in downloading a specified configuration file and passing it to iterate_parsers(). The 'url' event additionally allows downloading files from a directory path and is also accessed by the UI via pb-protocol, so remove the 'conf' event and associated functions in favour of 'url' and device_handler_process_url(). Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/event: Ensure event struct exists for async callersSamuel Mendoza-Jonas2016-09-012-3/+7
| | | | | | | | | | | | | | | | When handling an event, user_event_handle_message() creates an event struct with relevant parameters. Once user_event_handle_message() is finished it frees the struct. However in the case of a dhcp or add_url event, asynchronous jobs may be spawned that will later reference the event struct. In particular this becomes a problem when pxe_process_pair() handles an IPAPPEND name/value pair and tries to access event->device. In the case of dhcp and add_url events, we avoid this by changing the event struct's talloc parent to the discover_context struct which persists until all async pxe jobs have completed. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Add encrypted file supporttpearson@raptorengineering.com2016-08-262-5/+39
| | | | | | | | | | | | In certain cases, such as network booting over an untrusted connection, it may be useful to fully encrypt and sign the kernel files. Enable fully encrypted boot using builtin keyring via the addition of the string "ENCRYPTED" to the first line of the /etc/pb-lockdown file. This disables detached (plaintext) signature verification. Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Add support for GPG signature enforcement on bootedtpearson@raptorengineering.com2016-08-2610-26/+208
| | | | | | | | | | | | | kernels and related blobs This can be used to implement a form of organization-controlled secure boot, whereby kernels may be loaded from a variety of sources but they will only boot if a valid signature file is found for each component, and only if the signature is listed in the /etc/pb-lockdown file. Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> (Minor build fixes and gpgme.m4, comment on secure boot in gpg.c)
OpenPOWER on IntegriCloud