summaryrefslogtreecommitdiff
path: root/src/network
AgeCommit message (Collapse)Author
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
2014-03-14networkd: fix creation of runtime dirs at startupTom Gundersen
This allows us to drop the repeated attempted creations of the runtime dirs during runtime.
2014-03-14networkd: lease - store (up to) one dhcp lease file per interfaceTom Gundersen
This removes an accidentally left-over test fragment.
2014-03-11networkd: rework startupTom Gundersen
Open all listenerns before loading configuration.
2014-03-09network: link - simplify code a bit and remove some debug loggingTom Gundersen
2014-03-08networkd: fix confusion from missing bracesZbigniew Jędrzejewski-Szmek
Fixup for 76800848f281c3 'networkd: link - degrade failed UP to warning'.
2014-03-08networkd: link - degrade failed UP to warningTom Gundersen
Something else may still bring the link up, so don't enter failed state prematurely.
2014-03-07Make tables for DEFINE_STRING_TABLE_LOOKUP consistentDaniel Mack
Bring some arrays that are used for DEFINE_STRING_TABLE_LOOKUP() in the same order than the enums they reference. Also, pass the corresponding _MAX value to the array initalizer where appropriate.
2014-03-07networkd: use new rtnl_message_read() APITom Gundersen
2014-03-06sd-rtnl/networkd: use new rtnl_message_read() API and drop helperTom Gundersen
With the new sd_rtnl_message_read_string(), there is no longer a need for rtnl_message_get_ifname().
2014-03-05networkd: listen to changes to the MAC addressTom Gundersen
Bridges will change their MAC address when other devices are enslaved. We need the correct MAC address to acquire a DHCP lease, so take note of it whenever it changes.
2014-03-05networkd: restore logic for enslaving to a master bonding interfaceMark Oteiza
This partially reverts commit 54abf46, which unintentionally removed the enslaving support for bonding interfaces
2014-03-03sd-network: IPv4 link-local support [v2]Umut Tezduyar Lindskog
Implements IPv4LL with respect to RFC 3927 (http://tools.ietf.org/rfc/rfc3927.txt) and integrates it with networkd. Majority of the IPv4LL state machine is taken from avahi (http://avahi.org/) project's autoip. IPv4LL can be enabled by IPv4LL=yes under [Network] section of .network file. IPv4LL works independent of DHCP but if DHCP lease is aquired, then LL address will be dropped. [tomegun: removed a trailing newline and a compiler warning]
2014-03-03networkd: wait-online - fix typoTom Gundersen
2014-03-01networkd-wait-online: use automatic cleanupThomas Hindoe Paaboel Andersen
2014-02-28sd-network: turn states 'unknown' and 'unmanaged' into errnosTom Gundersen
2014-02-28networkd: add networkd-wait-onlineTom Gundersen
This is mostly a proof of concept to try sd-network, so we don't hook it up with a .service file quite yet. We probably want it to be more clever about deciding when we are 'online'. The binary will wait for at least one network managed by networkd, and until all networks managed by networkd are configured.
2014-02-28sd-network: add new libraryTom Gundersen
This is similar to sd-login, but exposes the state of networkd rather than logind. Include it in libsystemd-dhcp and rename it to libsystemd-network.
2014-02-25networkd: add basic support for MACVLANsTom Gundersen
2014-02-22networkd: handle SIGINT and SIGTERMTom Gundersen
2014-02-22test: always use assert_se in testsTom Gundersen
2014-02-21net-util: match on the driver as exposed by ethtool if DRIVER not setTom Gundersen
Also fix a copy-paste error that broke matching on interface name.
2014-02-21.network/.netdev/.link: allow to match on architectureTom Gundersen
2014-02-20networkd: netdev - allow filtering on kernel cmdline, host and virtTom Gundersen
2014-02-20network/link: Match - filter on kernel cmdline, host and virtTom Gundersen
2014-02-20api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering
first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
2014-02-19make gcc shut upLennart Poettering
If -flto is used then gcc will generate a lot more warnings than before, among them a number of use-without-initialization warnings. Most of them without are false positives, but let's make them go away, because it doesn't really matter.
2014-02-19networkd: dhcp - log when lease is lostTom Gundersen
2014-02-19networkd: link - only reset transient hostname if it was set by usTom Gundersen