summaryrefslogtreecommitdiff
path: root/src/network/networkd-manager.c
AgeCommit message (Collapse)Author
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
2015-10-22networkd-manager: fix swapped argumentsreverendhomer
fixes Coverity #1328493
2015-10-21networkd: manager/link - only serialize once per event-loop iterationTom Gundersen
Every time the state is written out we may trigger third-party apps, so let's be a bit more careful about writing this out unnecessarily.
2015-10-21networkd: address - distinguish between addresses added by us and by othersTom Gundersen
We only keep the addresses that we added ourselves in link->addresses, and introduce a new set link->addresses_foreign to keep addresses of unknown origin. Only functional change is that "foreign" addresses no longer prevent a link from entering "configured" state.
2015-10-21networkd: address - factor out address_update()Tom Gundersen
Call back into link_check_ready() whenever an address state change may have made a link ready.
2015-10-21networkd: link - only consider configured when all addresses are readyTom Gundersen
We were considering a link configured whilst its IPv6 addresses were still tentative. Fixes issue #650.
2015-10-11networkd: make address_{establish,release}() staticTom Gundersen
No need to expose these functions, but rather call them from address_{add,drop}.
2015-10-11networkd: manager - avoid unnecessary memory allocationTom Gundersen
Don't allocate Address objects only to free them again when processing rtnl events.
2015-10-11networkd: address - store active addresses in a Set rather than a ListTom Gundersen
We need to be able to look these things up quickly as we will be updating them continuously and there can in principle be many of them.
2015-10-11networkd: address - process in manager.c rather than link.cTom Gundersen
2015-10-11networkd: manager - free bus after own objectsTom Gundersen
Freeing links/addresses may trigger sending signals over the bus, so let's make sure the bus stays around until our own objects have been freed.
2015-09-07basic: rework virtualization detection APILennart Poettering
Introduce a proper enum, and don't pass around string ids anymore. This simplifies things quite a bit, and makes virtualization detection more similar to architecture detection.
2015-09-04networkd: adjust error codes for nonexisting DHCP dataMartin Pitt
Commit 0339cd770 changed libsystemd-network's error code for missing DHCP lease data from ENOENT to ENODATA. Adjust networkd accordingly. This fixes interfaces being stuck in "degraded/configuring" mode forever. https://github.com/systemd/systemd/issues/1147
2015-08-27networkd: s/now/knowLennart Poettering
2015-08-27networkd: make sure we remove udev fd from epoll *before* closing itLennart Poettering
Otherwise we'll try to remove an invalid fd from epoll all the time.
2015-08-27networkd: propagate DNS/NTP server from uplink to dhcp serverLennart Poettering
When handing out DHCP leases, try to propagate DNS/NTP server information from "uplink". The "uplink" is automatically determined as the network interface with the highest priority default route on it.
2015-08-27networkd: split up networkd.h into per-object header filesLennart Poettering
No functional changes, just moving definitions into separate header files.
2015-08-26networkd: let's uppercase the first character in log messagesLennart Poettering
Let's try to generate log messages that resemble english language sentences, hence uppercase the first character.
2015-08-06tree-wide: fix indentationThomas Hindoe Paaboel Andersen
2015-07-29tree-wide: port everything over to fflush_and_check()Lennart Poettering
Some places invoked fflush() directly with their own manual error checking, let's unify all that by using fflush_and_check(). This also unifies the general error paths of fflush()+rename() file writers.
2015-06-13sd-netlink: rename from sd-rtnlTom Gundersen
2015-06-11sd-rtnl: make joining broadcast groups implicitTom Gundersen
2015-06-08Revert "networkd: create "kernel" setting for IPForwarding"Lennart Poettering
2015-06-02networkd: create "kernel" setting for IPForwardingNick Owens
In 5a8bcb674f71a20e95df55319b34c556638378ce, IPForwarding was introduced to set forwarding flags on interfaces in .network files. networkd sets forwarding options regardless of the previous setting, even if it was set by e.g. sysctl. This commit creates a new option for IPForwarding, "kernel", that preserves the sysctl settings rather than always setting them. See https://bugs.freedesktop.org/show_bug.cgi?id=89509 for the initial bug report.
2015-04-29sd-bus: drop bus parameter from message callback prototypeLennart Poettering
This should simplify the prototype a bit. The bus parameter is redundant in most cases, and in the few where it matters it can be derived from the message via sd_bus_message_get_bus().
2015-04-03networkd: improve logging when processing links and addressesTom Gundersen
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
2015-02-11networkd: don't do exit-on-idle if there is something wrong with the dbus ↵Tom Gundersen
connection Just fall back to plain old event loop in this (highly unlikely) case. In the glorious future when kdbus is upstream we can of course drop all this.
2015-02-08networkd: add basic org.freedesktop.network1.Network interfaceTom Gundersen
2015-02-08networkd: add network_get_by_nameTom Gundersen
2015-02-05networkd: move the connection to the bus out of manager_new (again)Tom Gundersen
This would otherwise make the tests fail as we cannot grab the bus name.
2015-02-05networkd: exit on idleTom Gundersen
We will be woken up on rtnl or dbus activity, so let's just quit if some time has passed and that is the only thing that can happen. Note that we will always stay around if we expect network activity (e.g. DHCP is enabled), as we are not restarted on that.
2015-02-05networkd: add basic dbus APITom Gundersen
Only the very basics, more to come. For now: $ busctl tree org.freedesktop.network1 └─/org/freedesktop/network1 └─/org/freedesktop/network1/link ├─/org/freedesktop/network1/link/1 ├─/org/freedesktop/network1/link/2 ├─/org/freedesktop/network1/link/3 ├─/org/freedesktop/network1/link/4 ├─/org/freedesktop/network1/link/5 ├─/org/freedesktop/network1/link/6 ├─/org/freedesktop/network1/link/7 ├─/org/freedesktop/network1/link/8 └─/org/freedesktop/network1/link/9 $ busctl introspect org.freedesktop.network1 /org/freedesktop/network1 NAME TYPE SIGNATURE RESULT/VALUE FLAGS org.freedesktop.network1.Manager interface - - - .OperationalState property s "carrier" emits-change $ busctl introspect org.freedesktop.network1 /org/freedesktop/network1/link/1 NAME TYPE SIGNATURE RESULT/VALUE FLAGS org.freedesktop.network1.Link interface - - - .AdministrativeState property s "unmanaged" emits-change .OperationalState property s "carrier" emits-change
2015-02-05networkd: don't warn about missing links unnecessarilyTom Gundersen
If we get a NEWLINK + NEWADDR between enumerating the links and enumerating the addresses, we would get a warning that the link corresponding to the address does not exist. This is a false warning as both the NEWLINK and NEWADDR would be processed after enumerating completed, so drop it.
2015-02-03networkd: refactor socket activation a bitTom Gundersen
2015-02-03networkd: handle suspend eventsTom Gundersen
2015-02-02networkd: minor simplificationLennart Poettering
Let's return the fd we found as return value in systemd_netlink_fd(), instead of using call-by-reference.
2015-02-02networkd: support socket activationTom Gundersen
Still keep the non-socket activation code around for starting from the commandline, but will likely drop that too in the future.
2015-01-13networkd: make IP forwarding for IPv4 and IPv6 individually configurableLennart Poettering
2015-01-13networkd: introduce an AddressFamilyBoolean enum typeLennart Poettering
This introduces am AddressFamilyBoolean type that works more or less like a booleaan, but can optionally turn on/off things for ipv4 and ipv6 independently. THis also ports the DHCP field over to it.
2014-12-15networkd: failing to track links is a serious problem so log at warning ↵Tom Gundersen
level rather than debug
2014-12-08networkd: manager - enumerate addresses globally, rather than per-linkTom Gundersen
The kernel always returns all addresses, rather than only for the given link, so let's only enumerate once.
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: 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-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-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-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.