summaryrefslogtreecommitdiff
path: root/src/udev/net/link-config.c
AgeCommit message (Collapse)Author
2014-06-04udev: link-config - fix mem leakTom Gundersen
Reported by Kay.
2014-04-21silence warningsThomas Hindoe Paaboel Andersen
2014-04-20udev: link-config - treat any non-random mac address as persistentTom Gundersen
The address may be already changed by other processes, or set when creating the netdev from userspace.
2014-04-19network: implement masking of .link, .network and .netdev filesTom 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-05Fix a few return codes in error pathsZbigniew Jędrzejewski-Szmek
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-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-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-02-22udev: net - allow MTU and Speed to be specified with unitsTom Gundersen
This also changes the names to MTUBytes and BitsPerSecond, respectively. Notice that the speed was mistakenly documented to be in bytes before this change.
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-21udev - link-setup - expose ID_NET_DRIVERTom Gundersen
This is the same as shown by 'ethtool -i <ifname>', and is sometimes set even though DRIVER is not.
2014-02-21.network/.netdev/.link: allow to match on architectureTom 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-19udev: net-config - allow interface names to be set from the hwdbTom Gundersen
2014-02-18net-match: fix Driver= matchTom Gundersen
It should match on the driver of the parent device.
2014-01-08No need to canonicalize fixed pathsZbigniew Jędrzejewski-Szmek
2013-12-24log: log_error() and friends add a newline after each line anyway, so avoid ↵Lennart Poettering
including it in the log strings
2013-12-22shared: switch our hash table implementation over to SipHashLennart Poettering
SipHash appears to be the new gold standard for hashing smaller strings for hashtables these days, so let's make use of it.
2013-12-17udev link-config: add asserts to silence scan-buildThomas Hindoe Paaboel Andersen
2013-12-15Fix a few resource leaks in error pathsZbigniew Jędrzejewski-Szmek
https://bugzilla.redhat.com/show_bug.cgi?id=1043304
2013-12-03trivial coding style clean upsThomas Hindoe Paaboel Andersen
- Add space between if/for and the opening parentheses - Place the opening brace on same line as the function (not for udev) From the CODING_STYLE Try to use this: void foo() { } instead of this: void foo() { }
2013-11-28Revert "link-config: match length for kernel commandline option"Tom Gundersen
This reverts commit da66338e17f4df04d9d7cc22ec971b416d57761e. It is superseeded by 70f75a523b16ad495a7791d595ee3eececf75953
2013-11-25udev: net_setup_link - don't use Description as AliasTom Gundersen
Use Description only internally, and allow Alias to be set as a separate option. For instance SNMP uses ifalias for a specific purpose, so let's not write to it by default.
2013-11-08link-config: Fix typo in log_warningDave Reisner
2013-11-08link-config: match length for kernel commandline optionDave Reisner
This prevents enable_name_policy() from invariably returning false when it matches a zero length string at the end of /proc/cmdline.
2013-11-06util: unify reading of /proc/cmdlineLennart Poettering
Instead of individually checking for containers in each user do this once in a new call proc_cmdline() that read the file only if we are not in a container.
2013-11-05net-util: don't use libudevTom Gundersen
Should fix linking with old toolchain.
2013-11-04net-config: start split out matching and parsing logicTom Gundersen
Move this to src/share/net-util.c, so it can be used elsewhere.
2013-10-30link-config: support --enable-split-usrDave Reisner
2013-10-30udev: config-link - one less log_infoTom Gundersen
2013-10-30udev: link-config - less verbose loggingTom Gundersen
Also reinstate print to kmsg when renaming netif.
2013-10-30udev: link-config - let udevd set the ifnameTom Gundersen
2013-10-29rtnl: move set_link_properties to rtnl-utilsTom Gundersen
2013-10-29udev: link-config - split connection to sockets from loading of configsTom Gundersen
We want to load the config in _init, but not connect to the sockets before we are forked.
2013-10-29rtnl: introduce default timeoutTom Gundersen
We set it to 10 secs (as we are only communicating with the kernel, it seems we should be able to bail out sooner than sd-bus, which uses 25). When passing timout 0, the default is used, use this in link-config.
2013-10-29udev: link-config - use safe_atou instead of strtoulTom Gundersen
2013-10-29udev: link-config - use proper return valuesTom Gundersen
Not sure if -ENOENT is the correct return value for when no persistent network name is set, but couldn't think of anything better.
2013-10-29udev: link-config - use _cleanup_ macro locallyTom Gundersen
2013-10-29path_check_timestamp: only keep the most recent timestampTom Gundersen
There is no point in keeping one timestamp for each directory, as we only ever care about the most recent one.
2013-10-29udev: link-config - add proper parsingTom Gundersen
2013-10-29network: move configuration to /etc/systemd/networkTom Gundersen
This is private configuraiton, so let's not pollute the namespace (and hence make Debian happy :) ).
2013-10-28udev: link-config - add mac address policyTom Gundersen
This introduces a new key MACAddressPolicy. The possible policies are 'persistent' and 'random'. 'persistent' will do nothing if the current address is the hardware address, but if the hardware does not have an address (or another address is set for whatever reason), we will generate an address which will be random, but persistent between boots (based on machineid and persistent netif name). 'random' will do nothing if the kernel already set a random address, otherwise it will generate a random one and use that instead. This patch sets MACAddressPolicy=persistent in the default .link file.
2013-10-28udev: link-config - move naming policy from udev rulesTom Gundersen
This introduces a new key NamePolicy, which takes an ordered list of naming policies. The first successful one is applide. If all fail the value of Name (if any) is used. The possible policies are 'onboard', 'slot', 'path' and 'mac'. This patch introduces a default link file, which replaces the equivalent udev rule.
2013-10-27udev: link-config - sanity check the ifname and mac addressTom Gundersen
2013-10-27udev: link-config: add rtnl supportTom Gundersen
This adds support for setting the mac address, name and mtu. Example: [Link] MTU=1450 MACAddress=98:76:54:32:10:ab Name=wireless0
2013-10-26udev: link-config: add ethtool supportTom Gundersen
This adds support for setting the link speed, duplex and WakeOnLan settings. Example: [Link] SpeedMBytes=100 Duplex=half WakeOnLan=magic
2013-10-26udev: add network link configuration toolTom Gundersen
This tool applies hardware specific settings to network devices before they are announced via libudev. Settings that will probably eventually be supported are MTU, Speed, DuplexMode, WakeOnLan, MACAddress, MACAddressPolicy (e.g., 'hardware', 'synthetic' or 'random'), Name and NamePolicy (replacing our current interface naming logic). This patch only introduces support for Description, as a proof of concept. Some of these settings may later be overriden by a network management daemon/script. However, these tools should always listen and wait on libudev before touching a device (listening on netlink is not enough). This is no different from how things used to be, as we always supported changing the network interface name from udev rules, which does not work if someone has already started using it. The tool is configured by .link files in /etc/net/links/ (with the usual overriding logic in /run and /lib). The first (in lexicographical order) matching .link file is applied to a given device, and all others are ignored. The .link files contain a [Match] section with (currently) the keys MACAddress, Driver, Type (see DEVTYPE in udevadm info) and Path (this matches on the stable device path as exposed as ID_PATH, and not the unstable DEVPATH). A .link file matches a given device if all of the specified keys do. Currently the keys are treated as plain strings, but some limited globbing may later be added to the keys where it makes sense. Example: /etc/net/links/50-wireless.link [Match] MACAddress=98:f2:e4:42:c6:92 Path=pci-0000:02:00.0-bcma-0 Type=wlan [Link] Description=The wireless link