summaryrefslogtreecommitdiff
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
* networkd: link - don't fail a link if RF kill is activeTom Gundersen2014-04-281-1/+2
|
* networkd: netdev - log when loading a .netdev fileTom Gundersen2014-04-281-0/+2
|
* networkd: do not complain about IFF_RUNNINGUmut Tezduyar Lindskog2014-04-271-1/+1
| | | | | | | | Otherwise: eth0: unknown link flags gained: 0x00040 (ignoring) [tomegun: hiding these messages is ok, as IFF_RUNNING is redundant and can be deduced from operstate and IFF_LOWER_UP]
* networkd-wait-online: refactor a bitTom Gundersen2014-04-261-39/+34
| | | | | | Clarify that we are waiting for any link to reach 'carrier' state, regardless of who manages it. This will be useful when we add support for waiting for more operational states.
* networkd-wait-online: drop config file and add commandline options insteadTom Gundersen2014-04-265-69/+80
|
* networkd-wait-online: improve interoptability and enable by defaultTom Gundersen2014-04-246-28/+252
| | | | | | | | | | | | | | | | | | | | | | | | | To make sure we don't delay boot on systems where (some) network links are managed by someone else we don't block if something else has successfully brought up a link. We will still block until all links we are aware of that are managed by networkd have been configured, but if no such links exist, and someone else have configured a link sufficiently that it has a carrier, it may be that the link is ready so we should no longer block. Note that in all likelyhood the link is not ready (no addresses/routes configured), so whatever network managment daemon configured it should provide a similar wait-online service to block network-online.target until it is ready. The aim is to block as long as we know networking is not fully configured, but no longer. This will allow systemd-networkd-wait-online.service to be enabled on any system, even if we don't know whether networkd is the main/only network manager. Even in the case networking is fully configured by networkd, the default behavior may not be sufficient: if two links need to be configured, but the first is fully configured before the second one appears we will assume the network is up. To work around that, we allow specifying specific devices to wait for before considering the network up. This unit is enabled by default, just like systemd-networkd, but will only be pulled in if anyone pulls in network-online.target.
* networkd: link - add missing curly bracketsThomas Hindoe Paaboel Andersen2014-04-221-0/+2
| | | | introduced in 1e9be60bbabe179f5233217384f1daec757c17c7
* networkd: link - reduce default verbosity a bitTom Gundersen2014-04-221-4/+4
|
* networkd: link - support IFLA_OPERSTATETom Gundersen2014-04-222-58/+51
| | | | | | | This properly detects the state of the link based on both the link flags and the operstate. Moreover, always log state-changes even if we are not yet managing the link.
* networkd: link - don't react to successfull link upTom Gundersen2014-04-221-3/+5
| | | | | | Avoid having two code-paths racing with eacother to do the same thing. The change of flags will be detected in the normal way, so only use the link_up_handler to detect if the 'up' failed and in that case fail the link.
* networkd: link - log when starting clients failTom Gundersen2014-04-221-2/+8
|
* networkd: link - avoid cycle when failingTom Gundersen2014-04-221-0/+3
|
* networkd: link - stop clients when failingTom Gundersen2014-04-221-0/+35
|
* Revert "networkd: netdev - set predictable mac address when creating netdev"Tom Gundersen2014-04-211-55/+0
| | | | | | | | | | | | | | This reverts commit cdc85c875b842b9309f72caefc51c262f521cf92. There appears to be a kernel bug that (among other things) cause bridges not to get a bridge id set when supplying IFLA_ADDRESS when creating the netdev. Simply revert the whole thing until we sort this out in the kernel. See: http://www.spinics.net/lists/netdev/msg279807.html Reported-by: C. R. Oldham <cr@saltstack.com>
* networkd: link - add explicit unmanaged stateTom Gundersen2014-04-202-3/+18
|
* networkd: link - set mac addresses when starting clientsTom Gundersen2014-04-201-0/+8
| | | | | MAC addreses are also set when NEWLINK messages are receieved, but only if the clients have already been initialized.
* networkd: link - log changes in some common link flagsTom Gundersen2014-04-201-1/+38
|
* networkd: link - use IFF_DORMANT instead of IFF_RUNNINGTom Gundersen2014-04-201-14/+15
| | | | | Should be no functional change, but avoids spurious log messages when in operstate UNKNOWN and !IFF_LOWER_UP.
* networkd: link - make debug logging a bit more readableTom Gundersen2014-04-201-2/+3
| | | | Drop leading zeros which will never be used when printing the link flags.
* networkd: manager - add a bit of debug output to udev ADD eventsTom Gundersen2014-04-191-30/+10
|
* networkd: link - track interface renamesTom Gundersen2014-04-191-0/+12
|
* network: implement masking of .link, .network and .netdev filesTom Gundersen2014-04-192-0/+10
|
* networkd: netdev - give up early when setting already set ifindexTom Gundersen2014-04-191-18/+23
| | | | | We may receive RTM_NEWLINK messages with missing LINKINFO after the initial NEWLINK message, don't bother verifying these, just drop out early after checking that the ifindex is not in conflict.
* networkd: netdev - verify name of newlink messagesTom Gundersen2014-04-191-1/+16
|
* networkd: netdev - set predictable mac address when creating netdevTom Gundersen2014-04-191-0/+55
|
* networkd: tie links to rtnl rather than udevTom Gundersen2014-04-197-303/+266
| | | | | | | | | | This essentially swaps the roles of rtnl and udev in networkd. After this change libudev is only used for waiting for udev to initialize devices and to get udev-specific information needed for some [Match] attributes. This in particular simplifies the code in containers where udev is not really useful, but also simplifies things and reduces round-trips in the non-container case.
* networkd: link - make state changing logging a bit less verboseTom Gundersen2014-04-141-4/+4
|
* networkd: link - ignore missing MAC address from NEWLINK messageTom Gundersen2014-04-141-3/+3
| | | | The kernel may broadcast such messages, simply discard them.
* networkd: link - require both RUNNING and LOWER_UP before using linkTom Gundersen2014-04-121-8/+23
| | | | | Usually RUNNING implies LOWER_UP, but for drivers that don't support oper state, RUNNING can also mean that the state is unknown. In that case we should just trust LOWER_UP directly.
* networkd: wait for IFF_RUNNING rather than IFF_LOWER_UPTom Gundersen2014-04-121-31/+46
| | | | | | | | | | The interface is not fully ready until it enterns RUNNING. This was causing problems with sending out DHCP messages before the interface was ready, so they would get lost. In particular this affected DHCP INIT-REBOOT, as it relies on the first package sent being successful (or it will fall back to a full reboot). Also improve the logging a lot, to make future debugging of link state a lot easier.
* networkd: add an assertTom Gundersen2014-04-111-2/+1
| | | | | | | This error should never happen, so replace the check with an assert. The check was anyway broken due to an uninitialized return value. Reported by Thomas Hindoe Paaboel Andersen <phomes@gmail.com>.
* sd-ipv4ll: Add reference counting for IPv4LLPatrik Flykt2014-04-111-1/+1
| | | | | | | | | | Similar to DHCP, the IPv4LL library user can decide to free the LL client any time the callback is called. Guard against freeing the LL client in the callback by introducing proper reference counting. Also update code using the IPv4LL library to properly handle a returned NULL from the notify and stop functions if the IPv4LL client was freed.
* sd-dhcp-client: Add reference counting for DHCPPatrik Flykt2014-04-111-1/+1
| | | | | | | | | | | The DHCP library user can decide to free the DHCP client any time the callback is called. After the callback has been called, other computations may still be needed - the best example being a full restart of the DHCP procedure in case of lease expiry. Fix this by introducing proper reference counting. Properly handle a returned NULL from the notify and stop functions if the DHCP client was freed.
* networkd: guard against NULL pointersTom Gundersen2014-04-081-2/+7
| | | | This should never be a problem, but better be safe than sorry.
* Fix a few return codes in error pathsZbigniew Jędrzejewski-Szmek2014-04-052-2/+2
|
* networkd: smooth transition from ipv4ll to dhcp addressUmut Tezduyar Lindskog2014-04-033-14/+180
| | | | | | | | | | | | | | | | | | Currently when both ipv4ll and dhcp are enabled, ipv4ll address (if one has been claimed) is removed when dhcp address is aquired. This is not the best thing to do since there might be clients unaware of the removal trying to communicate. This patch provides a smooth transition between ipv4ll and dhcp. If ipv4ll address was claimed [1] before dhcp, address is marked as deprecated. Deprecated address is still a valid address and packets can be received on it but address cannot be selected as a source address. If dhcp lease cannot be extended, then ipv4ll address is marked as valid again. [1] If there is no collision, claiming IPv4LL takes between 4 to 7 seconds.
* networkd: drop routes when lease expiresUmut Tezduyar Lindskog2014-04-031-0/+22
|
* networkd: rewind rtnl message between passing it to functionsTom Gundersen2014-03-312-26/+36
| | | | This makes updating link status on netdev links work again.
* networkd: link - fix memory leakTom Gundersen2014-03-311-1/+1
|
* networkd: fix use-after-freeTom Gundersen2014-03-311-3/+3
| | | | Free networks before links (the reverse of creation order).
* networkd: netdev - improve logging when setting ifindexTom Gundersen2014-03-282-13/+16
|
* sd-rtnl: rework rtnl type systemTom Gundersen2014-03-281-31/+21
| | | | | | | | | | | | Use a static table with all the typing information, rather than repeated switch statements. This should make it a lot simpler to add new types. We need to keep all the type info to be able to create containers without exposing their implementation details to the users of the library. As a freebee we verify the types of appended/read attributes. The API is extended to nicely deal with unions of container types.
* networkd: fix a couple of memory leaksLennart Poettering2014-03-242-0/+10
|
* networkd: netdev - fix error handling in set_ifindex()Tom Gundersen2014-03-241-9/+21
| | | | | | | Firstly, remove stray assert(). Also be a bit stricter when verifying the received info. If we get an applicable newlink message that we can't make sense of, we will now enter NETDEV_FAILED, as we cannot reasonably continue without knowing the ifindex of our device.
* networkd: netdev - verify that newlink messages has the expected kindTom Gundersen2014-03-243-17/+41
| | | | | We match 'newlink' messages with expected netdev's based on their names. Now also make sure that the receieved link has the expected kind.
* libsystemd-network: move network-utils from src/sharedTom Gundersen2014-03-218-7/+8
| | | | | | This does not belong in shared as it is mostly a detail of our networking subsystem. Moreover, now we can use libudev here, which will simplify things.
* sd-ipv4ll/networkd: generate predictable addressesUmut Tezduyar Lindskog2014-03-212-0/+13
| | | | | | | | | | | | | | | | | | | | Increase the chance of using the same link local address between reboots. The pseudo random sequence of addresses we attempt is now seeded with data that is very likely to stay the same between reboots, but at the same time be unique to the specific machine/nic. First we try to use the ID_NET_NAME_* data from the udev db combined with the machin-id, which is guaranteed to be unique and persistent, if available. If that is not possible (e.g., in containers where we don't have access to the udev db) we fallback to using the MAC address of the interface, which is guaranteed to be unique, and likely to be persistent. [tomegun: three minor changes: - don't expose HASH_KEY in the siphash24 header - get rid of some compile-warnings (and some casts at the same time), by using uint8_t[8] rather than uint64_t in the api - added commit message]
* network: dhcp: create explicit host route to gatewayBrandon Philips2014-03-211-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | Some DHCP servers gives you a netmask of 255.255.255.255 so the gateway is not routable. Other DHCP client implementations look through the existing routes to figure out if they should add an explicit host route. See below for a link. However, it makes sense to just create the route explicitly whether it is needed or not since it is explicit, makes the dhcp route entries independent of other entries and saves us from knowing the state of the kernel tables. After patch route table on a machine with a network (common case): default via 10.0.2.2 dev ens3 10.0.2.0/24 dev ens3 proto kernel scope link src 10.0.2.15 10.0.2.2 dev ens3 scope link After patch route table on a machine without a network (this case): default via 10.240.0.1 dev ens4v1 10.240.0.1 dev ens4v1 scope link The code from dhcpcd that works around this issue is on line 637. https://android.googlesource.com/platform/external/dhcpcd/+/master/configure.c
* networkd: link - create dhcp and ipv4ll eagerlyTom Gundersen2014-03-201-48/+44
| | | | Make sure the client objects exist for the lifetime of the Link.
* networkd: update mac address in clients when it changesTom Gundersen2014-03-202-22/+37
| | | | | | | | Pass the mac address on to ipv4ll and dhcp clients so they always have up-to-date information, and may react appropriately to the change. Also drop setting the mac address from uevent, and only log when the address actually changes.