platform/upstream/systemd.git
6 years agobpf: set BPF_F_ALLOW_OVERRIDE when attaching a cgroup program if Delegate=yes is set
Lennart Poettering [Thu, 21 Sep 2017 18:38:07 +0000 (20:38 +0200)]
bpf: set BPF_F_ALLOW_OVERRIDE when attaching a cgroup program if Delegate=yes is set

Let's permit installing BPF programs in cgroup subtrees if
Delegeate=yes. Let's not document this precise behaviour for now though,
as most likely the logic here should become recursive, but that's only
going to happen if the kernel starts supporting that. Until then,
support this in a non-recursive fashion.

6 years agoman: document two more special units
Lennart Poettering [Thu, 21 Sep 2017 18:22:06 +0000 (20:22 +0200)]
man: document two more special units

6 years agoman: remove double newlines in systemd.special man page header
Lennart Poettering [Thu, 21 Sep 2017 18:12:40 +0000 (20:12 +0200)]
man: remove double newlines in systemd.special man page header

The <!-- --> comment lines resulted in double newlines in the man page
header, which looks quite ugly. Let's rearrange a bit so that these
comments don't result in changes in the output.

6 years agoman: drop misplaced "," before "-.slice"
Lennart Poettering [Thu, 21 Sep 2017 18:12:11 +0000 (20:12 +0200)]
man: drop misplaced "," before "-.slice"

6 years agomain: bump RLIMIT_NOFILE for the root user substantially
Lennart Poettering [Thu, 21 Sep 2017 17:43:07 +0000 (19:43 +0200)]
main: bump RLIMIT_NOFILE for the root user substantially

On current kernels BPF_MAP_TYPE_LPM_TRIE bpf maps are charged against
RLIMIT_MEMLOCK even for privileged users that have CAP_IPC_LOCK. Given
that mlock() generally ignores RLIMIT_MEMLOCK if CAP_IPC_LOCK is set
this appears to be an oversight in the kernel. Either way, until that's
fixed, let's just bump RLIMIT_MEMLOCK for the root user considerably, as
the default is quite limiting, and doesn't permit us to create more than
a few TRIE maps.

6 years agorlimit: don't assume getrlimit() always succeeds
Lennart Poettering [Thu, 21 Sep 2017 17:37:11 +0000 (19:37 +0200)]
rlimit: don't assume getrlimit() always succeeds

In times of seccomp it might very well fail, and given that we return
failures from this function anyway, let's also propagate getrlimit()
failures, just to be safe.

6 years agocore: whenever a unit terminates, log its consumed resources to the journal
Lennart Poettering [Thu, 21 Sep 2017 12:05:35 +0000 (14:05 +0200)]
core: whenever a unit terminates, log its consumed resources to the journal

This adds a new recognizable log message for each unit invocation that
contains structured information about consumed resources of the unit as
a whole after it terminated. This is particular useful for apps that
want to figure out what the resource consumption of a unit given a
specific invocation ID was.

The log message is only generated for units that have at least one
XyzAccounting= property turned on, and currently only covers IP traffic and CPU
time metrics.

6 years agonspawn: set up a new session keyring for the container process
Lennart Poettering [Thu, 21 Sep 2017 12:02:31 +0000 (14:02 +0200)]
nspawn: set up a new session keyring for the container process

keyring material should not leak into the container. So far we relied on
seccomp to deny access to the keyring, but given that we now made the
seccomp configurable, and access to keyctl() and friends may optionally
be permitted to containers now let's make sure we disconnect the callers
keyring from the keyring of PID 1 in the container.

6 years agoio-util: add new IOVEC_INIT/IOVEC_MAKE macros
Lennart Poettering [Thu, 21 Sep 2017 11:52:34 +0000 (13:52 +0200)]
io-util: add new IOVEC_INIT/IOVEC_MAKE macros

This adds IOVEC_INIT() and IOVEC_MAKE() for initializing iovec structures
from a pointer and a size. On top of these IOVEC_INIT_STRING() and
IOVEC_MAKE_STRING() are added which take a string and automatically
determine the size of the string using strlen().

This patch removes the old IOVEC_SET_STRING() macro, given that
IOVEC_MAKE_STRING() is now useful for similar purposes. Note that the
old IOVEC_SET_STRING() invocations were two characters shorter than the
new ones using IOVEC_MAKE_STRING(), but I think the new syntax is more
readable and more generic as it simply resolves to a C99 literal
structure initialization. Moreover, we can use very similar syntax now
for initializing strings and pointer+size iovec entries. We canalso use
the new macros to initialize function parameters on-the-fly or array
definitions. And given that we shouldn't have so many ways to do the
same stuff, let's just settle on the new macros.

(This also converts some code to use _cleanup_ where dynamically
allocated strings were using IOVEC_SET_STRING() before, to modernize
things a bit)

6 years agojob: change result field for log message about job result RESULT= → JOB_RESULT=
Lennart Poettering [Wed, 20 Sep 2017 16:29:08 +0000 (18:29 +0200)]
job: change result field for log message about job result RESULT= → JOB_RESULT=

So, currently, some of the structured log messages we generated based on
jobs carry the result in RESULT=, and others in JOB_RESULT=. Let's
streamline this, as stick to JOB_RESULT= in one place.

This is kind of an API break, but given that currently most software has
to check both fields anyway, I think we can get away with it.

Why unify on JOB_RESULT= rather than RESULT=? Well, we manage different
types of result codes in systemd. Most importanlty besides job results
there are also service results, and we should be explicit in what we
mean here.

6 years agodocumentation: document nss-systemd's internal environment variables in ENVIRONMENT.md
Lennart Poettering [Wed, 20 Sep 2017 16:28:29 +0000 (18:28 +0200)]
documentation: document nss-systemd's internal environment variables in ENVIRONMENT.md

6 years agocore: make sure to log invocation ID of units also when doing structured logging
Lennart Poettering [Wed, 20 Sep 2017 16:27:53 +0000 (18:27 +0200)]
core: make sure to log invocation ID of units also when doing structured logging

6 years agoman: document the new ip accounting and filting directives
Daniel Mack [Sat, 12 Nov 2016 12:38:38 +0000 (13:38 +0100)]
man: document the new ip accounting and filting directives

6 years agocgroup: refuse to return accounting data if accounting isn't turned on
Lennart Poettering [Thu, 7 Sep 2017 14:31:01 +0000 (16:31 +0200)]
cgroup: refuse to return accounting data if accounting isn't turned on

We used to be a bit sloppy on this, and handed out accounting data even
for units where accounting wasn't explicitly enabled. Let's be stricter
here, so that we know the accounting data is actually fully valid. This
is necessary, as the accounting data is no longer stored exclusively in
cgroupfs, but is partly maintained external of that, and flushed during
unit starts. We should hence only expose accounting data we really know
is fully current.

6 years agocore: when coming back from reload/reexec, reapply all cgroup properties
Lennart Poettering [Thu, 7 Sep 2017 12:32:33 +0000 (14:32 +0200)]
core: when coming back from reload/reexec, reapply all cgroup properties

With this change we'll invalidate all cgroup settings after coming back
from a daemon reload/reexec, so that the new settings are instantly
applied.

This is useful for the BPF case, because we don't serialize/deserialize
the BPF program fd, and hence have to install a new, updated BPF program
when coming back from the reload/reexec. However, this is also useful
for the rest of the cgroup settings, as it ensures that user
configuration really takes effect wherever we can.

6 years agocore: serialize/deserialize IP accounting across daemon reload/reexec
Lennart Poettering [Thu, 7 Sep 2017 12:07:13 +0000 (14:07 +0200)]
core: serialize/deserialize IP accounting across daemon reload/reexec

Make sure the current IP accounting counters aren't lost during
reload/reexec.

Note that we destroy all BPF file objects during a reload: the BPF
programs, the access and the accounting maps. The former two need to be
regenerated anyway with the newly loaded configuration data, but the
latter one needs to survive reloads/reexec. In this implementation I
opted to only save/restore the accounting map content instead of the map
itself. While this opens a (theoretic) window where IP traffic is still
accounted to the old map after we read it out, and we thus miss a few
bytes this has the benefit that we can alter the map layout between
versions should the need arise.

6 years agocore: when creating the socket fds for a socket unit, join socket's cgroup first
Lennart Poettering [Thu, 7 Sep 2017 09:17:43 +0000 (11:17 +0200)]
core: when creating the socket fds for a socket unit, join socket's cgroup first

Let's make sure that a socket unit's IPAddressAllow=/IPAddressDeny=
settings are in effect on all socket fds associated with it. In order to
make this happen we need to make sure the cgroup the fds are associated
with are the socket unit's cgroup. The only way to do that is invoking
socket()+accept() in them. Since we really don't want to migrate PID 1
around we do this by forking off a helper process, which invokes
socket()/accept() and sends the newly created fd to PID 1. Ugly, but
works, and there's apparently no better way right now.

This generalizes forking off per-unit helper processes in a new function
unit_fork_helper_process(), which is then also used by the NSS chown()
code of socket units.

6 years agosocket-label: let's use IN_SET, so that we have to call socket_address_family() only...
Lennart Poettering [Thu, 7 Sep 2017 09:15:27 +0000 (11:15 +0200)]
socket-label: let's use IN_SET, so that we have to call socket_address_family() only once

6 years agocore: warn loudly if IP firewalling is configured but not in effect
Lennart Poettering [Wed, 6 Sep 2017 15:56:15 +0000 (17:56 +0200)]
core: warn loudly if IP firewalling is configured but not in effect

6 years agoAdd test for eBPF firewall code
Daniel Mack [Thu, 3 Nov 2016 16:31:25 +0000 (17:31 +0100)]
Add test for eBPF firewall code

6 years agoip-address-access: minimize IP address lists
Lennart Poettering [Tue, 5 Sep 2017 15:41:34 +0000 (17:41 +0200)]
ip-address-access: minimize IP address lists

Let's drop redundant items from the IP address list after parsing. Let's
also mask out redundant bits hidden by the prefixlength.

6 years agomkosi: when the build fails, show its log output, and propagate error
Lennart Poettering [Tue, 5 Sep 2017 10:19:28 +0000 (12:19 +0200)]
mkosi: when the build fails, show its log output, and propagate error

6 years agocore: support IP firewalling to be configured for transient units
Lennart Poettering [Tue, 5 Sep 2017 09:16:35 +0000 (11:16 +0200)]
core: support IP firewalling to be configured for transient units

6 years agocgroup: dump the newly added IP settings in the cgroup context
Lennart Poettering [Fri, 1 Sep 2017 18:31:44 +0000 (20:31 +0200)]
cgroup: dump the newly added IP settings in the cgroup context

6 years agosystemctl: report accounted network traffic in "systemctl status"
Daniel Mack [Thu, 3 Nov 2016 18:00:09 +0000 (19:00 +0100)]
systemctl: report accounted network traffic in "systemctl status"

This hooks up the eposed D-Bus values and displays them like this:

-bash-4.3# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/etc/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2016-11-11 20:10:36 CET; 1min 29s ago
 Main PID: 33 (httpd)
   Status: "Total requests: 22514; Idle/Busy workers 92/7;Requests/sec: 259; Bytes served/sec:  87KB/sec"
  Network: 15.8M in, 51.1M out
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   CGroup: /system.slice/httpd.service
           ├─ 33 /usr/sbin/httpd -DFOREGROUND
           ├─ 37 /usr/sbin/httpd -DFOREGROUND
           ├─112 /usr/sbin/httpd -DFOREGROUND
           └─119 /usr/sbin/httpd -DFOREGROUND

6 years agomanager: hook up IP accounting defaults
Daniel Mack [Fri, 1 Sep 2017 14:04:50 +0000 (16:04 +0200)]
manager: hook up IP accounting defaults

6 years agocgroup, unit, fragment parser: make use of new firewall functions
Daniel Mack [Tue, 5 Sep 2017 17:27:53 +0000 (19:27 +0200)]
cgroup, unit, fragment parser: make use of new firewall functions

6 years agoAdd firewall eBPF compiler
Daniel Mack [Fri, 11 Nov 2016 18:41:16 +0000 (19:41 +0100)]
Add firewall eBPF compiler

6 years agocgroup: add fields to accommodate eBPF related details
Daniel Mack [Fri, 11 Nov 2016 18:59:19 +0000 (19:59 +0100)]
cgroup: add fields to accommodate eBPF related details

Add pointers for compiled eBPF programs as well as list heads for allowed
and denied hosts for both directions.

6 years agoAdd IP address address ACL representation and parser
Daniel Mack [Thu, 3 Nov 2016 16:30:06 +0000 (17:30 +0100)]
Add IP address address ACL representation and parser

Add a config directive parser that takes multiple space separated IPv4
or IPv6 addresses with optional netmasks in CIDR notation rvalue and
puts a parsed version of it to linked list of IPAddressAccessItem objects.
The code actually using this will be added later.

6 years agoAdd abstraction model for BPF programs
Daniel Mack [Tue, 18 Oct 2016 15:57:10 +0000 (17:57 +0200)]
Add abstraction model for BPF programs

This object takes a number of bpf_insn members and wraps them together with
the in-kernel reference id. Will be needed by the firewall code.

6 years agobuild-sys: add new kernel bpf.h drop-in
Daniel Mack [Fri, 28 Oct 2016 15:37:54 +0000 (17:37 +0200)]
build-sys: add new kernel bpf.h drop-in

The defines we need are pretty comprehensive and new, hence copy in the
full header from the kernel.

6 years agoin-addr-util: add new helper call in_addr_prefix_from_string_auto()
Lennart Poettering [Fri, 1 Sep 2017 12:25:59 +0000 (14:25 +0200)]
in-addr-util: add new helper call in_addr_prefix_from_string_auto()

This is much like in_addr_prefix_from_string(), but automatically
determines whether IPv4 or IPv6 addresses are specified. Also adds a
test for it.

6 years agoin-addr-util: prefix return parameters with ret_
Lennart Poettering [Fri, 1 Sep 2017 12:08:16 +0000 (14:08 +0200)]
in-addr-util: prefix return parameters with ret_

6 years agoin-addr-util: be more systematic with naming our functions
Lennart Poettering [Fri, 1 Sep 2017 12:40:02 +0000 (14:40 +0200)]
in-addr-util: be more systematic with naming our functions

Let's rename all our functions that process IPv4 in_addr structures
in4_addr_xyz(), following the already establishing naming logic for
this.

Leave the in_addr_xyz() prefix for functions that process the IPv4/IPv6
in_addr_union union instead.

6 years agomanager: initialize timeouts when allocating a naked Manager object
Lennart Poettering [Mon, 4 Sep 2017 16:19:07 +0000 (18:19 +0200)]
manager: initialize timeouts when allocating a naked Manager object

This way we can safely run manager objects from tests and good timeouts
apply. Without this all timeouts are set 0, which means they fire
instantly, when run from tests which do not explicitly configure them
(the way main.c does).

6 years agomanager: watching the cgroup2 inotify fd is safe in test runs too
Lennart Poettering [Tue, 5 Sep 2017 09:40:47 +0000 (11:40 +0200)]
manager: watching the cgroup2 inotify fd is safe in test runs too

Less deviation between test runs and normal runs is always a good idea,
hence enable more stuff that is safe in test runs

6 years agocgroup: always invalidate "cpu" and "cpuacct" together
Lennart Poettering [Tue, 5 Sep 2017 09:17:01 +0000 (11:17 +0200)]
cgroup: always invalidate "cpu" and "cpuacct" together

This doesn't really matter, as we never invalidate cpuacct explicitly,
and there's no real reason to care for it explicitly, however it's
prettier if we always treat cpu and cpuacct as belonging together, the
same way we conisder "io" and "blkio" to belong together.

6 years agocgroup-util: minor coding style adjustment
Lennart Poettering [Mon, 4 Sep 2017 16:18:04 +0000 (18:18 +0200)]
cgroup-util: minor coding style adjustment

6 years agocore: make sure to dump cgroup context when unit_dump() is called for all unit types
Lennart Poettering [Tue, 5 Sep 2017 17:20:29 +0000 (19:20 +0200)]
core: make sure to dump cgroup context when unit_dump() is called for all unit types

For some reason we didn't dump the cgroup context for a number of unit
types, including service units. Not sure how this wasn't noticed
before... Add this in.

6 years agojournald: make maximum size of stream log lines configurable and bump it to 48K ...
Lennart Poettering [Fri, 22 Sep 2017 08:22:24 +0000 (10:22 +0200)]
journald: make maximum size of stream log lines configurable and bump it to 48K (#6838)

This adds a new setting LineMax= to journald.conf, and sets it by
default to 48K. When we convert stream-based stdout/stderr logging into
record-based log entries, read up to the specified amount of bytes
before forcing a line-break.

This also makes three related changes:

- When a NUL byte is read we'll not recognize this as alternative line
  break, instead of silently dropping everything after it. (see #4863)

- The reason for a line-break is now encoded in the log record, if it
  wasn't a plain newline. Specifically, we distuingish "nul",
  "line-max" and "eof", for line breaks due to NUL byte, due to the
  maximum line length as configured with LineMax= or due to end of
  stream. This data is stored in the new implicit _LINE_BREAK= field.
  It's not synthesized for plain \n line breaks.

- A randomized 128bit ID is assigned to each log stream.

With these three changes in place it's (mostly) possible to reconstruct
the original byte streams from log data, as (most) of the context of
the conversion from the byte stream to log records is saved now. (So,
the only bits we still drop are empty lines. Which might be something to
look into in a future change, and which is outside of the scope of this
work)

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=86465
See: #4863
Replaces: #4875

6 years agoMerge pull request #6853 from sourcejedi/GetAll
Lennart Poettering [Thu, 21 Sep 2017 19:41:55 +0000 (21:41 +0200)]
Merge pull request #6853 from sourcejedi/GetAll

 sd-bus: fix response for GetAll on non-existent objects

6 years agoLink to the right glibc commit in comment (#6884)
Zbigniew Jędrzejewski-Szmek [Thu, 21 Sep 2017 18:54:16 +0000 (20:54 +0200)]
Link to the right glibc commit in comment (#6884)

Reported by Marcos Mello.

Fixes #6882.

6 years agoexecute: fix typo in error message (#6881)
Jan Synacek [Thu, 21 Sep 2017 08:38:52 +0000 (10:38 +0200)]
execute: fix typo in error message (#6881)

6 years agoMerge pull request #6847 from keszybz/disable-enable-generators
Lennart Poettering [Wed, 20 Sep 2017 17:51:44 +0000 (19:51 +0200)]
Merge pull request #6847 from keszybz/disable-enable-generators

Disable and optionally again enable generators in test mode

6 years agopath-lookup: fix minor memleak
Zbigniew Jędrzejewski-Szmek [Sat, 16 Sep 2017 09:31:16 +0000 (11:31 +0200)]
path-lookup: fix minor memleak

Introduced in a1f31f4715.

6 years agoanalyze-verify: add --generators switch to enable generators again
Zbigniew Jędrzejewski-Szmek [Sat, 16 Sep 2017 09:29:34 +0000 (11:29 +0200)]
analyze-verify: add --generators switch to enable generators again

6 years agoMake test_run into a flags field and disable generators again
Zbigniew Jędrzejewski-Szmek [Sat, 16 Sep 2017 09:19:43 +0000 (11:19 +0200)]
Make test_run into a flags field and disable generators again

Now generators are only run in systemd --test mode, where this makes
most sense (how are you going to test what would happen otherwise?).

Fixes #6842.

v2:
- rename test_run to test_run_flags

6 years agonetworkd: route - support unicast,blackhole,unreachable and prohibited (#6861)
Susant Sahani [Tue, 19 Sep 2017 14:28:26 +0000 (19:58 +0530)]
networkd: route - support unicast,blackhole,unreachable and prohibited (#6861)

Resolves issues #797 and #967.

Conf

```
[Route]
Type=blackhole
Destination=202.54.1.2
```

ip route

```
blackhole 202.54.1.2 proto static

6 years agotests: change dbus tests to use user bus (#6845)
Michael Biebl [Tue, 19 Sep 2017 12:17:57 +0000 (14:17 +0200)]
tests: change dbus tests to use user bus (#6845)

This makes it possible to run more dbus tests in a build
environment/chroot where no system bus is available.
To run the dbus test one then can use dbus-run-session.

6 years agoAdded docs for new timezone support added at #6788 (#6865)
Ivan Kurnosov [Tue, 19 Sep 2017 09:23:34 +0000 (21:23 +1200)]
Added docs for new timezone support added at #6788 (#6865)

6 years agosystemd-link: Add support to configure tx-tcp6-segmentation (#6859)
Susant Sahani [Tue, 19 Sep 2017 08:49:58 +0000 (14:19 +0530)]
systemd-link: Add support to configure tx-tcp6-segmentation (#6859)

closes #6854

tcp-segmentation-offload: off
tx-tcp-segmentation: off
tx-tcp-ecn-segmentation: off [fixed]
tx-tcp-mangleid-segmentation: off
tx-tcp6-segmentation: off <==========================

6 years agoMerge pull request #6855 from keszybz/more-docs
Lennart Poettering [Tue, 19 Sep 2017 08:38:40 +0000 (10:38 +0200)]
Merge pull request #6855 from keszybz/more-docs

More docs

6 years agonetworkd: change UseMTU default to true. (#6837)
Dimitri John Ledkov [Tue, 19 Sep 2017 08:26:17 +0000 (09:26 +0100)]
networkd: change UseMTU default to true. (#6837)

Typically when DHCP server sets MTU it is a lower one. And a lower than usual
MTU is then thus required on said network to have operational networking. This
makes networkd's dhcp client to work in more similar way to other dhcp-clients
(e.g. isc-dhcp). In particular, in a cloud setting, without this default
instances have resulted in timing out talking to cloud metadata source and
failing to provision.

This does not change this default for the Annonymize code path.

6 years agobuild-sys: bump xslt maxdepth limit (#6863)
Zbigniew Jędrzejewski-Szmek [Tue, 19 Sep 2017 06:04:02 +0000 (08:04 +0200)]
build-sys: bump xslt maxdepth limit (#6863)

With libxslt-1.30, builds were failing on some recursion depth limit
with systemd.index.xml. Bumping the limit fixes the issue.

6 years agotypo: chache → cache (#6864)
Ansgar Burchardt [Tue, 19 Sep 2017 04:48:09 +0000 (06:48 +0200)]
typo: chache → cache (#6864)

6 years agoman/systemd.special: correct what slices.target pulls in (#6862)
Alan Jenkins [Mon, 18 Sep 2017 15:43:19 +0000 (16:43 +0100)]
man/systemd.special: correct what slices.target pulls in (#6862)

6 years agosd-radv: Free DNS domain search list on unref (#6858)
Patrik Flykt [Mon, 18 Sep 2017 10:09:44 +0000 (13:09 +0300)]
sd-radv: Free DNS domain search list on unref (#6858)

6 years agoMerge pull request #6851 from keszybz/fix-masking-with-empty-files
Evgeny Vereshchagin [Sun, 17 Sep 2017 21:07:12 +0000 (00:07 +0300)]
Merge pull request #6851 from keszybz/fix-masking-with-empty-files

Fix masking with empty files

6 years agotest-exec-util: add two test cases for scripts masked with empty file
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 13:17:50 +0000 (15:17 +0200)]
test-exec-util: add two test cases for scripts masked with empty file

A test for #6831. Fails without the previous commit.

Suggested by Evgeny Vereshchagin.

6 years agoconf-files: fix check for masking with empty files
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 13:26:01 +0000 (15:26 +0200)]
conf-files: fix check for masking with empty files

Fixes #6831.

6 years agoman: describe user@host:machine syntax
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 19:05:20 +0000 (21:05 +0200)]
man: describe user@host:machine syntax

Fixes #6734.

6 years agoman: update limits on seat and session identifiers in sd-login(3)
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 18:05:57 +0000 (20:05 +0200)]
man: update limits on seat and session identifiers in sd-login(3)

For the session identifier, the code is currently slightly stricter, because it
only uses digits and letters, than the description. This should be OK.

Fixes #6745.

6 years agoman: import "Multi-Seat on Linux" into sd-login(3)
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 17:52:15 +0000 (19:52 +0200)]
man: import "Multi-Seat on Linux" into sd-login(3)

The document on the wiki is partially outdated and not very visible.  Let's
import the gist of it here. The original text is retained, with only grammar
and stylistic and formatting changes.

6 years agosd-bus: style nitpick node_vtable_get_userdata()
Alan Jenkins [Sat, 16 Sep 2017 11:32:59 +0000 (12:32 +0100)]
sd-bus: style nitpick node_vtable_get_userdata()

It's confusing to use a single void* to store data with two different
types, i.e. a userdata value which is safe to pass to ->find(), and a
userdata value which identifies the found object.

Name the latter `found_u`.  This naming treats (!c->find) as a degenerate
case.  (I.e. at that point, we know the object has already been found :).

6 years agosd-bus: fix response for GetAll on non-existent objects
Alan Jenkins [Sat, 16 Sep 2017 13:39:22 +0000 (14:39 +0100)]
sd-bus: fix response for GetAll on non-existent objects

Before this commit, if you run `loginctl user-status` from
debug-shell.service (and you have no login sessions for root), you always
see this output:

0
Linger: no

because Properties.GetAll is returning success but without any properties,
when the only find() callback had returned 0 to mean "no object found".

After:

Could not get properties: Unknown object:
'/org/freedesktop/login1/user/self'

BTW I have a fix for more user-friendly messages from logind in this case.
It is pending in my local branch for #6829 "fix `loginctl enable-linger`".

6 years agoMerge pull request #6788 from zerkms/TIMER_TIMEZONE
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 13:05:35 +0000 (15:05 +0200)]
Merge pull request #6788 from zerkms/TIMER_TIMEZONE

Timezone support for timers

6 years agoFix for dst/non-dst timezones
Ivan Kurnosov [Sun, 17 Sep 2017 11:09:38 +0000 (23:09 +1200)]
Fix for dst/non-dst timezones

The problem was with the tm.tm_isdst that is set to the current environment
value: either DST or not. While the current state is not relevant to the state
in the desired date.

Hence — it should be reset so that the mktime_or_timegm could normalise it
later.

6 years agoMerge pull request #6846 from keszybz/fix-udev_event_apply_format
Lennart Poettering [Sun, 17 Sep 2017 10:04:21 +0000 (12:04 +0200)]
Merge pull request #6846 from keszybz/fix-udev_event_apply_format

Fix udev_event_apply_format()

6 years agotest-date: add more logging on error
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 07:50:52 +0000 (09:50 +0200)]
test-date: add more logging on error

6 years agoMerge pull request #6840 from keszybz/more-docs
Lennart Poettering [Sun, 17 Sep 2017 09:56:24 +0000 (11:56 +0200)]
Merge pull request #6840 from keszybz/more-docs

Some more documentation updates

6 years agoSimplify the if cases for timezone checking
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 07:10:03 +0000 (09:10 +0200)]
Simplify the if cases for timezone checking

Just to reduce the indentation a bit.

6 years agoAdded timezone to the CalendarSpec, parser/formatter and the timedatectl
Ivan Kurnosov [Wed, 6 Sep 2017 09:56:36 +0000 (21:56 +1200)]
Added timezone to the CalendarSpec, parser/formatter and the timedatectl

6 years agoMove one space from dbus-execute.c to execute.c
Zbigniew Jędrzejewski-Szmek [Sat, 16 Sep 2017 06:45:02 +0000 (08:45 +0200)]
Move one space from dbus-execute.c to execute.c

The number of spaces is conserved ;)

6 years agoudev: fix buffer overflow in udev_event_apply_format()
Zbigniew Jędrzejewski-Szmek [Sat, 16 Sep 2017 06:38:28 +0000 (08:38 +0200)]
udev: fix buffer overflow in udev_event_apply_format()

Fixes #6664.

6 years agofix path in btrfs rule (#6844)
Christian Hesse [Fri, 15 Sep 2017 19:28:24 +0000 (21:28 +0200)]
fix path in btrfs rule (#6844)

Commit 0e8856d2 (assemble multidevice btrfs volumes without external
tools (#6607)) introduced a call to udevadm. That lives in @rootbindir@,
not @rootlibexecdir@. So fix the path.

6 years agoMerge pull request #6832 from poettering/keyring-mode
Zbigniew Jędrzejewski-Szmek [Fri, 15 Sep 2017 19:24:48 +0000 (21:24 +0200)]
Merge pull request #6832 from poettering/keyring-mode

Add KeyringMode unit property to fix cryptsetup key caching

6 years agoMerge pull request #6841 from poettering/doc-exit-codes
Zbigniew Jędrzejewski-Szmek [Fri, 15 Sep 2017 15:26:35 +0000 (17:26 +0200)]
Merge pull request #6841 from poettering/doc-exit-codes

document exit codes

6 years agoman: use "filename" not "file name" by default
Zbigniew Jędrzejewski-Szmek [Fri, 15 Sep 2017 12:59:45 +0000 (14:59 +0200)]
man: use "filename" not "file name" by default

We settled on "filename" and "file system", so change a couple of places for
consistency. The exception is when there's an adjective before "file" that
binds more strongly then "name": "password file name", "output file name", etc.
Those cases are left intact.

6 years agoman: update udevadm -y/--sysname-match documentation
Russell Stuart [Tue, 12 Sep 2017 23:25:04 +0000 (09:25 +1000)]
man: update udevadm -y/--sysname-match documentation

Fixes #6792.

[zj: reorganize the sentece for grammatical correctness.]

6 years agomailmap: add entry to fix encoding issues
Zbigniew Jędrzejewski-Szmek [Fri, 15 Sep 2017 12:49:44 +0000 (14:49 +0200)]
mailmap: add entry to fix encoding issues

6 years agoman: add a whole section detailing journal stdout/stderr stream logging
Lennart Poettering [Fri, 15 Sep 2017 12:17:32 +0000 (14:17 +0200)]
man: add a whole section detailing journal stdout/stderr stream logging

Details about EPIPE/SIGPIPE handling, metadata and more.

Fixes: #6620

6 years agocryptsetup: make sure we invoke the cryptsetup tools with a shared keyring
Lennart Poettering [Thu, 14 Sep 2017 19:23:56 +0000 (21:23 +0200)]
cryptsetup: make sure we invoke the cryptsetup tools with a shared keyring

We want that cryptsetup can cache keys between multiple invocations, and
it does so via the root user's user keyring, hence let's share it among
services.

Replaces: #6286

6 years agocore: add new per-unit setting KeyringMode= for controlling kernel keyring setup
Lennart Poettering [Thu, 14 Sep 2017 19:19:05 +0000 (21:19 +0200)]
core: add new per-unit setting KeyringMode= for controlling kernel keyring setup

Usually, it's a good thing that we isolate the kernel session keyring
for the various services and disconnect them from the user keyring.
However, in case of the cryptsetup key caching we actually want that
multiple instances of the cryptsetup service can share the keys in the
root user's user keyring, hence we need to be able to disable this logic
for them.

This adds KeyringMode=inherit|private|shared:

    inherit: don't do any keyring magic (this is the default in systemd --user)
    private: a private keyring as before (default in systemd --system)
    shared: the new setting

6 years agoMerge pull request #6830 from keszybz/generator-dirs
Lennart Poettering [Fri, 15 Sep 2017 14:48:41 +0000 (16:48 +0200)]
Merge pull request #6830 from keszybz/generator-dirs

Redirect generators to a temporary directory in test mode

6 years agodoc: document service exit codes
Jan Synacek [Thu, 26 Jan 2017 12:45:46 +0000 (13:45 +0100)]
doc: document service exit codes

(Heavily reworked by Lennart while rebasing)

Fixes: #3545
Replaces: #5159

6 years agoexecute: improve and augment execution log messages
Lennart Poettering [Fri, 15 Sep 2017 14:42:09 +0000 (16:42 +0200)]
execute: improve and augment execution log messages

Let's generate friendly messages for more cases, and make slight
adjustments to the existing messages.

6 years agoexit-status: drop EXIT_MAKE_STARTER
Lennart Poettering [Fri, 15 Sep 2017 14:41:19 +0000 (16:41 +0200)]
exit-status: drop EXIT_MAKE_STARTER

This is unused since kdbus has been removed.

6 years agobuild-sys: require libmount >= 2.30 (#6795)
Zbigniew Jędrzejewski-Szmek [Fri, 15 Sep 2017 12:47:57 +0000 (14:47 +0200)]
build-sys: require libmount >= 2.30 (#6795)

Fixes #4871.

The new libmount has two changes relevant for us:

- x-* options are propagated to /run/mount/utab and are visible through
  libmount (fixes #4817).

- umount -c now really works (partially solves #6115).

6 years agoMerge pull request #6772 from pfl/dnssl
Lennart Poettering [Fri, 15 Sep 2017 11:17:36 +0000 (13:17 +0200)]
Merge pull request #6772 from pfl/dnssl

networkd: DNSSL option for systemd-networkd prefix delegation

6 years agoman: update the description of machinectl -M
Zbigniew Jędrzejewski-Szmek [Fri, 15 Sep 2017 09:47:46 +0000 (11:47 +0200)]
man: update the description of machinectl -M

Fixes #6621.

Also rework the introduction a bit.

6 years agoman: explain when networkd removed existing configuration and when not
Zbigniew Jędrzejewski-Szmek [Fri, 15 Sep 2017 09:23:57 +0000 (11:23 +0200)]
man: explain when networkd removed existing configuration and when not

Fixes #6693.

6 years agoman: Document Domains for Router Advertisement network configuration
Patrik Flykt [Thu, 7 Sep 2017 09:24:00 +0000 (12:24 +0300)]
man: Document Domains for Router Advertisement network configuration

6 years agotest-ndisc-ra: Update test to include DNSSL option
Patrik Flykt [Mon, 21 Aug 2017 12:20:56 +0000 (15:20 +0300)]
test-ndisc-ra: Update test to include DNSSL option

Update the test to include the already provided DNSSL option.

6 years agonetworkd-radv: Set DNSSL information on Router Advertisement enabling
Patrik Flykt [Mon, 21 Aug 2017 10:44:25 +0000 (13:44 +0300)]
networkd-radv: Set DNSSL information on Router Advertisement enabling

6 years agosd-radv: Add Router Advertisement DNS Search List option
Patrik Flykt [Mon, 21 Aug 2017 10:41:20 +0000 (13:41 +0300)]
sd-radv: Add Router Advertisement DNS Search List option

Add Router Advertisement DNS Search List option as specified
in RFC 8106. The search list option uses and identical option
header as the RDNSS option and therefore the option header
structure can be reused.

If systemd is compiled with IDNA support, internationalization
of the provided search domain is applied, after which the search
list is written in wire format into the DNSSL option.

6 years agonetworkd: Parse DNS search domain information for Router Advertisement
Patrik Flykt [Wed, 16 Aug 2017 10:29:51 +0000 (13:29 +0300)]
networkd: Parse DNS search domain information for Router Advertisement

Parse DNS search domains from .network files so that they are included
in Router Advertisement DNSSL options.

DNS search domains are added to the [IPv6PrefixDelegation] section using
the following syntax:

    Domains=foo.example.com bar.example.com

If IDNA libraries are enabled in systemd, international domain names
are supported.

6 years agoman: delete note about propagating signal termination
Zbigniew Jędrzejewski-Szmek [Fri, 15 Sep 2017 07:33:17 +0000 (09:33 +0200)]
man: delete note about propagating signal termination

That advice is generally apropriate for "user" programs, i.e. programs which
are run interactively and used pipelines and such. But it makes less sense for
daemons to propagate the exit signal. For example, if a process receives a SIGTERM,
it is apropriate for it to exit with 0 code. So let's just delete the whole
paragraph, since this page doesn't seem to be the right place for the longer
discussion which would be required to mention all the caveats and considerations.

Fixes #6415.

6 years agoRevert "device : reload when udev generates a "changed" event" (#6836)
Martin Pitt [Fri, 15 Sep 2017 07:21:49 +0000 (09:21 +0200)]
Revert "device : reload when udev generates a "changed" event" (#6836)

This reverts commit 0ffddc6e2c6e19e5dc81812aee9fbe964059f3aa. That
causes a rather severe disruption of D-Bus and other services when e. g.
restarting local-fs.target (as spotted by the "storage" test regression).

Fixes #6834

6 years agocore: make sure that $JOURNAL_STREAM prefers stderr over stdout information (#6824)
Lennart Poettering [Fri, 15 Sep 2017 06:26:38 +0000 (08:26 +0200)]
core: make sure that $JOURNAL_STREAM prefers stderr over stdout information (#6824)

If two separate log streams are connected to stdout and stderr, let's
make sure $JOURNAL_STREAM points to the latter, as that's the preferred
log destination, and the environment variable has been created in order
to permit services to automatically upgrade from stderr based logging to
native journal logging.

Also, document this behaviour.

Fixes: #6800