summaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* networkd: reworkd LLDP emission to allow control of propagation levelLennart Poettering2016-05-096-31/+108
| | | | | | | | | This allows selecting the propagation level of emitted LLDP packets (specifically: the destination MAC address of the packets). This is useful because it allows generating LLDP packets that optionally cross certain types of bridges. See 802.11ab-2009, Table 7-1 for details.
* tree-wide: port more code to use ifname_valid()Lennart Poettering2016-05-098-85/+83
|
* nspawn: add new --network-zone= switch for automatically managed bridge devicesLennart Poettering2016-05-096-43/+235
| | | | | | | | | | | | | This adds a new concept of network "zones", which are little more than bridge devices that are automatically managed by nspawn: when the first container referencing a bridge is started, the bridge device is created, when the last container referencing it is removed the bridge device is removed again. Besides this logic --network-zone= is pretty much identical to --network-bridge=. The usecase for this is to make it easy to run multiple related containers (think MySQL in one and Apache in another) in a common, named virtual Ethernet broadcast zone, that only exists as long as one of them is running, and fully automatically managed otherwise.
* util-lib: add new ifname_valid() call that validates interface namesLennart Poettering2016-05-095-2/+93
| | | | | Make use of this in nspawn at a couple of places. A later commit should port more code over to this, including networkd.
* Merge pull request #3202 from poettering/socket-fixesMartin Pitt2016-05-084-58/+161
|\ | | | | don't reopen socket fds when reloading the daemon
| * core: rework how we flush incoming traffic when a socket unit goes downLennart Poettering2016-05-064-20/+66
| | | | | | | | | | | | | | | | | | Previously, we'd simply close and reopen the socket file descriptors. This is problematic however, as we won't transition through the SOCKET_CHOWN state then, and thus the file ownership won't be correct for the sockets. Rework the flushing logic, and actually read any queued data from the sockets for flushing, and accept any queued messages and disconnect them.
| * core: don't implicit open missing socket fds on daemon reloadLennart Poettering2016-05-061-8/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when the daemon was reloaded and the configuration of a socket unit file was changed so that a different set of socket ports was defined for the socket we'd simply reopen the socket fds not yet open. This is problematic however, as this means the SOCKET_CHOWN state is not run for them, and thus their UID/GID is not corrected. With this change, don't open the missing file descriptors, but log about this issue, and ask the user to restart the socket explicit, to make sure all missing fds are opened. Fixes: #3171
| * core: split out selinux label retrieval logic into a function of its ownLennart Poettering2016-05-061-30/+49
| | | | | | | | This should bring no behavioural change.
* | Merge pull request #3205 from poettering/iaidZbigniew Jędrzejewski-Szmek2016-05-071-1/+1
|\ \ | | | | | | more dhcp fixes
| * | networkd: move the IAID configuration option into the [DHCP] sectionLennart Poettering2016-05-061-1/+1
| | | | | | | | | | | | It's only relevant to DHCP, and it should be where the DUID is configured too.
* | | Merge pull request #3160 from htejun/cgroup-fixes-rev2Zbigniew Jędrzejewski-Szmek2016-05-073-7/+11
|\ \ \ | | | | | | | | Cgroup fixes.
| * | | core: fix segfault on "systemctl --set-property UNIT BlockIODeviceWeight=WEIGHT"Tejun Heo2016-05-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bus_append_unit_property_assignment() was missing an argument for sd_bus_message_append() when processing BlockIODeviceWeight leading to segfault. Fix it. Signed-off-by: Tejun Heo <htejun@fb.com>
| * | | core: make unit_has_mask_realized() consider controller enable stateTejun Heo2016-04-302-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | unit_has_mask_realized() determines whether the specified unit has its cgroups set up properly given the desired target_mask; however, on the unified hierarchy, controllers need to be enabled explicitly for children and the mask of enabled controllers can deviate from target_mask. Only considering target_mask in unit_has_mask_realized() can lead to false positives and skipping enabling the requested controllers. This patch adds unit->cgroup_enabled_mask to track which controllers are enabled and updates unit_has_mask_realized() to also consider enable_mask. Signed-off-by: Tejun Heo <htejun@fb.com>
| * | | core: bus_append_unit_property_assignment() was using the wrong parse functionTejun Heo2016-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It was incorrectly using cg_cpu_weight_parse() to parse BlockIOWeight. Update it to use cg_blkio_weight_parse() instead. Signed-off-by: Tejun Heo <htejun@fb.com>
* | | | Merge pull request #3215 from keszybz/news-and-other-small-cleanupsLennart Poettering2016-05-071-5/+4
|\ \ \ \ | | | | | | | | | | News and other small cleanups
| * | | | systemctl: do not print header if no units will be listedZbigniew Jędrzejewski-Szmek2016-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | "0 units listed." is still printed.
| * | | | systemctl: rewrite code to explicitly take care of n_units==0 caseZbigniew Jędrzejewski-Szmek2016-05-071-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coverity was complaing, but it was a false positive (CID #1354669). Nevertheless, it's better to rewrite the code so that units is never null.
* | | | | Merge pull request #3191 from poettering/cgroups-agent-dgramEvgeny Vereshchagin2016-05-0726-161/+302
|\ \ \ \ \ | |/ / / / |/| | | | core: use an AF_UNIX/SOCK_DGRAM socket for cgroup agent notification
| * | | | journald: stack allocation cannot failLennart Poettering2016-05-051-10/+8
| | | | | | | | | | | | | | | | | | | | No need to check whether alloca() failed...
| * | | | tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhereLennart Poettering2016-05-0523-75/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The macro determines the right length of a AF_UNIX "struct sockaddr_un" to pass to connect() or bind(). It automatically figures out if the socket refers to an abstract namespace socket, or a socket in the file system, and properly handles the full length of the path field. This macro is not only safer, but also simpler to use, than the usual offsetof() + strlen() logic.
| * | | | core: use an AF_UNIX/SOCK_DGRAM socket for cgroup agent notificationLennart Poettering2016-05-056-78/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dbus-daemon currently uses a backlog of 30 on its D-bus system bus socket. On overloaded systems this means that only 30 connections may be queued without dbus-daemon processing them before further connection attempts fail. Our cgroups-agent binary so far used D-Bus for its messaging, and hitting this limit hence may result in us losing cgroup empty messages. This patch adds a seperate cgroup agent socket of type AF_UNIX/SOCK_DGRAM. Since sockets of these types need no connection set up, no listen() backlog applies. Our cgroup-agent binary will hence simply block as long as it can't enqueue its datagram message, so that we won't lose cgroup empty messages as likely anymore. This also rearranges the ordering of the processing of SIGCHLD signals, service notification messages (sd_notify()...) and the two types of cgroup notifications (inotify for the unified hierarchy support, and agent for the classic hierarchy support). We now always process events for these in the following order: 1. service notification messages (SD_EVENT_PRIORITY_NORMAL-7) 2. SIGCHLD signals (SD_EVENT_PRIORITY_NORMAL-6) 3. cgroup inotify and cgroup agent (SD_EVENT_PRIORITY_NORMAL-5) This is because when receiving SIGCHLD we invalidate PID information, which we need to process the service notification messages which are bound to PIDs. Hence the order between the first two items. And we want to process SIGCHLD metadata to detect whether a service is gone, before using cgroup notifications, to decide when a service is gone, since the former carries more useful metadata. Related to this: https://bugs.freedesktop.org/show_bug.cgi?id=95264 https://github.com/systemd/systemd/issues/1961
* | | | | core: dump TriggerLimitIntervalSec and TriggerLimitBurst tooEvgeny Vereshchagin2016-05-061-0/+6
| | | | |
* | | | | core: expose TriggerLimitIntervalUSecEvgeny Vereshchagin2016-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: $ systemctl show --property TriggerLimitIntervalSec test.socket TriggerLimitIntervalSec=2000000 After: $ systemctl show --property TriggerLimitIntervalUSec test.socket TriggerLimitIntervalUSec=2s
* | | | | core: update the right mtime after finishing writing of transient units (#3203)Lennart Poettering2016-05-061-1/+1
| |_|/ / |/| | | | | | | Fixes: #3194
* | | | systemctl: indentation fixLennart Poettering2016-05-061-14/+15
| |_|/ |/| |
* | | Merge pull request #3201 from ssahani/net-wordLennart Poettering2016-05-062-39/+40
|\ \ \ | | | | | | | | networkd lib: cleanup FOREACH_WORD
| * | | networkd: route fix commentSusant Sahani2016-05-061-1/+1
| | | |
| * | | networkd: cleanup FOREACH_WORDSusant Sahani2016-05-061-38/+39
| |/ /
* | | Merge pull request #3190 from poettering/logind-fixesZbigniew Jędrzejewski-Szmek2016-05-069-6/+65
|\ \ \
| * | | logind: drop pointless UINT64_C() macro useLennart Poettering2016-05-051-3/+3
| | | |
| * | | logind: enforce a limit on inhibitors we hand outLennart Poettering2016-05-055-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For similar reasons as the recent addition of a limit on sessions. Note that we don't enforce a limit on inhibitors per-user currently, but there's an implicit one, since each inhibitor takes up one fd, and fds are limited via RLIMIT_NOFILE, and the limit on the number of processes per user.
| * | | logind: expose more configuration settings as bus propertiesLennart Poettering2016-05-051-0/+3
| | | |
| * | | logind: don't include session lists in PropertyChanged messagesLennart Poettering2016-05-052-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we have a lot of simultaneous sessions we really shouldn't send the full list of active sessions with each PropertyChanged message for user and seat objects, as that can become quite substantial data, we probably shouldn't dump on the bus on each login and logout. Note that the global list of sessions doesn't send out changes like this either, it only supports requesting the session list with ListSessions(). If cients want to get notified about sessions coming and going they should subscribe to SessionNew and SessionRemoved signals, and clients generally do that already. This is kind of an API break, but then again the fact that this was included was never documented.
| * | | logind: process session/inhibitor fds at higher priorityLennart Poettering2016-05-053-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's make sure we process session and inhibitor pipe fds (that signal sessions/inhibtors going away) at a higher priority than new bus calls that might create new sessions or inhibitors. This helps ensuring that the number of open sessions stays minimal.
| * | | logind: enforce a limit on current user sessionsLennart Poettering2016-05-055-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We really should put limits on all resources we manage, hence add one to the number of concurrent sessions, too. This was previously unbounded, hence set a relatively high limit of 8K by default. Note that most PAM setups will actually invoke pam_systemd prefixed with "-", so that the return code of pam_systemd is ignored, and the login attempt succeeds anyway. On systems like this the session will be created but is not tracked by systemd.
* | | | Merge pull request #3198 from poettering/trigger-timeout-defaultsEvgeny Vereshchagin2016-05-061-5/+26
|\ \ \ \ | | | | | | | | | | change trigger timeout defaults
| * | | | core: fix owner user/group output in socket dumpLennart Poettering2016-05-051-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unit file settings are called SocketUser= and SocketGroup= hence name these fields that way in the "systemd-analyze dump" output too. https://github.com/systemd/systemd/issues/3171#issuecomment-216216995
| * | | | core: change default trigger limits for socket unitsLennart Poettering2016-05-051-1/+21
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | Let's lower the default values a bit, and pick different defaults for Accept=yes and Accept=no sockets. Fixes: #3167
* | | | test-networkd-conf: fix memleakThomas Hindoe Paaboel Andersen2016-05-051-1/+3
| | | |
* | | | networkd: fix memleak in config_parse_duid_rawdataThomas Hindoe Paaboel Andersen2016-05-051-1/+1
|/ / /
* / / Trivial network cleanup (#3196)Thomas H. P. Andersen2016-05-051-1/+0
|/ / | | | | | | | | | | * gitignore: typo fix for test-networkd-conf * networkd: fix double include
* | Merge pull request #3156 from keszybz/duid-settingsLennart Poettering2016-05-0442-401/+583
|\ \ | | | | | | Rework DUID setting
| * | network: get rid of DUID_TYPE_RAWZbigniew Jędrzejewski-Szmek2016-05-032-2/+0
| | | | | | | | | | | | It wasn't used for anything after the recent changes.
| * | test-networkd-conf: add tests for the parsing functionsZbigniew Jędrzejewski-Szmek2016-05-031-0/+89
| | |
| * | networkd: rework duid_{type,duid_type,duid,duid_len} settingZbigniew Jędrzejewski-Szmek2016-05-0311-144/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Separate fields are replaced with a struct. Second second duid type field is removed. The first field was used to carry the result of DUIDType= configuration, and the second was either a copy of this, or contained the type extracted from DuidRawData. The semantics are changed so that the type specified in DUIDType is always used. DUIDRawData= no longer overrides the type setting. The networkd code is now more constrained than the sd-dhcp code: DUIDRawData cannot have 0 length, length 0 is treated the same as unsetting. Likewise, it is not possible to set a DUIDType=0. If it ever becomes necessary to set type=0 or a zero-length duid, the code can be changed to support that. Nevertheless, I think that's unlikely. This addresses #3127 § 1 and 3. v2: - rename DUID.duid, DUID.duid_len to DUID.raw_data, DUID.raw_data_len
| * | dh-dhcp{,6}-client: change the semantics of DUID settingZbigniew Jędrzejewski-Szmek2016-05-033-18/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both versions of the code are changed to allow the caller to override DUID using simple rules: duid type and value may be specified, in which case the caller is responsible to providing the contents, or just duid type may be specified as DUID_TYPE_EN, in which case we we fill in the values. In the future more support for other types may be added, e.g. DUID_TYPE_LLT. There still remains and ugly discrepancy between dhcp4 and dhcp6 code: dhcp6 has sd_dhcp6_client_set_duid and sd_dhcp6_client_set_iaid and requires client->state to be DHCP6_STATE_STOPPED, while dhcp4 has sd_dhcp_client_set_iaid_duid and will reconfigure the client if it is not stopped. This commit doesn't touch that part. This addresses #3127 § 2.
| * | dhcp-identifier: un-inline dhcp_validate_duid_lenZbigniew Jędrzejewski-Szmek2016-05-032-35/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After all it is used in more than one place and is not that short. Also tweak the test a bit: - do not check that duid_len > 0, because we want to allow unknown duid types, and there might be some which are fine with 0 length data, (also assert should not be called from library code), - always check that duid_len <= MAX_DUID_LEN, because we could overwrite available buffer space otherwise.
| * | sd-dhcp: change uint8_t *duid to const void*Zbigniew Jędrzejewski-Szmek2016-05-034-4/+5
| | |
| * | sd-dhcp{,6}-client: use standard indentation for functions argsZbigniew Jędrzejewski-Szmek2016-05-034-105/+214
| | |
| * | networkd: rework headers to avoid circular includesZbigniew Jędrzejewski-Szmek2016-04-3029-99/+114
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Header files were organized in a way where the includer would add various typedefs used by the includee before including it, resulting in a tangled web of dependencies between files. Replace this with the following logic: networkd.h / \ networkd-link.h \ networkd-ipv4ll.h--\__\ networkd-fdb.h \ networkd-network.h netword-netdev-*.h networkd-route.h \ networkd-netdev.h If a pointer to a structure defined in a different header file is needed, use a typedef line instead of including the whole header.