summaryrefslogtreecommitdiff
path: root/src/udev/net
AgeCommit message (Collapse)Author
2014-09-18udev: link-config: remove unneded linux/netdevice.h includeEmil Renner Berthing
2014-09-09udev: net_setup_link - open ethtool and rtnl connections lazilyTom Gundersen
2014-09-08udev: link-config - only set *name on successTom Gundersen
2014-08-14udev: link-config - fix crash due to missing hwaddrTom Gundersen
Reported by: master.nosferatu@gmail.com
2014-08-12networkd: link - split out dhcp4 handlingTom Gundersen
2014-08-12udev: link-config - fix naming policyTom Gundersen
Don't exit the name-finding loop when the 'kernel' policy is detected. We should still find a fallback name if possible in the (very likely) case that no kernel name is set at all.
2014-08-12udev: link-config - whitespaceTom Gundersen
Don't overflow 80 cols unneccessarily (we are ok with doing it when it improves readability, but that's not the case here).
2014-08-08udev: link_setup - respect kernel name assign policyTom Gundersen
Newer kernels export meta-information about the origin of an ifname. Respect this from the ifname rename logic. We do not rename any interfaces that was originally named by userspace, nor once which have already been renamed from userspace. Moreover, we optionally do not (the default) rename interfaces which the kernel claims to have named in a predictable way.
2014-07-31Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek
String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
2014-07-16Be more careful when checking for empty filesZbigniew Jędrzejewski-Szmek
If we want to avoid reading a totally empty file, it seems better to check after we have opened the file, not before.
2014-07-16Let config_parse open file where applicableZbigniew Jędrzejewski-Szmek
Special care is needed so that we get an error message if the file failed to parse, but not when it is missing. To avoid duplicating the same error check in every caller, add an additional 'warn' boolean to tell config_parse whether a message should be issued. This makes things both shorter and more robust wrt. to error reporting.
2014-07-15Constify ConfigTableItem tablesZbigniew Jędrzejewski-Szmek
2014-07-07udev: link_config - ignore errors due to missing MAC addressTom Gundersen
Otherwis, we get misleading error messages on links with MACs. Reported by Leonid Isaev.
2014-07-03udev: net_setup_link - add a bit more loggingTom Gundersen
2014-06-13udev: fix invalid free() in enable_name_policy()Andreas Henriksson
static bool enable_name_policy(...) in ./src/udev/net/link-config.c calls proc_cmdline(...) to get "line" initialized, but proc_cmdline(...) does not guarantee that atleast when both conditions (detect_container(NULL) > 0) and read_full_file(...) returned < 0.
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-23core: clean up some confusing regarding SI decimal and IEC binary suffixes ↵Lennart Poettering
for sizes According to Wikipedia it is customary to specify hardware metrics and transfer speeds to the basis 1000 (SI decimal), while software metrics and physical volatile memory (RAM) sizes to the basis 1024 (IEC binary). So far we specified everything in IEC, let's fix that and be more true to what's otherwise customary. Since we don't want to parse "Mi" instead of "M" we document each time what the context used is.
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-21net: initialize structs when declaringTom Gundersen
2014-02-21net: initialize structs when declaring them/do not clobber caller variablesLennart Poettering
Just two minor style fixes...
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-25conf-parser: distinguish between multiple sections with the same nameTom Gundersen
Pass on the line on which a section was decleared to the parsers, so they can distinguish between multiple sections (if they chose to). Currently no parsers take advantage of this, but a follow-up patch will do that to distinguish [Address] Address=192.168.0.1/24 Label=one [Address] Address=192.168.0.2/24 Label=two from [Address] Address=192.168.0.1/24 Label=one Address=192.168.0.2/24 Label=two
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-07net-util: call ioctl() only if necessaryMichal Sekletar
In case when update of current values is not necessary we still might end up calling ioctl(), because need_update variable is not explicitly initialized.
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.