summaryrefslogtreecommitdiff
path: root/src/network
AgeCommit message (Collapse)Author
2014-04-24networkd-wait-online: improve interoptability and enable by defaultTom Gundersen
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.
2014-04-22networkd: link - add missing curly bracketsThomas Hindoe Paaboel Andersen
introduced in 1e9be60bbabe179f5233217384f1daec757c17c7
2014-04-22networkd: link - reduce default verbosity a bitTom Gundersen
2014-04-22networkd: link - support IFLA_OPERSTATETom Gundersen
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.
2014-04-22networkd: link - don't react to successfull link upTom Gundersen
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.
2014-04-22networkd: link - log when starting clients failTom Gundersen
2014-04-22networkd: link - avoid cycle when failingTom Gundersen
2014-04-22networkd: link - stop clients when failingTom Gundersen
2014-04-21Revert "networkd: netdev - set predictable mac address when creating netdev"Tom Gundersen
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>
2014-04-20networkd: link - add explicit unmanaged stateTom Gundersen
2014-04-20networkd: link - set mac addresses when starting clientsTom Gundersen
MAC addreses are also set when NEWLINK messages are receieved, but only if the clients have already been initialized.
2014-04-20networkd: link - log changes in some common link flagsTom Gundersen
2014-04-20networkd: link - use IFF_DORMANT instead of IFF_RUNNINGTom Gundersen
Should be no functional change, but avoids spurious log messages when in operstate UNKNOWN and !IFF_LOWER_UP.
2014-04-20networkd: link - make debug logging a bit more readableTom Gundersen
Drop leading zeros which will never be used when printing the link flags.
2014-04-19networkd: manager - add a bit of debug output to udev ADD eventsTom Gundersen
2014-04-19networkd: link - track interface renamesTom Gundersen
2014-04-19network: implement masking of .link, .network and .netdev filesTom Gundersen
2014-04-19networkd: netdev - give up early when setting already set ifindexTom Gundersen
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.
2014-04-19networkd: netdev - verify name of newlink messagesTom Gundersen
2014-04-19networkd: netdev - set predictable mac address when creating netdevTom Gundersen
2014-04-19networkd: tie links to rtnl rather than udevTom Gundersen
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.
2014-04-14networkd: link - make state changing logging a bit less verboseTom Gundersen
2014-04-14networkd: link - ignore missing MAC address from NEWLINK messageTom Gundersen
The kernel may broadcast such messages, simply discard them.
2014-04-12networkd: link - require both RUNNING and LOWER_UP before using linkTom Gundersen
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.
2014-04-12networkd: wait for IFF_RUNNING rather than IFF_LOWER_UPTom Gundersen
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.
2014-04-11networkd: add an assertTom Gundersen
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>.
2014-04-11sd-ipv4ll: Add reference counting for IPv4LLPatrik Flykt
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.
2014-04-11sd-dhcp-client: Add reference counting for DHCPPatrik Flykt
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.
2014-04-08networkd: guard against NULL pointersTom Gundersen
This should never be a problem, but better be safe than sorry.
2014-04-05Fix a few return codes in error pathsZbigniew Jędrzejewski-Szmek
2014-04-03networkd: smooth transition from ipv4ll to dhcp addressUmut Tezduyar Lindskog
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.
2014-04-03networkd: drop routes when lease expiresUmut Tezduyar Lindskog
2014-03-31networkd: rewind rtnl message between passing it to functionsTom Gundersen
This makes updating link status on netdev links work again.
2014-03-31networkd: link - fix memory leakTom Gundersen
2014-03-31networkd: fix use-after-freeTom Gundersen
Free networks before links (the reverse of creation order).
2014-03-28networkd: netdev - improve logging when setting ifindexTom Gundersen
2014-03-28sd-rtnl: rework rtnl type systemTom Gundersen
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.
2014-03-24networkd: fix a couple of memory leaksLennart Poettering
2014-03-24networkd: netdev - fix error handling in set_ifindex()Tom Gundersen
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.
2014-03-24networkd: netdev - verify that newlink messages has the expected kindTom Gundersen
We match 'newlink' messages with expected netdev's based on their names. Now also make sure that the receieved link has the expected kind.
2014-03-21libsystemd-network: move network-utils from src/sharedTom Gundersen
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.
2014-03-21sd-ipv4ll/networkd: generate predictable addressesUmut Tezduyar Lindskog
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]
2014-03-21network: dhcp: create explicit host route to gatewayBrandon Philips
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
2014-03-20networkd: link - create dhcp and ipv4ll eagerlyTom Gundersen
Make sure the client objects exist for the lifetime of the Link.
2014-03-20networkd: update mac address in clients when it changesTom Gundersen
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.
2014-03-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering
safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
2014-03-15networkd: netdev - support joining already existing netdevsTom Gundersen
2014-03-14networkd: fix typoMichael Olbrich
It's HAVE_SPLIT_USR not HAVE_SPLIT_USER
2014-03-14Do not return -1 (EINVAL) on allocation errorZbigniew Jędrzejewski-Szmek
2014-03-14networkd: allow more than one static DNS serverTom Gundersen