platform/upstream/systemd.git
7 years agohwdb: switch meson to use ids_parser.py (#6964)
Zbigniew Jędrzejewski-Szmek [Wed, 4 Oct 2017 17:32:59 +0000 (19:32 +0200)]
hwdb: switch meson to use ids_parser.py (#6964)

Also drop the now-unused perl implementation (that doesn't do sorting),
so it's incompatible anyway.

7 years agoudevadm,basic: replace nulstr_contains with STR_IN_SET (#6965)
Zbigniew Jędrzejewski-Szmek [Wed, 4 Oct 2017 17:32:12 +0000 (19:32 +0200)]
udevadm,basic: replace nulstr_contains with STR_IN_SET (#6965)

STR_IN_SET is a newer approach which is easier to write and read, and which
seems to result in space savings too:

before:
4949848 build/src/shared/libsystemd-shared-234.so
 350704 build/systemctl
4967184 build/systemd
 826216 build/udevadm

after:
4949848 build/src/shared/libsystemd-shared-234.so
 350704 build/systemctl
4966888 build/systemd
 826168 build/udevadm

7 years agonss-systemd: if cannot open bus, then try to read user info directly (#6971)
Yu Watanabe [Wed, 4 Oct 2017 17:29:36 +0000 (02:29 +0900)]
nss-systemd: if cannot open bus, then try to read user info directly (#6971)

If sd_bus_open_system() fail, then try to read information about
dynamic users from /run/systemd/dynamic-uid.
This makes services can successfully call getpwuid() or their friends
even if dbus.service is not started yet.

Fixes #6967.

7 years agoMerge pull request #6974 from keszybz/clean-up-defines
Lennart Poettering [Wed, 4 Oct 2017 17:25:30 +0000 (19:25 +0200)]
Merge pull request #6974 from keszybz/clean-up-defines

Clean up define definitions

7 years agoMerge pull request #6985 from yuwata/empty
Lennart Poettering [Wed, 4 Oct 2017 15:54:35 +0000 (17:54 +0200)]
Merge pull request #6985 from yuwata/empty

load-fragment: do not create empty array

7 years agotree-wide: use IN_SET macro (#6977)
Yu Watanabe [Wed, 4 Oct 2017 14:01:32 +0000 (23:01 +0900)]
tree-wide: use IN_SET macro (#6977)

7 years agoMerge pull request #6986 from OpenDZ/tixxdz/seccomp-more-default-syscalls-v1
Djalal Harouni [Wed, 4 Oct 2017 13:01:21 +0000 (15:01 +0200)]
Merge pull request #6986 from OpenDZ/tixxdz/seccomp-more-default-syscalls-v1

seccomp: add sched_yield syscall to the @default syscall set

7 years agoman: fix that the same option is listed twice (#6991)
Yu Watanabe [Wed, 4 Oct 2017 12:43:00 +0000 (21:43 +0900)]
man: fix that the same option is listed twice (#6991)

7 years agounits: prohibit all IP traffic on all our long-running services (#6921)
Lennart Poettering [Wed, 4 Oct 2017 12:16:28 +0000 (14:16 +0200)]
units: prohibit all IP traffic on all our long-running services (#6921)

Let's lock things down further.

7 years agomeson: generate ENABLE_* names automatically
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 11:15:27 +0000 (13:15 +0200)]
meson: generate ENABLE_* names automatically

After previous changes, the naming of configuration options and internal
defines is consistent.

7 years agobuild-sys: s/ENABLE_RESOLVED/ENABLE_RESOLVE/
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 11:12:29 +0000 (13:12 +0200)]
build-sys: s/ENABLE_RESOLVED/ENABLE_RESOLVE/

The configuration option was called -Dresolve, but the internal define
was …RESOLVED. This options governs more than just resolved itself, so
let's settle on the version without "d".

7 years agobuild-sys: s/HAVE_MYHOSTNAME/ENABLE_MYHOSTNAME/
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 10:23:55 +0000 (12:23 +0200)]
build-sys: s/HAVE_MYHOSTNAME/ENABLE_MYHOSTNAME/

Same justification as for HAVE_UTMP. HAVE_MYHOSTNAME was used before mysthostname
was merged into systemd.

7 years agobuild-sys: s/HAVE_SMACK/ENABLE_SMACK/
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 10:22:40 +0000 (12:22 +0200)]
build-sys: s/HAVE_SMACK/ENABLE_SMACK/

Same justification as for HAVE_UTMP.

7 years agobuild-sys: s/HAVE_IMA/ENABLE_IMA/
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 10:20:49 +0000 (12:20 +0200)]
build-sys: s/HAVE_IMA/ENABLE_IMA/

Same justification as for HAVE_UTMP.

7 years agobuild-sys: s/HAVE_UTMP/ENABLE_UTMP/
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 10:19:30 +0000 (12:19 +0200)]
build-sys: s/HAVE_UTMP/ENABLE_UTMP/

"Have" should be about the external environment and dependencies. Anything
which is a pure yes/no choice should be "enable".

7 years agobuild-sys: require all defines under #if to be present
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 10:11:49 +0000 (12:11 +0200)]
build-sys: require all defines under #if to be present

This should help to catch any errors with typos and HAVE/ENABLE mismatches.

7 years agotest-nss: fix names of two defines
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 10:10:57 +0000 (12:10 +0200)]
test-nss: fix names of two defines

That's another bug fixed (sys/auxv.h was the first).

7 years agobuild-sys: use #if Y instead of #ifdef Y everywhere
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 08:41:51 +0000 (10:41 +0200)]
build-sys: use #if Y instead of #ifdef Y everywhere

The advantage is that is the name is mispellt, cpp will warn us.

$ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/"
$ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;'
$ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g'
$ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g'
+ manual changes to meson.build

squash! build-sys: use #if Y instead of #ifdef Y everywhere

v2:
- fix incorrect setting of HAVE_LIBIDN2

7 years agoseccomp: add sched_yield syscall to the @default syscall set
Djalal Harouni [Wed, 4 Oct 2017 09:41:42 +0000 (10:41 +0100)]
seccomp: add sched_yield syscall to the @default syscall set

7 years agocore: use strv_isempty to check if supplementary_groups is empty
Zbigniew Jędrzejewski-Szmek [Wed, 4 Oct 2017 09:33:30 +0000 (11:33 +0200)]
core: use strv_isempty to check if supplementary_groups is empty

With the previous commit, we know that it will be NULL if empty, but
it's safe to always use strv_isempty() in case the code changes
in the future.

7 years agoload-fragment: do not create empty array
Yu Watanabe [Wed, 4 Oct 2017 06:21:12 +0000 (15:21 +0900)]
load-fragment: do not create empty array

Originally added in 4589f5bb0a973e9a41be93de06c87072cea4dfb9.
C.f. 8249bb728db6c2abaf12575d661b52571bdc1ab1 and #6746.

7 years agoman: empty string resets the list of NTP servers (#6984)
Yu Watanabe [Wed, 4 Oct 2017 09:09:32 +0000 (18:09 +0900)]
man: empty string resets the list of NTP servers (#6984)

7 years agomeson: check for sys/auxv.h
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 10:09:40 +0000 (12:09 +0200)]
meson: check for sys/auxv.h

This check was present in configure.ac, but was never added under meson.
The code under HAVE_SYS_AUX_H has been dead ever since :(.

7 years agobuild-sys: change all HAVE_DECL_ macros to HAVE_
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 08:32:34 +0000 (10:32 +0200)]
build-sys: change all HAVE_DECL_ macros to HAVE_

This is a legacy of autotools, where one detection routine used a different
prefix then the others.

$ git grep -e HAVE_DECL_ -l|xargs sed -i s/HAVE_DECL_/HAVE_/g

7 years agoMerge pull request #6946 from poettering/synthesize-dns
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 08:26:53 +0000 (10:26 +0200)]
Merge pull request #6946 from poettering/synthesize-dns

Some DNS RR synthesizing fixes

7 years agoseccomp: remove '@credentials' syscall set (#6958)
Djalal Harouni [Tue, 3 Oct 2017 05:20:05 +0000 (07:20 +0200)]
seccomp: remove '@credentials' syscall set (#6958)

This removes the '@credentials' syscall set that was added in commit
v234-468-gcd0ddf6f75.

Most of these syscalls are so simple that we do not want to filter them.
They work on the current calling process, doing only read operations,
they do not have a deep kernel path.

The problem may only be in 'capget' syscall since it can query arbitrary
processes, and used to discover processes, however sending signal 0 to
arbitrary processes can be used to discover if a process exists or not.
It is unfortunate that Linux allows to query processes of different
users. Lets put it now in '@process' syscall set, and later we may add
it to a new '@basic-process' set that allows most basic process
operations.

7 years agoMerge pull request #6940 from poettering/magic-dirs
Yu Watanabe [Tue, 3 Oct 2017 04:28:48 +0000 (13:28 +0900)]
Merge pull request #6940 from poettering/magic-dirs

make sure StateDirectory= and friends play nicely with DynamicUser= and RootImage=/RootDirectory=

7 years agoMerge pull request #6943 from poettering/dissect-ro
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 18:39:08 +0000 (20:39 +0200)]
Merge pull request #6943 from poettering/dissect-ro

Automatically recognize that "squashfs" and "iso9660" area always read-only

7 years agoupdate TODO
Lennart Poettering [Thu, 28 Sep 2017 17:35:32 +0000 (19:35 +0200)]
update TODO

7 years agocore: fix special directories for user services
Lennart Poettering [Mon, 2 Oct 2017 09:27:03 +0000 (11:27 +0200)]
core: fix special directories for user services

The system paths were listed where the user paths should have been
listed. Correct that.

7 years agopath-util: some updates to path_make_relative()
Lennart Poettering [Mon, 2 Oct 2017 08:51:19 +0000 (10:51 +0200)]
path-util: some updates to path_make_relative()

Don't miscount number of "../" to generate, if we "." is included in an
input path.

Also, refuse if we encounter "../" since we can't possibly follow that
up properly, without file system access.

Some other modernizations.

7 years agocore: fix StateDirectory= (and friends) safety checks when decoding transient unit...
Lennart Poettering [Mon, 2 Oct 2017 08:50:07 +0000 (10:50 +0200)]
core: fix StateDirectory= (and friends) safety checks when decoding transient unit properties

Let's make sure relative directories such as "foo/bar" are accepted, by
using the same validation checks as in unit file parsing.

7 years agotest: add test for DynamicUser= + StateDirectory=
Lennart Poettering [Thu, 28 Sep 2017 21:41:06 +0000 (23:41 +0200)]
test: add test for DynamicUser= + StateDirectory=

Also, tests for DynamicUser= should really run for system mode, as we
allocate from a system resource.

(This also increases the test timeout to 2min. If one of our tests
really hangs then waiting for 2min longer doesn't hurt either. The old
2s is really short, given that we run in potentially slow VM
environments for this test. This becomes noticable when the slow "find"
command this adds is triggered)

7 years agocore: pass the correct error to the caller
Lennart Poettering [Thu, 28 Sep 2017 18:33:38 +0000 (20:33 +0200)]
core: pass the correct error to the caller

7 years agocore: when looking for a UID to use for a dynamic UID start with the current owner...
Lennart Poettering [Thu, 28 Sep 2017 18:28:09 +0000 (20:28 +0200)]
core: when looking for a UID to use for a dynamic UID start with the current owner of the StateDirectory= and friends

Let's optimize dynamic UID allocation a bit: if a StateDirectory= (or
suchlike) is configured, we start our allocation loop from that UID and
use it if it currently isn't used otherwise. This is beneficial as it
saves us from having to expensively recursively chown() these
directories in the typical case (which StateDirectory= does when it
notices that the owner of the directory doesn't match the UID picked).

With this in place we now have the a three-phase logic for allocating a
dynamic UID:

a) first, we try to use the owning UID of StateDirectory=,
   CacheDirectory=, LogDirectory= if that exists and is currently
   otherwise unused.

b) if that didn't work out, we hash the UID from the service name

c) if that didn't yield an unused UID either, randomly pick new ones
   until we find a free one.

7 years agoman: document the new logic
Lennart Poettering [Thu, 28 Sep 2017 17:14:10 +0000 (19:14 +0200)]
man: document the new logic

7 years agoexecute: make StateDirectory= and friends compatible with DynamicUser=1 and RootDirec...
Lennart Poettering [Thu, 28 Sep 2017 16:55:45 +0000 (18:55 +0200)]
execute: make StateDirectory= and friends compatible with DynamicUser=1 and RootDirectory=/RootImage=

Let's clean up the interaction of StateDirectory= (and friends) to
DynamicUser=1: instead of creating these directories directly below
/var/lib, place them in /var/lib/private instead if DynamicUser=1 is
set, making that directory 0700 and owned by root:root. This way, if a
dynamic UID is later reused, access to the old run's state directory is
prohibited for that user. Then, use file system namespacing inside the
service to make /var/lib/private a readable tmpfs, hiding all state
directories that are not listed in StateDirectory=, and making access to
the actual state directory possible. Mount all directories listed in
StateDirectory= to the same places inside the service (which means
they'll now be mounted into the tmpfs instance). Finally, add a symlink
from the state directory name in /var/lib/ to the one in
/var/lib/private, so that both the host and the service can access the
path under the same location.

Here's an example: let's say a service runs with StateDirectory=foo.
When DynamicUser=0 is set, it will get the following setup, and no
difference between what the unit and what the host sees:

        /var/lib/foo (created as directory)

Now, if DynamicUser=1 is set, we'll instead get this on the host:

        /var/lib/private (created as directory with mode 0700, root:root)
        /var/lib/private/foo (created as directory)
        /var/lib/foo → private/foo (created as symlink)

And from inside the unit:

        /var/lib/private (a tmpfs mount with mode 0755, root:root)
        /var/lib/private/foo (bind mounted from the host)
        /var/lib/foo → private/foo (the same symlink as above)

This takes inspiration from how container trees are protected below
/var/lib/machines: they generally reuse UIDs/GIDs of the host, but
because /var/lib/machines itself is set to 0700 host users cannot access
files in the container tree even if the UIDs/GIDs are reused. However,
for this commit we add one further trick: inside and outside of the unit
/var/lib/private is a different thing: outside it is a plain,
inaccessible directory, and inside it is a world-readable tmpfs mount
with only the whitelisted subdirs below it, bind mounte din.  This
means, from the outside the dir acts as an access barrier, but from the
inside it does not. And the symlink created in /var/lib/foo itself
points across the barrier in both cases, so that root and the unit's
user always have access to these dirs without knowing the details of
this mounting magic.

This logic resolves a major shortcoming of DynamicUser=1 units:
previously they couldn't safely store persistant data. With this change
they can have their own private state, log and data directories, which
they can write to, but which are protected from UID recycling.

With this change, if RootDirectory= or RootImage= are used it is ensured
that the specified state/log/cache directories are always mounted in
from the host. This change of semantics I think is much preferable since
this means the root directory/image logic can be used easily for
read-only resource bundling (as all writable data resides outside of the
image). Note that this is a change of behaviour, but given that we
haven't released any systemd version with StateDirectory= and friends
implemented this should be a safe change to make (in particular as
previously it wasn't clear what would actually happen when used in
combination). Moreover, by making this change we can later add a "+"
modifier to these setings too working similar to the same modifier in
ReadOnlyPaths= and friends, making specified paths relative to the
container itself.

7 years agonamespace: if we can create the destination of bind and PrivateTmp= mounts
Lennart Poettering [Thu, 28 Sep 2017 16:35:51 +0000 (18:35 +0200)]
namespace: if we can create the destination of bind and PrivateTmp= mounts

When putting together the namespace, always create the file or directory
we are supposed to bind mount on, the same way we do it for most other
stuff, for example mount units or systemd-nspawn's --bind= option.

This has the big benefit that we can use namespace bind mounts on dirs
in /tmp or /var/tmp even in conjunction with PrivateTmp=.

7 years agonamespace: properly handle bind mounts from the host
Lennart Poettering [Thu, 28 Sep 2017 16:30:55 +0000 (18:30 +0200)]
namespace: properly handle bind mounts from the host

Before this patch we had an ordering problem: if we have no namespacing
enabled except for two bind mounts that intend to swap /a and /b via
bind mounts, then we'd execute the bind mount binding /b to /a, followed
by thebind mount from /a to /b, thus having the effect that /b is now
visible in both /a and /b, which was not intended.

With this change, as soon as any bind mount is configured we'll put
together the service mount namespace in a temporary directory instead of
operating directly in the root. This solves the problem in a
straightforward fashion: the source of bind mounts will always refer to
the host, and thus be unaffected from the bind mounts we already
created.

7 years agonamespace: create /dev, /proc, /sys when needed
Lennart Poettering [Thu, 28 Sep 2017 16:28:23 +0000 (18:28 +0200)]
namespace: create /dev, /proc, /sys when needed

We already create /dev implicitly if PrivateTmp=yes is on, if it is
missing. Do so too for the other two API VFS, as well as for /dev if
PrivateTmp=yes is off but MountAPIVFS=yes is on (i.e. when /dev is bind
mounted from the host).

7 years agocore: usually our enum's _INVALID and _MAX special values are named after the full...
Lennart Poettering [Thu, 28 Sep 2017 14:58:43 +0000 (16:58 +0200)]
core: usually our enum's _INVALID and _MAX special values are named after the full type

In most cases we followed the rule that the special _INVALID and _MAX
values we use in our enums use the full type name as prefix (in contrast
to regular values that we often make shorter), do so for
ExecDirectoryType as well.

No functional changes, just a little bit of renaming to make this code
more like the rest.

7 years agocore: chown() StateDirectory= and friends recursively when starting a service
Lennart Poettering [Thu, 28 Sep 2017 17:13:44 +0000 (19:13 +0200)]
core: chown() StateDirectory= and friends recursively when starting a service

This is particularly useful when used in conjunction with DynamicUser=1,
where the UID might change for every invocation, but is useful in other
cases too, for example, when these directories are shared between
systems where the UID assignments differ slightly.

7 years agonspawn: properly report all kinds of changed UID/GID when patching things for userns
Lennart Poettering [Thu, 28 Sep 2017 11:01:33 +0000 (13:01 +0200)]
nspawn: properly report all kinds of changed UID/GID when patching things for userns

We forgot to propagate one chmod().

7 years agoMerge pull request #6960 from keszybz/hwdb-update
Lennart Poettering [Mon, 2 Oct 2017 15:12:58 +0000 (17:12 +0200)]
Merge pull request #6960 from keszybz/hwdb-update

Hwdb update and sorting

7 years agoservice: better detect when a Type=notify service cannot become active anymore (...
Jouke Witteveen [Mon, 2 Oct 2017 14:35:27 +0000 (16:35 +0200)]
service: better detect when a Type=notify service cannot become active anymore (#6959)

No need to wait for a timeout when we know things are not going to work out.
When the main process goes away and only notifications from the main process are
accepted, then we will not receive any notifications anymore.

7 years agoMerge pull request #6941 from andir/use-in_set
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 13:08:10 +0000 (15:08 +0200)]
Merge pull request #6941 from andir/use-in_set

use IN_SET where possible

7 years agoMinor line wrapping adjustment
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 12:52:12 +0000 (14:52 +0200)]
Minor line wrapping adjustment

7 years agoMerge pull request #6932 from poettering/notify-pam
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 12:40:10 +0000 (14:40 +0200)]
Merge pull request #6932 from poettering/notify-pam

fix handling of cgroup empty events for Type=notify services

7 years agohwdb: sort usb classes and vendors
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 11:19:23 +0000 (13:19 +0200)]
hwdb: sort usb classes and vendors

No change, but let's keep the sorting in place as a safeguard for
the future.

7 years agohwdb: sort pci classes and vendors
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 11:19:23 +0000 (13:19 +0200)]
hwdb: sort pci classes and vendors

No change, but let's keep the sorting in place as a safeguard for
the future.

7 years agohwdb: sort sdio entries
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 11:19:23 +0000 (13:19 +0200)]
hwdb: sort sdio entries

Nothing intersting here.

7 years agohwdb: de-duplicate and sort OUI entries
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 11:19:23 +0000 (13:19 +0200)]
hwdb: de-duplicate and sort OUI entries

Ignoring duplicate entry: 0001C8 = "THOMAS CONRAD CORP.", "CONRAD CORP."
Ignoring duplicate entry: 080030 = "NETWORK RESEARCH CORPORATION", "ROYAL MELBOURNE INST OF TECH"
Ignoring duplicate entry: 080030 = "NETWORK RESEARCH CORPORATION", "CERN"
→ we have two vendor prefixes with duplicate entries. For the first one,
there are two entries with what appear to be the same company. In the
second case, the same prefix is assigned to three different entities.
I arbitrarily chose to prefer the first entry.

7 years agoids_parser: allow specifying which parts to run
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 11:19:22 +0000 (13:19 +0200)]
ids_parser: allow specifying which parts to run

7 years agohwdb: add a grammar-based generator for vendor/model and class tables
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 11:19:22 +0000 (13:19 +0200)]
hwdb: add a grammar-based generator for vendor/model and class tables

This is rather slow (1 m 45 s on my laptop), but since it'd be only used
once per release, maybe this doesn't matter that much.

Output is identical to ids-update.pl with the set of source files committed in
the grandparent.

7 years agohwdb: fix invalid encoding in usb.ids
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 11:19:22 +0000 (13:19 +0200)]
hwdb: fix invalid encoding in usb.ids

0xB4 is the code point for "accent acute", but when encoded in utf-8,
is is a multibyte sequence. A single 0xB4 byte is invalid (seems to be
latin1).

7 years agohwdb: also add the source files to git
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 11:19:22 +0000 (13:19 +0200)]
hwdb: also add the source files to git

Without the original files it's hard to see what changed "upstream", and what
entries were added and removed. Upstream did not keep the entries sorted, and
our processing scripts did not sort the output either, so from just looking at
diffs it's hard to say what changed. So let's keep the original data, at least
for a few update cycles, so get a better handle on the upstream changes.

It's a few hundred kilobytes, so not that big, and text, so it should
compresses well.

7 years agohwdb: update
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 11:19:21 +0000 (13:19 +0200)]
hwdb: update

http://www.uefi.org/uefi-pnp-export is returning an internal server error,
so the previous version was used.

7 years agomeson-hwdb-update.sh: add -n param to skip downloads
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 11:19:21 +0000 (13:19 +0200)]
meson-hwdb-update.sh: add -n param to skip downloads

Useful to experiment with the patching part w/o redownloading the files.

7 years agomeson: rename hwdb update target
Zbigniew Jędrzejewski-Szmek [Mon, 2 Oct 2017 11:19:21 +0000 (13:19 +0200)]
meson: rename hwdb update target

ninja -c build hwdb-update

During the initial meson conversion, custom_target:s and run_target:s behaved
the same, and the target name became a top-level command. Now custom_target:s
require the subdir to be included, e.g. we have man/man target to build man pages,
but run_target:s not. So I think this target got a name that is so generic because
of the confusion caused by changing rules. Let's rename it.

7 years agotree-wide: use `!IN_SET(..)` for `a != b && a != c && …`
Andreas Rammhold [Fri, 29 Sep 2017 07:58:22 +0000 (09:58 +0200)]
tree-wide: use `!IN_SET(..)` for `a != b && a != c && …`

The included cocci was used to generate the changes.

Thanks to @flo-wer for pointing this case out.

7 years agotree-wide: use IN_SET where possible
Andreas Rammhold [Thu, 28 Sep 2017 22:37:23 +0000 (00:37 +0200)]
tree-wide: use IN_SET where possible

In addition to the changes from #6933 this handles cases that could be
matched with the included cocci file.

7 years agoman: document that PAMName= and NotifyAccess=all don't mix well.
Lennart Poettering [Fri, 29 Sep 2017 14:56:51 +0000 (16:56 +0200)]
man: document that PAMName= and NotifyAccess=all don't mix well.

See: #6045

7 years agoservice: accept the fact that the three xyz_good() functions return ints
Lennart Poettering [Fri, 29 Sep 2017 14:41:34 +0000 (16:41 +0200)]
service: accept the fact that the three xyz_good() functions return ints

Currently, all three of cgroup_good(), main_pid_good(),
control_pid_good() all return an "int" (two of them propagate errors).
It's a good thing to keep the three functions similar, so let's leave it
at that, but then let's clean up the invocation of the three functions
so that they always clearly acknowledge that the return value is not a
bool, but potentially negative.

7 years agoservice: drop _pure_ decorator on static function
Lennart Poettering [Fri, 29 Sep 2017 14:39:46 +0000 (16:39 +0200)]
service: drop _pure_ decorator on static function

The compiler should be good enough to figure this out on its own if this
is a static function, and it makes control_pid_good() an outlier anyway,
and decorators like this tend to bitrot. Hence, to keep things simple
and automatic, let's just drop the decorator.

7 years agoservice: a cgroup empty notification isn't reason enough to go down
Lennart Poettering [Wed, 27 Sep 2017 17:56:57 +0000 (19:56 +0200)]
service: a cgroup empty notification isn't reason enough to go down

The processes associated with a service are not just the ones in its
cgroup, but also the control and main processes, which might possibly
live outside of it, for example if they transitioned into their own
cgroups because they registered a PAM session of their own. Hence, if we
get a cgroup empty notification always check if the main PID is still
around before taking action too eagerly.

Fixes: #6045

7 years agoservice: add explanatory comments to control_pid_good() and cgroup_good()
Lennart Poettering [Mon, 2 Oct 2017 10:57:03 +0000 (12:57 +0200)]
service: add explanatory comments to control_pid_good() and cgroup_good()

Let's add a similar comment to each as we already have for
main_pid_good(), emphasizing that these functions are supposed to be
have very similar.

7 years agoservice: fix main_pid_good() comment
Lennart Poettering [Wed, 27 Sep 2017 17:56:36 +0000 (19:56 +0200)]
service: fix main_pid_good() comment

We don't actually return -1, don't claim that.

7 years agocatalog: update Polish translation (#6947)
Piotr Drąg [Sat, 30 Sep 2017 12:39:29 +0000 (14:39 +0200)]
catalog: update Polish translation (#6947)

7 years agoresolved: synthesize records for the full local hostname, too
Lennart Poettering [Fri, 29 Sep 2017 16:05:51 +0000 (18:05 +0200)]
resolved: synthesize records for the full local hostname, too

This was forgotten, let's add it too, so that the llmnr, mdns and full
hostname RRs are all synthesized if needed.

7 years agoresolved: make sure a non-existing PTR record never gets mangled into NODATA
Lennart Poettering [Fri, 29 Sep 2017 16:02:31 +0000 (18:02 +0200)]
resolved: make sure a non-existing PTR record never gets mangled into NODATA

Previously, if a PTR query is seen for a non-existing record, we'd
generate an empty response (but not NXDOMAIN or so). Fix that. If we
have no data about an IP address, then let's say so, so that the
original error is returned, instead of anything synthesized.

Fixes: #6543

7 years agoresolved: when there is no gateway, make sure _gateway results in NXDOMAIN
Lennart Poettering [Fri, 29 Sep 2017 16:01:04 +0000 (18:01 +0200)]
resolved: when there is no gateway, make sure _gateway results in NXDOMAIN

Let's ensure that "no gateway" translates to "no domain", instead of an
empty reply. This is in line with what nss-myhostname does in the same
case, hence let's unify behaviour here of nss-myhostname and resolved.

7 years agosd-bus: drop bloom fields
Lennart Poettering [Fri, 29 Sep 2017 15:58:11 +0000 (17:58 +0200)]
sd-bus: drop bloom fields

These fields are unused since kdbus support has been removed.

7 years agosd-bus: drop match cookie concept
Lennart Poettering [Fri, 29 Sep 2017 15:57:34 +0000 (17:57 +0200)]
sd-bus: drop match cookie concept

THe match cookie was used by kdbus to identify matches we install
uniquely. But given that kdbus is gone, the cookie serves no process
anymore, let's kill it.

7 years agosd-bus: when showing brief message info show error name in debug out put too
Lennart Poettering [Fri, 29 Sep 2017 15:48:29 +0000 (17:48 +0200)]
sd-bus: when showing brief message info show error name in debug out put too

When debug logging is enabled we show brief information about every bus
message we send or receieve. Pretty much all information is shown,
except for the error name if a message is an error (interestingly we do
print the error text however). Fix that, and add the error name as well.

7 years agoMerge pull request #6942 from keszybz/remove-sys
Lennart Poettering [Fri, 29 Sep 2017 13:48:23 +0000 (15:48 +0200)]
Merge pull request #6942 from keszybz/remove-sys

Remove sys if necessary

7 years agomount-util: add fusectl to list of API VFS
Lennart Poettering [Fri, 29 Sep 2017 12:36:06 +0000 (14:36 +0200)]
mount-util: add fusectl to list of API VFS

7 years agodissect: split list of discard-supporting fs out into mount-util.c
Lennart Poettering [Fri, 29 Sep 2017 12:23:17 +0000 (14:23 +0200)]
dissect: split list of discard-supporting fs out into mount-util.c

Let's manage the list of file systems that do a specific thing at one
place, following similar naming.

No functional changes.

7 years agodissect: automatically mark partitions read-only that have a read-only file system
Lennart Poettering [Fri, 29 Sep 2017 12:19:22 +0000 (14:19 +0200)]
dissect: automatically mark partitions read-only that have a read-only file system

Specifically, squashfs and iso9660 are always read-only, hence make sure
we never even think about mounting them writable.

7 years agosys-script: remove output directory if it exists
Zbigniew Jędrzejewski-Szmek [Fri, 29 Sep 2017 10:28:25 +0000 (12:28 +0200)]
sys-script: remove output directory if it exists

meson will occasionally call us even though the output directory
exists. Let's just nuke and recreate in that case.

7 years agocreate-sys-script: adapt to separate build dir, modernize, add more checks
Zbigniew Jędrzejewski-Szmek [Fri, 29 Sep 2017 10:27:21 +0000 (12:27 +0200)]
create-sys-script: adapt to separate build dir, modernize, add more checks

The script wasn't apparently used since the switch to meson, because
it required the sys subdirectory to be present in the same subdirectory
where the output script is located.

Let's use f-strings to make the whole thing more readable. Add some
extra checks.

7 years agoman: move non-target units together (#6934)
John Lin [Thu, 28 Sep 2017 17:56:50 +0000 (01:56 +0800)]
man: move non-target units together (#6934)

7 years agomeson: move library version defines to the top (#6939)
Zbigniew Jędrzejewski-Szmek [Thu, 28 Sep 2017 17:24:16 +0000 (19:24 +0200)]
meson: move library version defines to the top (#6939)

7 years agoMerge pull request #6936 from poettering/news-235
Lennart Poettering [Thu, 28 Sep 2017 17:22:55 +0000 (19:22 +0200)]
Merge pull request #6936 from poettering/news-235

News 235

7 years agoMerge pull request #6933 from yuwata/use_in_set
Lennart Poettering [Thu, 28 Sep 2017 17:22:09 +0000 (19:22 +0200)]
Merge pull request #6933 from yuwata/use_in_set

use IN_SET macro

7 years agomeson: bump release to 235
Lennart Poettering [Thu, 28 Sep 2017 09:29:52 +0000 (11:29 +0200)]
meson: bump release to 235

7 years agoadd some more things to TODO
Lennart Poettering [Thu, 28 Sep 2017 09:26:11 +0000 (11:26 +0200)]
add some more things to TODO

7 years agoprepare NEWS for 235
Lennart Poettering [Thu, 28 Sep 2017 09:26:02 +0000 (11:26 +0200)]
prepare NEWS for 235

7 years agolibsystemd: use IN_SET macro
Yu Watanabe [Thu, 28 Sep 2017 08:17:04 +0000 (17:17 +0900)]
libsystemd: use IN_SET macro

7 years agoMerge pull request #6924 from andir/vrf-dhcpv4
Lennart Poettering [Thu, 28 Sep 2017 07:46:03 +0000 (09:46 +0200)]
Merge pull request #6924 from andir/vrf-dhcpv4

networkd: use VRFs routing table for DHCP routes

7 years agoudev-rules: all values can contain escaped double quotes now (#6890)
Franck Bui [Thu, 28 Sep 2017 06:53:46 +0000 (08:53 +0200)]
udev-rules: all values can contain escaped double quotes now (#6890)

This is primarly useful to support escaped double quotes in PROGRAM or
IMPORT{program} directives.

The only possibilty before this patch was to use an external shell script but
this seems too cumbersome for trivial logics such as

 PROGRAM=="/bin/sh -c 'FOO=\"%s{model}\"; echo ${FOO:0:4}'"

or any similar shell constructs that needs to deals with patterns including
whitespaces.

As it's the case for single quote and for directives running a program, words
within escaped double quotes will be considered as a single argument.

Fixes: #6835

7 years agoMerge pull request #6928 from poettering/cgroup-empty-race
Zbigniew Jędrzejewski-Szmek [Thu, 28 Sep 2017 06:48:21 +0000 (08:48 +0200)]
Merge pull request #6928 from poettering/cgroup-empty-race

rework cgroup empty notification handling (i.e. a fix for #6608)

7 years agonetworkd: use assert_not_reached()
Yu Watanabe [Thu, 28 Sep 2017 06:38:50 +0000 (15:38 +0900)]
networkd: use assert_not_reached()

7 years agonetworkd: use IN_SET macro
Yu Watanabe [Thu, 28 Sep 2017 06:37:38 +0000 (15:37 +0900)]
networkd: use IN_SET macro

7 years agoman/systemd.network: Updated documentation about VRF traffic redirection
Andreas Rammhold [Tue, 26 Sep 2017 23:54:20 +0000 (01:54 +0200)]
man/systemd.network: Updated documentation about VRF traffic redirection

Starting with kernel version 4.8 the kernel has a single `l3mdev` rule
that handles this. This rule will be created when the first VRF device
is added.

7 years agoman/systemd.network: Added documentation about the DHCP.RouteTable behaviour with...
Andreas Rammhold [Tue, 26 Sep 2017 23:52:07 +0000 (01:52 +0200)]
man/systemd.network: Added documentation about the DHCP.RouteTable behaviour with VRFs

7 years agonetworkd: use VRFs routing table for DHCP routes
Andreas Rammhold [Thu, 7 Sep 2017 09:08:39 +0000 (11:08 +0200)]
networkd: use VRFs routing table for DHCP routes

When an interface has been enslaved to a VRF the received routes should
be added to the VRFs RT instead of the main table.

This change modifies the default behaviour of routes in the case where a
network belongs to an VRF.  When the user does not configure a
`DHCP.RouteTable` in a `systemd.network` file and the interface belongs
to a VRF, the VRFs routing table is used instead of RT_TABLE_MAIN.

When the user has configured a custom routing table for DHCP the VRFs
table is ignored and the users preference takes precedence.

7 years agoMerge pull request #6922 from poettering/symlink-sockets
Zbigniew Jędrzejewski-Szmek [Wed, 27 Sep 2017 17:37:25 +0000 (19:37 +0200)]
Merge pull request #6922 from poettering/symlink-sockets

Fixes for Symlinks= handling in socket units

7 years agocore: log unit failure with type-specific result code
Lennart Poettering [Tue, 26 Sep 2017 21:35:58 +0000 (23:35 +0200)]
core: log unit failure with type-specific result code

This slightly changes how we log about failures. Previously,
service_enter_dead() would log that a service unit failed along with its
result code, and unit_notify() would do this again but without the
result code. For other unit types only the latter would take effect.

This cleans this up: we keep the message in unit_notify() only for debug
purposes, and add type-specific log lines to all our unit types that can
fail, and always place them before unit_notify() is invoked.

Or in other words: the duplicate log message for service units is
removed, and all other unit types get a more useful line with the
precise result code.

7 years agocore: free_and_strdup() FTW!
Lennart Poettering [Tue, 26 Sep 2017 20:49:23 +0000 (22:49 +0200)]
core: free_and_strdup() FTW!

7 years agocgroup: IN_SET() FTW!
Lennart Poettering [Tue, 26 Sep 2017 20:49:09 +0000 (22:49 +0200)]
cgroup: IN_SET() FTW!