summaryrefslogtreecommitdiffstats
path: root/discover/user-event.c
Commit message (Collapse)AuthorAgeFilesLines
* pb-event: Add 'boot' user eventSamuel Mendoza-Jonas2016-05-061-0/+23
| | | | | | | | | | | Add a user event to send a boot command to the discover server. The format of the boot command is similar to the add command, eg: pb-event boot@eth0 image="http://host/image" initrd="http://host/initrd" and also recognises "id", "dtb", and "args" arguments. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: extend URL in UI to support auto-discoveryNishanth Aravamudan2015-12-181-1/+1
| | | | | | | | | | | | | The URL field currently only supports loading a particular file for static network configurations. But it makes sense in certain static network configurations to 'auto-discover' a file like petitboot does with DHCP -- based off the MAC address and IP. Extend device_handler_process_url to take those as parameters, and toggle off the URL ending in a '/' to indicate whether to 'auto-discover' or directly load the specified URL. Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com> Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover: Null-terminate buffer in user_event_process()Samuel Mendoza-Jonas2015-12-181-2/+4
| | | | | | Fixes Coverity defect #30480 Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover: Enable 'url' pb-eventsSamuel Mendoza-Jonas2014-07-281-0/+17
| | | | | | | | | | Adds a new option to pb-event; ./pb-event url@dev url=scheme://path/to/petitboot.conf Specifies a remote conf file to parse for boot options Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: move device sources to the device handlerJeremy Kerr2014-04-021-8/+3
| | | | | | | | | | | | | | | | | | | | Currently, the pb-discover main() function initialises the device handler and the device sources. We want to eventually be able to re-init the device sources, which will be initiated by the handler. In this case, the handler will need references to the sources. This change moves the creation of the device sources to be internal to the handler. This way, the device handler gets a reference to everything, without having to pass pointers around in main(). We also remove the _destroy functions, as we handle everything through talloc destructors, as all sources are parented to the handler. We also change user_event_init and udev_init to take the handler as the first ('context') argument, to make them consistent with network_init. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: Fix prefix autodetection when bootfile is in the root dirJeremy Kerr2014-02-271-2/+3
| | | | | | | | | | | | | | | | | | | | | Currently, if the bootfile doesn't contain a directory, the path we use for config file resolution will use the bootfile as the first component of path. For example, if bootfile is: pxelinux.0 the config files requested will be: pxelinux.0/<mac> pxelinux.0/<ips> pxelinux.0/default For cases where bootfile is a single file, we need to use a blank prefix. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Use lowercase hex chars for MAC-address-based conf requestsJeremy Kerr2014-01-221-1/+1
| | | | | | | The de-facto PXELINUX standard specifies lowercase characters for the MAC addresses, so change our reuqests to suit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* utils/pb-udhcpc: Unify references to DHCP bootfile parameterJeremy Kerr2014-01-211-2/+2
| | | | | | | | | | | | | | udhcpc may pass the bootfile parameter as either $bootfile or $boot_file, depending on whether the option is present in the BOOTP header, or as a DHCP vendor option. We have code in pb-udhcpc to unify this to $bootfile, but we only use the unified value in one of the user events. This change uses the correct value of bootfile, and fixes the check to conditionally generate the explicit add event. We also need to update the user-event code to use the right event parameter name. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Support DHCP "pathprefix" configuration optionJeremy Kerr2014-01-171-36/+57
| | | | | | | | | | | | | | | | | This change implements support for the DHCP "pathprefix" option. We use the following logic: - If pathprefix is present and a full URL, we base the config file location on pathprefix + conffile - If pathprefix is present but not a full URL, we use it as the path component of the URL, and pick up the host from other parameters in the DHCP response - If no pathprefix is present, we determine the configuration prefix from the DHCP bootfile parameter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't rely on ctx->conf_url side-effect in user_event_parse_conf_urlJeremy Kerr2014-01-171-2/+3
| | | | | | | | Currently, user_event_parse_conf_url sets dc->conf_url if it detects we have a full URL (rather than a base URL). This is a little too subtle, so replace it with an explicit output parameter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* configure: Use AC_GNU_SOURCEJeremy Kerr2013-12-181-1/+0
| | | | | | | Rather than #defining _GNU_SOURCE in our .c files, we can define this from config.h instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Use pxeconffile for udhcpc option nameJeremy Kerr2013-11-221-1/+1
| | | | | | | | | | | | The patch that went upstream for udhcpc's option 209 handling uses the option name 'pxeconffile' rather than 'conffile', and it was added as a non-default option: http://git.busybox.net/busybox/commit/?id=d3092c99ae90f This change uses the new name, and explicilty requests this option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Change parsers to explicitly request configuration filesNeelesh Gupta2013-11-061-43/+231
| | | | | | | | | | | | | | | | | | | Add a new function parser_request_url() to read the data from configuration files present remotely. We deprecate iterate_parser_files() and download_config() functions along with the 'filenames' and 'method' members of the 'parser' structure so that individual parsers would now require to request the configuration files data from the parser code and doesn't necessarily export the list of configuration files. Add the support to handle incoming DHCP event, done by passing all the relevant environment variables of the udhcpc to the discover code. Also, update the pxe parser code to populate the list of configuration file names as per PXELINUX convention of fallback names using mac and ip addresses of the booting machine. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* logging: Clean up debug logsJeremy Kerr2013-11-011-6/+6
| | | | | | | We have quite a few pb_logs which should be pb_debug. This change moves developer-specific info to pb_debug. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Remove unnecessary event passingJeremy Kerr2013-09-191-1/+168
| | | | | | | | | | | | | | | Currently, we pass "events" between the udev, user-event and device-handler layers. These events all get sent through device_handler_event, then de-multiplexed to an appropriate handler, depending on their source. Instead, just export relevant device_handler functions, and have the (old) event sources call these functions directly. This also means we can include a lot more of the device hander code in the parser tests. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: remove unused user_event_triggerJeremy Kerr2013-08-191-11/+0
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: Add timeout waitersJeremy Kerr2013-06-241-1/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/user-event: better event debugging outputJeremy Kerr2013-05-071-9/+19
| | | | | | | | | | | | | | | We don't currently handle conf events very well: user_event remove event: device: /net/eth0 name => (null) image => (null) args => (null) This change prints the event action properly, and prints all event params. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* waiter: Don't rely on global variables to keep waiter stateJeremy Kerr2013-04-101-2/+3
| | | | | | | | | Rather than defining the set of waiters (and pollfds) in waiter.c, add a struct waitset to contain these. A waitset is created with waitset_create, which is passed to the waiter_* functions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add discover user eventGeoff Levand2009-06-301-0/+175
Add a gereric event interface to pb-discover. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud