Commit graph

15309 commits

Author SHA1 Message Date
kayrus 6900c740e1 core: added ListUnitsByNames dbus method (#3182)
This new method returns information by unit names. Instead of ListUnitsByPatterns
this method returns information of inactive and even unexisting units.
Moved dbus unit reply logic into a separate shared function.
Resolves https://github.com/coreos/fleet/pull/1418
2016-05-12 18:58:59 +02:00
Daniel Drake 7163e1ca11 Create initrd-root-device.target synchronization point (#3239)
Add a synchronization point so that custom initramfs units can run
after the root device becomes available, before it is fsck'd and
mounted.

This is useful for custom initramfs units that may modify the
root disk partition table, where the root device is not known in
advance (it's dynamically selected by the generators).
2016-05-12 18:42:39 +02:00
Victor Toso 42d35e1301 logind: introduce LockedHint and SetLockedHint (#3238)
Desktop environments can keep this property up to date to allow
applications to easily track session's Lock status.
2016-05-11 19:34:13 +02:00
Evgeny Vereshchagin fe1ef0f86e coredump: use next_datagram_size_fd instead of ioctl(FIONREAD) (#3237)
We need to be sure that the size returned here actually matches what we will read with recvmsg() next

Fixes #2984
2016-05-11 14:29:24 +02:00
Lennart Poettering 4b273d46bb Merge pull request #3220 from keszybz/install-fixes
Fix "preset-all" with dangling symlinks and install-section hint emitted too eagerly
2016-05-10 16:44:29 +02:00
Zbigniew Jędrzejewski-Szmek dff4bf93d4 locale-util: mark special_glyph() as _const_
_const_ means that the caller can assume that the function will return the same
result every time (and will not modify global memory). special_glyph() meets
this: even though it depends on global memory, that part of global memory is
not expected to change. This allows the calls to special_glyph() to be
optimized, even if -flto is not used.
2016-05-09 15:17:57 -04:00
Zbigniew Jędrzejewski-Szmek 323b7dc903 tree-wide: rename draw_special_char to special_glyph
That function doesn't draw anything on it's own, just returns a string, which
sometimes is more than one character. Also remove "DRAW_" prefix from character
names, TREE_* and ARROW and BLACK_CIRCLE are unambigous on their own, don't
draw anything, and are always used as an argument to special_glyph().

Rename "DASH" to "MDASH", as there's more than one type of dash.
2016-05-09 15:17:57 -04:00
Zbigniew Jędrzejewski-Szmek a760db24bb shared/install: use "→" instead of "pointing to" for a symlink
It's quite a bit shorter and just as readable.

(The full sentence with "pointing to" was added to replace a text that used
"ln -s %s %s". Using the "ln" syntax is indeed unclear, because it's not
obvious which is the source and which is the target, and because symlink(2)
uses the opposite order to ln(1). But with the unicode arrow there should
be no ambiguity.)
2016-05-09 15:17:57 -04:00
Zbigniew Jędrzejewski-Szmek 8515830341 shared/install: do not print warning when a unit is already enabled
Executing 'systemctl enable' on the same unit twice would cause
a warning about a missing [Install] section to be printed. To avoid
this, count all symlinks that "would" be created, and return 1
no matter if we actually created a symlink or skipped creation because
it already exists.
2016-05-09 15:17:57 -04:00
Zbigniew Jędrzejewski-Szmek 893275df36 shared/install: handle dangling aliases as an explicit case, report nicely
This fixes 'preset-all' with a unit that is a dangling symlink.

$ systemctl --root=/ preset-all
Unit syslog.service is an alias to a unit that is not present, ignoring.
Unit auditd.service is masked, ignoring.
Unit NetworkManager.service is masked, ignoring.
2016-05-09 15:17:56 -04:00
Zbigniew Jędrzejewski-Szmek 64f9280ef0 shared/install: add some more debug messages and comments
$ systemctl --root=/ preset foobar.service
Cannot find unit foobar.service.
Failed to preset: No such file or directory.
$ systemctl --root=/ preset foobar@.service
Cannot find unit foobar@.service.
Failed to preset: No such file or directory.
$ systemctl --root=/ preset foobar@blah.service
Cannot find unit foobar@blah.service or foobar@.service.
Failed to preset: No such file or directory.
2016-05-09 15:17:55 -04:00
Lennart Poettering 7513c5b89f nspawn: only remove veth links we created ourselves
Let's make sure we don't remove veth links that existed before nspawn was
invoked.

https://github.com/systemd/systemd/pull/3209#discussion_r62439999
2016-05-09 15:45:31 +02:00
Lennart Poettering a9dd908d09 network: Make sure we log about parse errors for ifname lists
Fix-up for 93e2822684
2016-05-09 15:45:31 +02:00
Lennart Poettering 7272b25e16 networkd: reworkd LLDP emission to allow control of propagation level
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.
2016-05-09 15:45:31 +02:00
Lennart Poettering d31645adef tree-wide: port more code to use ifname_valid() 2016-05-09 15:45:31 +02:00
Lennart Poettering 22b28dfdc7 nspawn: add new --network-zone= switch for automatically managed bridge devices
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.
2016-05-09 15:45:31 +02:00
Lennart Poettering ef76dff225 util-lib: add new ifname_valid() call that validates interface names
Make use of this in nspawn at a couple of places. A later commit should port
more code over to this, including networkd.
2016-05-09 15:45:31 +02:00
Martin Pitt d75103d4c6 Merge pull request #3202 from poettering/socket-fixes
don't reopen socket fds when reloading the daemon
2016-05-08 21:09:35 +02:00
Zbigniew Jędrzejewski-Szmek 0155928c3c shared/install: simplify error handling conditionals in a few places 2016-05-07 16:19:53 -04:00
Zbigniew Jędrzejewski-Szmek 94ad3616c8 core/mount: add helper function for mount states 2016-05-07 16:19:53 -04:00
Zbigniew Jędrzejewski-Szmek 03a037f338 Merge pull request #3205 from poettering/iaid
more dhcp fixes
2016-05-07 15:31:58 -04:00
Zbigniew Jędrzejewski-Szmek 74ad38ff0e Merge pull request #3160 from htejun/cgroup-fixes-rev2
Cgroup fixes.
2016-05-07 15:08:57 -04:00
Lennart Poettering e76f4732f1 Merge pull request #3215 from keszybz/news-and-other-small-cleanups
News and other small cleanups
2016-05-07 18:40:57 +02:00
Evgeny Vereshchagin 5ab42bc85a Merge pull request #3191 from poettering/cgroups-agent-dgram
core: use an AF_UNIX/SOCK_DGRAM socket for cgroup agent notification
2016-05-07 19:17:44 +03:00
Zbigniew Jędrzejewski-Szmek 11690bcc50 systemctl: do not print header if no units will be listed
"0 units listed." is still printed.
2016-05-07 11:35:34 -04:00
Zbigniew Jędrzejewski-Szmek 0da999fada systemctl: rewrite code to explicitly take care of n_units==0 case
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.
2016-05-07 11:35:33 -04:00
Evgeny Vereshchagin 1745fa70e7 core: dump TriggerLimitIntervalSec and TriggerLimitBurst too 2016-05-06 21:03:16 +00:00
Evgeny Vereshchagin 5d105c4a4f core: expose TriggerLimitIntervalUSec
Before:
$ systemctl show --property TriggerLimitIntervalSec test.socket
TriggerLimitIntervalSec=2000000

After:
$ systemctl show --property TriggerLimitIntervalUSec test.socket
TriggerLimitIntervalUSec=2s
2016-05-06 20:14:06 +00:00
Lennart Poettering f76707da45 core: update the right mtime after finishing writing of transient units (#3203)
Fixes: #3194
2016-05-06 19:22:22 +03:00
Lennart Poettering d05def163e networkd: move the IAID configuration option into the [DHCP] section
It's only relevant to DHCP, and it should be where the DUID is configured too.
2016-05-06 17:04:05 +02:00
Lennart Poettering baa9ecc1ee systemctl: indentation fix 2016-05-06 16:58:01 +02:00
Lennart Poettering 60d9771c59 core: rework how we flush incoming traffic when a socket unit goes down
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.
2016-05-06 13:29:26 +02:00
Lennart Poettering 01a8b46757 core: don't implicit open missing socket fds on daemon reload
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
2016-05-06 13:01:17 +02:00
Lennart Poettering d24e561d96 core: split out selinux label retrieval logic into a function of its own
This should bring no behavioural change.
2016-05-06 12:16:58 +02:00
Lennart Poettering b37bf74411 Merge pull request #3201 from ssahani/net-word
networkd lib: cleanup FOREACH_WORD
2016-05-06 11:57:12 +02:00
Susant Sahani 06976f5b2a networkd: route fix comment 2016-05-06 09:49:49 +05:30
Susant Sahani 93e2822684 networkd: cleanup FOREACH_WORD 2016-05-06 09:37:31 +05:30
Zbigniew Jędrzejewski-Szmek b920500ef1 Merge pull request #3190 from poettering/logind-fixes 2016-05-05 20:28:23 -04:00
Evgeny Vereshchagin 43039e4f05 Merge pull request #3198 from poettering/trigger-timeout-defaults
change trigger timeout defaults
2016-05-06 02:11:11 +03:00
Lennart Poettering 64b5689647 logind: drop pointless UINT64_C() macro use 2016-05-05 22:50:09 +02:00
Lennart Poettering c5a11ae268 logind: enforce a limit on inhibitors we hand out
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.
2016-05-05 22:50:09 +02:00
Lennart Poettering 6d97d3c648 logind: expose more configuration settings as bus properties 2016-05-05 22:50:09 +02:00
Lennart Poettering 91ab7b01f8 logind: don't include session lists in PropertyChanged messages
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.
2016-05-05 22:50:09 +02:00
Lennart Poettering e11544a830 logind: process session/inhibitor fds at higher priority
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.
2016-05-05 22:50:09 +02:00
Lennart Poettering 183e073842 logind: enforce a limit on current user sessions
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.
2016-05-05 22:50:09 +02:00
Lennart Poettering d2a50e3b52 core: fix owner user/group output in socket dump
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
2016-05-05 22:34:47 +02:00
Lennart Poettering 1f15ce2846 core: change default trigger limits for socket units
Let's lower the default values a bit, and pick different defaults for
Accept=yes and Accept=no sockets.

Fixes: #3167
2016-05-05 22:34:47 +02:00
Lennart Poettering 23be5709e1 journald: stack allocation cannot fail
No need to check whether alloca() failed...
2016-05-05 22:26:09 +02:00
Lennart Poettering fc2fffe770 tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhere
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.
2016-05-05 22:24:36 +02:00
Thomas Hindoe Paaboel Andersen 3eb8326162 test-networkd-conf: fix memleak 2016-05-05 13:24:03 +02:00