summaryrefslogtreecommitdiff
path: root/src/network
AgeCommit message (Collapse)Author
2014-11-28treewide: another round of simplificationsMichal Schmidt
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: yet more log_*_errno + return simplificationsMichal Schmidt
Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
2014-11-28treewide: simplify log_*_errno(r,...) immediately followed by "return r"Michal Schmidt
2014-11-28treewide: more log_*_errno() conversions, multiline callsMichal Schmidt
Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-11-28networkd: update logging macros for parameter order, and errno, to match ↵Lennart Poettering
rest of the code
2014-11-28networkd: remove duplicate macro definitionsLennart Poettering
2014-11-27log: rearrange log function namingLennart Poettering
- Rename log_meta() → log_internal(), to follow naming scheme of most other log functions that are usually invoked through macros, but never directly. - Rename log_info_object() to log_object_info(), simply because the object should be before any other parameters, to follow OO-style programming style.
2014-11-27log: add an "error" parameter to all low-level logging calls and intrdouce ↵Lennart Poettering
log_error_errno() as log calls that take error numbers This change has two benefits: - The format string %m will now resolve to the specified error (or to errno if the specified error is 0. This allows getting rid of a ton of strerror() invocations, a function that is not thread-safe. - The specified error can be passed to the journal in the ERRNO= field. Now of course, we just need somebody to convert all cases of this: log_error("Something happened: %s", strerror(-r)); into thus: log_error_errno(-r, "Something happened: %m");
2014-11-27networkd: fix kernel rtnl receive buffer overrun errorAlin Rauta
We got the following error when running systemd on a device with many ports: "rtnl: kernel receive buffer overrun Event source 'rtnl-receive-message' returned error, disabling: No buffer space available" I think the kernel socket receive buffer queue should be increased. The default value is taken from: "/proc/sys/net/core/rmem_default", but we can overwrite it using SO_RCVBUF socket option. This is already done in networkd for other sockets. For example, the bus socket (sd-bus/bus-socket.c) has a receive queue of 8MB. In our case, the default is 208KB. Increasing the buffer receive queue for manager socket to 512KB should be enough to get rid of the above error. [tomegun: bump the limit even higher to 8M]
2014-11-27networkd: route - allow routes without a gatewayGavin Li
For IPv6, the kernel returns EINVAL if a route is added with the RTA_GATEWAY attribute set to in6addr_any (::). A route without a gateway is useful in some situations, such as layer 3 tunneling (sit, gre, etc.). This patch prevents the RTA_GATEWAY attribute from being added when route.in_addr is ip6addr_any (::).
2014-11-18sd-dhcp-lease: expose load/save functionsTom Gundersen
Based on patch by Dan Williams.
2014-11-08network: fix typoRami Rosen
IFLA_IPTUN_LINK -> VETH_INFO_PEER
2014-11-06s/commandline/command line/gHarald Hoyer
2014-11-06shared: rename condition-util.[ch] to condition.[ch]Lennart Poettering
Now that we only have one file with condition implementations around, we can drop the -util suffix and simplify things a bit.
2014-11-04sd-event: rename sd_event_source_set_name() to sd_event_source_get_name()Lennart Poettering
To mirror the recent name change of the concept for sd_bus objects, follow the same logic for sd_event_source objects, too.
2014-10-29networkd: add Patch of MTU discovery for IPIP and GRESusant Sahani
Add path of MTU disovery for IPIP and GRE Kind of tunnels
2014-10-29networkd: add back path of MTU discovery for SITSusant Sahani
2014-10-27networkd: network - if no prefixlength is given, try to deduce one from the ↵Tom Gundersen
address class In case of a class E or F address, ignore the address.
2014-10-27networkd: don't stop the dhcp server when link goes downTom Gundersen
2014-10-11sd-dhcp-client: support non-Ethernet hardware addressesDan Williams
Like Infiniband. See RFC 4390 section 2.1 for details on DHCP and Infiniband; chaddr is zeroed, hlen is set to 0, and htype is set to ARPHRD_INFINIBAND because IB hardware addresses are 20 bytes in length.
2014-09-29Do not format USEC_INFINITY as NULLZbigniew Jędrzejewski-Szmek
systemctl would print 'CPUQuotaPerSecUSec=(null)' for no limit. This does not look right. Since USEC_INFINITY is one of the valid values, format_timespan() could return NULL, and we should wrap every use of it in strna() or similar. But most callers didn't do that, and it seems more robust to return a string ("infinity") that makes sense most of the time, even if in some places the result will not be grammatically correct.
2014-09-17networkd: dhcp4 - fix unchecked return valueTom Gundersen
Found by coverity. CID #1237529 and #1237528.
2014-09-16sd-bus: sd_bus_message_get_errno should only return positive errnoThomas Hindoe Paaboel Andersen
sd_bus_message_get_errno can currently return either a number of different poitive errno values (from bus-error-mapping), or a negative EINVAL if passed null as parameter. The check for null parameter was introduced in 40ca29a1370379d43e44c0ed425eecc7218dcbca at the same as the function was renamed from bus_message_to_errno and made public API. Before becoming public the function used to return only negative values. It is weird to have a function return both positive and negative errno and it generally looks like a mistake. The function is guarded by the --enable-kdbus flags so I wonder if we still have time to fix it up? It does not have any documentation yet. However, except for a few details it is just a convenient way to call sd_bus_error_get_errno which is documented to return only positive errno. This patch makes it return only positive errno and fixes up the two calls to the function that tried to cope with both positive and negative values.
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt
It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
2014-09-13networkd: remove vestigial event sourcesDave Reisner
187fe1db took advantage of floating events, but didn't remove pointers it made superfluous.
2014-09-08networkd: allow specification of DHCP route metricAngus Gibson
This lets the routing metric for links to be specified per-network, still defaulting to DHCP_ROUTE_METRIC (1024) if unspecified. Hopefully this helps with multiple interfaces configured via DHCP.
2014-09-08networkctl: show the link file applied to each linkTom Gundersen
2014-09-08networkctl: show the network file applied to each linkTom Gundersen
2014-09-08sd-network: add _get_network_file apiTom Gundersen
2014-09-08networkd: add preferred source to dhcp4 gateway routeEmil Renner Berthing
This makes DHCPv4 and IPv4LL coexist peacefully. [tomegun: apply to both the dhcp routes, use in_addr_is_null() rather than a separate variable to indicate when prefsrc should be applied]
2014-09-08networkd: netdev - failing to create a netdev is not fatal, just fail that ↵Tom Gundersen
netdev
2014-09-08networkd: tuntap - return correct error when /dev/net/tun cannot be openedTom Gundersen
2014-09-04networkd: link - allow loopback links to be manage, but ignore DHCP/IPv4LLTom Gundersen
2014-09-04networkd: link - clarify log message when receiving address for unknown linkTom Gundersen
2014-09-04networkd: link - do not manage loopback linksTom Gundersen
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=83134.
2014-09-04networkd: link - save link flags when the link is addedTom Gundersen
Don't wait for the link to be fully synchronised.
2014-09-04networkd: move carrier gained/lost handling from link_update_flags() to ↵Tom Gundersen
link_update() This allows us also to simplify link_has_carrier() a bit.
2014-08-31test-network: fix off-by-one error in testTom Gundersen
2014-08-28sd-event: name event sources used in librariesTom Gundersen
This should help in debugging failing event sources.
2014-08-28networkctl: do not mix dns and ntp serversZbigniew Jędrzejewski-Szmek
2014-08-26networkd-wait-online: add missing short option 'i' to optstringŁukasz Stelmach
2014-08-21notify: send STOPPING=1 from our daemonsLennart Poettering
2014-08-19networkd: don't consider deprecated or tentative addresses when determining ↵Tom Gundersen
operstate https://bugs.freedesktop.org/show_bug.cgi?id=81287
2014-08-19networkd: netdev - add missing callback when adding stacked devicesTom Gundersen
As the comment says, the passed in callback must always be invoked, or the underlying link will hang. This was missed when reworking the code, so add it back in.
2014-08-19networkd: link - don't enforce ENSLAVING stateTom Gundersen
We are only guaranteed to stay in ENSLAVING state whilst enslaving by bridges/bonds, not when adding stacked devices (as then the underlying device can be IFF_UP'ed and configured in parallel), so drop these asserts.
2014-08-19networkd: fix use-after-freeTom Gundersen
Elements must be removed from the hashtable before they are freed.
2014-08-18networkd: fix how we generate lists in link_save()Lennart Poettering
https://bugs.freedesktop.org/show_bug.cgi?id=82721