summaryrefslogtreecommitdiffstats
path: root/discover/network.c
Commit message (Collapse)AuthorAgeFilesLines
* discover: Recognise renamed network interfacesSamuel Mendoza-Jonas2015-03-261-0/+9
| | | | | | | | | | Udev may change the name of network interfaces if persistent interface naming is used. It is important to recognise this since udev may re-use the old name for a different interface. If we receive an RTM_NEWLINK message for an existing interface, check if the name has been updated. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover/pxe: Format IPAPPEND mac addresses correctlySamuel Mendoza-Jonas2014-12-031-0/+13
| | | | | | | | | | | | | | | | | | | | | The SYSAPPEND/IPAPPEND option 2 in PXE configs requires the MAC address of the booting interface to be appended to the boot options. Previously we formatted this as "BOOTIF=01:02:03:04:05:06", but syslinux/pxelinux implementation use this format: "BOOTIF=01-01-02-03-04-05-06", where the leading '01' represents the hardware type. The relevant part of the pxelinux doc is at: http://www.syslinux.org/wiki/index.php/SYSLINUX#SYSAPPEND_bitmask Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib: Move generic file-handling code to lib/Jeremy Kerr2014-08-051-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: allow separate lifetimes for network interfaces and discover devicesJeremy Kerr2014-07-211-1/+40
| | | | | | | | | | | | | We want the network code's network interfaces to (potentially) persist remove events. For example, discover devices may be removed by a user event (this happens during a udhcpc deconfig). In this case, we want the boot options to be removed, but the struct interface needs to stay present. This change adds network_(un)_register_device functions, to allow the device handler to detach from and attach to interfaces. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Set UUID for network interface devicesJeremy Kerr2014-07-171-0/+21
| | | | | | | We want to lookup network (as well as block) devices by UUID, so set one based on the MAC address. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: leave udhcpc processes runningJeremy Kerr2014-06-301-2/+1
| | | | | | | | | | Currently, we start udhcpc with the '-n' argument, which means they'll exit if no lease is obtained. We'd prefer to leave the DHCP client running, so that any slow-to-initialise links are not left deconfigured. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: Fix incorrect udhcpc command if we have no platform definitionJeremy Kerr2014-06-301-1/+1
| | | | | | | | | | If we don't have a platform defined, we generate an invalid uchdpc command, as we've NULL-ed out the interface name. This change fixes the no-platform case to terminate *after* the interface name. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: run udhcpc process in foreground modeJeremy Kerr2014-04-031-0/+1
| | | | | | | We don't want udhcpc processes to detach, otherwise we aren't able to stop the spawned background process, which we need to do on reinit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: flush addresses when bringing an interface downJeremy Kerr2014-04-021-0/+9
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: add reinit pathJeremy Kerr2014-04-021-1/+0
| | | | | | | | | | | | | Currently, changes to settings doesn't take effect while the discover server is running. This means we need to reboot for any changes (eg, to network settings) to take effect. This change introduces a reinit path. Triggered by a configuration update, this will cause the device handler to drop all of its devices (and boot options), and restart the discovery process from the device sources. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: Fix incorrect static DNS servers in resolv.confJeremy Kerr2014-02-251-1/+1
| | | | | | | | | | | | | | | | We currently have a bug where we write NUL characters into /etc/resolv.conf, when using static DNS server configurations: With a network setting of: dns,9.0.6.11,9.0.7.1 We generate a resolv.conf containing: nameserver 9.0.6.11^@nameserver 9.0.7.1^@ This is due to an off-by-one bug when terminating the nameserver entries. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: Use platform definition for DHCP architecture IDJeremy Kerr2014-01-301-2/+10
| | | | | | | Allow a platform to specify a DHCP architecture ID, as this is platform-specific. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-config: Move config storage modules to "platform" modules in discover codeJeremy Kerr2014-01-301-1/+1
| | | | | | | | | | | | | | | | | | There's no need to include the config storage code in lib/ as only the discover server should be using it. This change moves the config-storage code to discover/, with the platform-specific parts moved to a 'struct platform'. Each platform has a probe function, which is called during init. The first probe function to return a platform is used. At present we only have the one platform, but it's now non-intrusive to add others. We keep an array of platform pointers in a separate ("platforms") section, to allow the test module to drop-in its own test "platform". Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: Send DHCP client architecture typeJeremy Kerr2014-01-171-0/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Support DHCP "pathprefix" configuration optionJeremy Kerr2014-01-171-0/+1
| | | | | | | | | | | | | | | | | 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: Bring down configured interfaces on discover server exit.Jeremy Kerr2014-01-171-1/+6
| | | | | | | | We want to down the interfaces that we brought up, so hook up the network_shutdown function to the discover exit path. Also, we only want to down interfaces that we've configured, and exclude lo. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* sysinfo: Add interface link status to sysinfo dataJeremy Kerr2013-12-181-6/+7
| | | | | | | | This changes adds a 'link' parameter to the interface information sent in sysinfo messages. The discover network code populates this from the incoming netlink messages. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: In static config mode, only configure defined interfacesJeremy Kerr2013-11-271-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Use pxeconffile for udhcpc option nameJeremy Kerr2013-11-221-0/+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>
* lib/types: use unsigned int for interface, dns and prio countsJeremy Kerr2013-11-131-2/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Fix potentially-uninitialised variablesJeremy Kerr2013-11-131-0/+1
| | | | | | | We've been compiling with --enable-debug; this change fixes some problems exposed by the optimiser. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* logging: Clean up debug logsJeremy Kerr2013-11-011-1/+1
| | | | | | | 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/network: Allow for arbitrary-sized netlink messagesJeremy Kerr2013-11-011-5/+41
| | | | | | | | | | | Currently, we drop any netlink data beyond our 4096-byte buffer. This means that we can only parse a limited number of network interfaces. This change uses recvmsg with MSG_PEEK to determine the size of an incoming netlink message before doing the actual recvmsg. This way, we can realloc our buffer to suit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: Ensure dns config buffer contains a trailling nulJeremy Kerr2013-10-211-1/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add system info messagesJeremy Kerr2013-10-091-0/+7
| | | | | | | | Add a little infrastructure for communicating information about the system to the petitboot UIs. We just send some identifying info (type and identifier), as well as the interfaces. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: register network devices with the device handlerJeremy Kerr2013-09-191-9/+21
| | | | | | | We'd like to correlate incoming network boot options with a device, so register the interface with the device hander. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: Manage network->interfaces with {add,remove}_interfaceJeremy Kerr2013-09-191-2/+14
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: ignore devices with zero MTUJeremy Kerr2013-09-191-1/+6
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: replace pb_run_cmdJeremy Kerr2013-08-191-50/+59
| | | | | | | This change replaces the pb_run_cmd() function with proper usage of the process API. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: free buffers from resolv.conf updateJeremy Kerr2013-08-161-7/+8
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: fix incorrect nameserver directive in resolv.confJeremy Kerr2013-08-161-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* network: handle DNS configJeremy Kerr2013-08-081-0/+57
| | | | | | If we have a dns config option, update resolv.conf Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config: Split interface configuration from network configurationJeremy Kerr2013-08-081-7/+7
| | | | | | | | This change moves the interface configuration into its own 'struct interface_config'. We also remove the _config suffix from the network and interface members. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: bring network interfaces down in network_shutdownJeremy Kerr2013-06-241-3/+24
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add network handlingJeremy Kerr2013-06-241-0/+426
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud