Commit graph

28191 commits

Author SHA1 Message Date
Lennart Poettering a30e35f85a journald: let's use unlink_and_free() where we can 2020-01-31 15:00:41 +01:00
Lennart Poettering 2066f4fe30 journald: specifying _pure_ on static functions is unnecessary, compiler can figure that out on its own 2020-01-31 15:00:37 +01:00
Lennart Poettering a2735a4549 journald: don't bother with seqnum file if we don't read form /dev/kmsg anyway 2020-01-31 15:00:33 +01:00
Lennart Poettering dbac262578 journald: fix indentation 2020-01-31 15:00:29 +01:00
Lennart Poettering 99d0d05a10 journald: use free_and_replace() where appropriate 2020-01-31 15:00:25 +01:00
Lennart Poettering 659a77bec6 journald: add missing logging for some errors 2020-01-31 15:00:21 +01:00
Lennart Poettering d83f7e4c92 journald: why bitwise XOR when boolean != is easier to read? 2020-01-31 14:59:41 +01:00
Yu Watanabe efda8aebcb sd-boot: fix -Wpointer-sign warning 2020-01-31 19:59:34 +09:00
Yu Watanabe a614aa1985 sd-boot: fix warning about comparison is always true 2020-01-31 19:20:34 +09:00
Yu Watanabe 3ae01632f2 dhcp6: coding style fixes 2020-01-31 14:44:40 +09:00
Yu Watanabe 9de8a4259e dhcp6: do not use T1 and T2 longer than one provided by the lease
Fixes #12623.
2020-01-31 14:44:32 +09:00
Anita Zhang 1b9d61bcee
Merge pull request #14696 from poettering/dissect-tweaks
various tweaks to the image dissection logic
2020-01-30 12:46:03 -08:00
Zbigniew Jędrzejewski-Szmek 2a4be3c52b Various typo fixes and grammar corrections 2020-01-30 13:48:01 +01:00
Zbigniew Jędrzejewski-Szmek 402058dc3a polkit: tweak grammar 2020-01-30 12:34:05 +01:00
Zbigniew Jędrzejewski-Szmek 4119d1e60a
Merge pull request #14096 from poettering/homed
systemd-homed
2020-01-30 12:32:06 +01:00
Zbigniew Jędrzejewski-Szmek f3b136a484 shared/sysctl-util: normalize repeated slashes or dots to a single value
We use those strings as hash keys. While writing "a...b" looks strange,
"a///b" does not look so strange. Both syntaxes would actually result in the
value being correctly written to the file, but they would confuse our
de-deplication over keys. So let's normalize. Output also becomes nicer.

Add test.
2020-01-30 10:48:27 +01:00
Lennart Poettering 8d251485fa core: fsck images specified as RootImage= too before using them 2020-01-29 19:29:59 +01:00
Lennart Poettering 4fcb96ce25 nspawn: fsck all images when mounting things
Also, start logging about mount errors, things are hard to debug
otherwise.
2020-01-29 19:29:55 +01:00
Lennart Poettering e475f72977 dissect: add --fsck= option to systemd-dissect tool
Let's expose this fsck behaviour directly.
2020-01-29 19:29:52 +01:00
Lennart Poettering cf32c48657 dissect: optionally, run fsck before mounting dissected images
Some file systems want us to run fsck before mounting, hence do so,
optionally.
2020-01-29 19:29:44 +01:00
Lennart Poettering 0f7c9a3d81 dissect: complain if partition flags are set that we don't know 2020-01-29 19:29:39 +01:00
Yu Watanabe a44956c94a network: fix implicit type conversion warning by GCC-10
Fixes part of #14691.
2020-01-29 19:24:12 +01:00
Topi Miettinen e21d90606a pam_systemd: resolve the tty of display via /sys instead of /dev
Rely on information provided by /proc/*/stat and /sys/dev/char for resolving
the controlling tty for the display server, instead of trying to access the
tty device in /dev (which may not be accessible for example due to
PrivateDevices=yes).
2020-01-29 16:06:48 +01:00
Lennart Poettering 72d43d09cc id128: change table header from "uuid" to just "id"
The tool deals with any kind of 128bit id, not just uuid, and by default
we display just a series of hex chars, hence let's not claim everything
was a "uuid", but just generically say "id"
2020-01-29 15:32:26 +01:00
Lennart Poettering bcb1eadc0c test: fix rename_noreplace() test
This corrects the fix b81b9d406d, making the test operate like it was
originally.
2020-01-28 22:53:59 +01:00
Lennart Poettering 3c7b4ebf94 test: make sure chase_symlink() returns normalized paths 2020-01-28 22:53:59 +01:00
Lennart Poettering 47d7ab727c fs-util: make sure we output normalized paths in chase_symlinks()
Let's eat up multiple slashes.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1787089
Replaces: #14687
2020-01-28 22:53:59 +01:00
Lennart Poettering 6efb1257d1 test: add test for the non-resolving of chase_symlink() root prefix 2020-01-28 22:53:59 +01:00
Lennart Poettering c2595d3b02 fs-util: when calling chase_symlinks() with root path, leave root part unresolved
Previously there was a weird asymmetry: initially we'd resolve the
specified prefix path when chasing symlinks together with the actual
path we were supposed to cover, except when we hit an absolute symlink
where we'd use the root as it was. Let's unify handling here: the prefix
path is never resolved, and always left as it is.

This in particular fixes issues with symlinks in the prefix path, as
that confused the check that made sure we never left the root directory.

Fixes: #14634
Replaces: #14635
2020-01-28 22:53:59 +01:00
Lennart Poettering ba0fb5acd4 sleep: automatically lock all home directories when suspending 2020-01-28 22:36:56 +01:00
Lennart Poettering 26cf9fb7f8 home: add pam_systemd_home.so PAM hookup
In a way fixes: https://bugs.freedesktop.org/show_bug.cgi?id=67474
2020-01-28 22:36:41 +01:00
Lennart Poettering 4aa0a8ac3e home: add homectl client tool 2020-01-28 22:36:30 +01:00
Lennart Poettering 70a5db5822 home: add new systemd-homed service that can manage LUKS homes
Fixes more or less: https://bugs.freedesktop.org/show_bug.cgi?id=67474
2020-01-28 22:36:07 +01:00
Franck Bui 1ffadeaae3 udev: assume that the recv buffer size of the netlink socket is already configured when the socket is passed in
This makes ReceiveBuffer= option in systemd-udevd-kernel.socket unit useful.
2020-01-28 22:35:08 +01:00
Lennart Poettering b940fb1f4f
Merge pull request #14594 from keszybz/id128-show-gpt
Print gpt table values in systemd-id128
2020-01-28 17:23:50 +01:00
Zbigniew Jędrzejewski-Szmek ebe2ab60cc
Merge pull request #14611 from yuwata/network-fix-reconfigure
network: fix reconfigure
2020-01-28 16:10:28 +01:00
Zbigniew Jędrzejewski-Szmek d2b45da40a
Merge pull request #14633 from poettering/logind-switch-polkit
add polkit hookup for VT switching in logind
2020-01-28 16:09:09 +01:00
Lennart Poettering 8615bec7a0
Merge pull request #14667 from yuwata/boot-random-seed-mode
boot: parse random-seed-mode
2020-01-28 15:42:10 +01:00
Lennart Poettering 4523f1db0f
Merge pull request #14675 from yuwata/network-dhcp-accept-nul
network: accept NUL character in SendOption=
2020-01-28 15:18:16 +01:00
Lennart Poettering 766840af42
Merge pull request #14673 from keur/protect_clock
Protect clock
2020-01-28 15:11:41 +01:00
sangelovic 58abbbcc6b sd-bus: fix introspection bug in signal parameter names 2020-01-28 11:20:33 +01:00
Yu Watanabe 732e3a6104 network: accept NUL character in SendOption=
Closes #14609.
2020-01-27 19:58:10 +09:00
Yu Watanabe a6a36dea2d test: add tests for UNESCAPE_ACCEPT_NUL 2020-01-27 19:58:06 +09:00
Yu Watanabe 0e72e469f8 escape: introduce UNESCAPE_ACCEPT_NUL flag 2020-01-27 18:04:46 +09:00
Yu Watanabe 46dc83440f escape: make cunescape() and cunescape_length() inline 2020-01-27 17:38:41 +09:00
Susant Sahani 8bdda551da efi: fix build.
```
ninja -C build
ninja: Entering directory `build'
[29/101] Generating systemd_boot.so with a custom command.
FAILED: src/boot/efi/systemd_boot.so
/usr/bin/ld -o src/boot/efi/systemd_boot.so -T /usr/lib64/gnuefi/elf_x64_efi.lds -shared -Bsymbolic -nostdlib -znocombreloc -L /usr/lib64 /usr/lib64/gnuefi/crt0-efi-x64.o src/boot/efi/disk.c.o src/boot/efi/graphics.c.o src/boot/efi/measure.c.o src/boot/efi/pe.c.o src/boot/efi/util.c.o src/boot/efi/boot.c.o src/boot/efi/console.c.o src/boot/efi/crc32.c.o src/boot/efi/random-seed.c.o src/boot/efi/sha256.c.o src/boot/efi/shim.c.o -lefi -lgnuefi /usr/lib/gcc/x86_64-redhat-linux/10/libgcc.a
/usr/bin/ld: src/boot/efi/graphics.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/pe.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/util.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/boot.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/console.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/random-seed.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/shim.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
[31/101] Generating stub.c.o with a custom command.
ninja: build stopped: subcommand failed.
make: *** [Makefile:2: all] Error 1

```
2020-01-27 16:13:28 +09:00
Kevin Kuehler 9f37272a19 analyze: Add ProtectClock= to analyze-security 2020-01-26 12:44:47 -08:00
Kevin Kuehler fc64760dda core: shared: Add ProtectClock= to systemd.exec 2020-01-26 12:23:33 -08:00
Yu Watanabe fe5a698f76 bootspec: parse random-seed-mode line in loader.conf
Fixes #14657.
2020-01-26 13:20:34 +09:00
Yu Watanabe a14c18ba7b sd-boot: fix typo
Fixes #14657.
2020-01-26 13:20:21 +09:00
Zbigniew Jędrzejewski-Szmek 2b4a65b668 sd-bus: export sd_bus_message_dump
Fixes #14640.
2020-01-23 23:38:20 +01:00
Zbigniew Jędrzejewski-Szmek 27cf4c18c7 sd-bus: make dump flags public 2020-01-23 23:38:20 +01:00
Zbigniew Jędrzejewski-Szmek dc972b0740 systemd-id128: add new verb to print GPT partitions UUIDs 2020-01-23 23:32:13 +01:00
Zbigniew Jędrzejewski-Szmek 19ce38ce62 shared/gpt: export gpt_partition_type_uuid_{to,from}_string functions 2020-01-23 22:56:23 +01:00
Zbigniew Jędrzejewski-Szmek 5e176a4dee Merge pull request #14368 from poettering/repart 2020-01-23 19:07:02 +01:00
Anita Zhang 72528419e1
Merge pull request #14618 from poettering/growfs-rootfs
generator: order growfs for the root fs after systemd-remount-fs
2020-01-22 05:32:18 -08:00
Anita Zhang fe888c79f5
Merge pull request #14614 from poettering/import-fixlets
three small importd fixes
2020-01-22 03:48:31 -08:00
Lennart Poettering 4acf0cfd2f logind: check PolicyKit before allowing VT switch
Let's lock this down a bit. Effectively nothing much changes, since the
default PK policy will allow users on the VT to change VT. Only users
with no local VT session won't be able to switch VTs.
2020-01-22 12:34:31 +01:00
Lennart Poettering 269e4d2d6b shared: split out polkit stuff from bus-util.c → bus-polkit.c
It's enough, complex stuff to warrant its own source file.

No other changes, just splitting out.
2020-01-22 12:34:10 +01:00
Yu Watanabe 2c0d7ed393 network: do nothing if link is in pending or linger state on reconfiguring 2020-01-22 16:08:12 +09:00
Yu Watanabe 0ce0e3470e network: synchronously save state file when link is being reconfigured 2020-01-22 16:08:12 +09:00
Yu Watanabe 8ae7b8a1e1 network: set dirty flag when link is being reconfigured 2020-01-22 16:08:12 +09:00
Lennart Poettering dc084399fa loginctl: use /org/freedesktop/login1/session/auto when "lock-session" is called without argument
This way we'll use the "display" session automatically, and that makes
the call work when invoked from user@.service.

Fixes: #13614
2020-01-22 15:36:35 +09:00
Lennart Poettering 44b0d1fd59 core: add implicit ordering dep on blockdev@.target from all mount units
This way we shuld be able to order mounts properly against their backing
services in case complex storage is used (i.e. LUKS), even if the device
path used for mounting the devices is different from the expected device
node of the backing service.

Specifically, if we have a LUKS device /dev/mapper/foo that is mounted
by this name all is trivial as the relationship can be established a
priori easily. But if it is mounted via a /dev/disk/by-uuid/ symlink or
similar we only can relate the device node generated to the one mounted
at the moment the device is actually established. That's because the
UUID of the fs is stored inside the encrypted volume and thus not
knowable until the volume is set up. This patch tries to improve on this
situation: a implicit After=blockdev@.target dependency is generated for
all mounts, based on the data from /proc/self/mountinfo, which should be
the actual device node, with all symlinks resolved. This means that as
soon as the mount is established the ordering via blockdev@.target will
work, and that means during shutdown it is honoured, which is what we
are looking for.

Note that specifying /etc/fstab entries via UUID= for LUKS devices still
sucks and shouldn't be done, because it means we cannot know which LUKS
device to activate to make an fs appear, and that means unless the
volume is set up at boot anyway we can't really handle things
automatically when putting together transactions that need the mount.
2020-01-21 20:23:44 +01:00
Lennart Poettering e3e6f99689 core: downgrade swap → device dep to Requires=
This catches up with 9d06297e26 and adapts
the change made to swap units. We generally don't want to react
a-posteriori to swap devices disappearing, bad things will happen
anyway.
2020-01-21 20:23:40 +01:00
Lennart Poettering 61f9cf4e4c swap: generate automatic dependencies also for /proc/swaps devices
This catches up with the logic we do for mounts: we create deps based on
/proc/swaps now too, with the right flags set.
2020-01-21 20:23:37 +01:00
Lennart Poettering 5de0acf40d core: let's be defensive, /dev/nfs is also a special mount source, filter it out 2020-01-21 20:23:34 +01:00
Lennart Poettering 219f3cd941 core: drop _pure_ from static functions
For static functions the compiler should figure this out on its own.
2020-01-21 20:23:30 +01:00
Lennart Poettering a7e8855879 units: introduce blockdev@.target for properly ordering mounts/swaps against cryptsetup
Let's hook it into both cryptsetup-generator and gpt-auto-generator with
a shared implementation in generator.c

Fixes: #8472
2020-01-21 20:23:13 +01:00
Lennart Poettering 6bbd539e5e cryptsetup-generator: order after cryptsetup-pre.target unconditionally 2020-01-21 20:23:10 +01:00
Lennart Poettering 49685fb314 cryptsetup-generator: break overly long line 2020-01-21 20:23:06 +01:00
Lennart Poettering 33a4c98342 fstab-generator: line break a bit more systematically 2020-01-21 20:23:03 +01:00
Lennart Poettering fbbe240b21
Merge pull request #14605 from aerusso/pulls/x-systemd-wantedby-requiredby
Implemented x-systemd.{required,wanted}-by= options
2020-01-21 19:21:49 +01:00
Yu Watanabe 5029912157 network,udev: use uint64_t for bit rate
Fixes #14620.
2020-01-21 16:51:19 +01:00
Lennart Poettering ce96c9cb1a timesyncd: log louder when we refuse a server due to root distance
This is something people should know about, since it's caused by
misconfiguration.

Fixes: #13912
2020-01-21 15:20:17 +01:00
Lennart Poettering c680e4efa8
Merge pull request #14617 from poettering/no-strv-clear
strv: remove strv_clear() and some other minor fixes
2020-01-21 15:08:38 +01:00
Lennart Poettering e704a09409
Merge pull request #14622 from poettering/uid-ref-fixlets
trivial uid ref counting clean-ups
2020-01-21 15:08:02 +01:00
Lennart Poettering f1f20764f9 resolved: drop DNSSEC root key that is not valid anymore
I guess we can drop this now, the key is no longer valid until
2019-01-11, hence there's no point in still including it in our trust
anchor.
2020-01-21 15:06:53 +01:00
Antonio Russo be02c1cf42 Implemented x-systemd.{required,wanted}-by= options
Teaches systemd-fstab-generator these two unit options,
creating appropriate dependencies on the generated .mount
units.  When used, they override any other automatically
generated dependencies, such as local-fs.target, and are
NOT suppressed by noauto.  The new options are ignored for
/, in the same way that noauto is ignored.

Fixes: #14380
Signed-off-by: Antonio Russo <antonio.e.russo@gmail.com>
2020-01-21 06:54:34 -07:00
Lennart Poettering e0567bc8ad journal: don't use startswith() on something that is not a NUL-terminated string
Otherwise we might access memory coming after it that is not valid or
allocated.

Fixes: #14114
2020-01-21 14:32:15 +01:00
Yu Watanabe 680120bb20 virt: do not define vm_from_string() for non-x86 architecture
Fixes #14615.
2020-01-21 13:47:08 +01:00
Lennart Poettering b90cf10245 core: make a number of functions not used externally static 2020-01-21 11:51:45 +01:00
Lennart Poettering 96462ae998 core: show the UID we cannot parse 2020-01-21 11:51:26 +01:00
Lennart Poettering 898820edb5 json: lower maximum allowed recursion to 2K
Apparently 4K is too high still, let's halve it.

Fixes: #14396
2020-01-21 10:50:09 +01:00
Lennart Poettering 18e6e8635f generator: order growfs for the root fs after systemd-remount-fs
Fixes: #14603
2020-01-21 10:40:18 +01:00
Lennart Poettering d6bd2bb444 hwdb: fix error numbers passed to log_syntax() 2020-01-21 10:15:26 +01:00
Lennart Poettering 2aecc66887 hwdb: use strv_extend() where we can 2020-01-21 10:13:07 +01:00
Lennart Poettering 2e5180d38b strv: get rid of strv_clear()
Let's remove a function of questionnable utility.

strv_clear() frees the items of a string array, but not the array
itself. i.e. it half-drestructs a string array and makes it empty. This
is not too useful an operation since we almost never need to just do
that, we also want to free the whole thing. In fact, strv_clear() is
only used in one of our .c file, and there it appears like unnecessary
optimization, given that for each array with n elements it leaves the
number of free()s we need to at O(n) which is not really an optimization
at all (it goes from n+1 to n, that's all).

Prompted by the discussions on #14605
2020-01-21 10:07:34 +01:00
Lennart Poettering f85df81817 import: let's disable UNIX signal generation from curl 2020-01-20 22:09:38 +01:00
Lennart Poettering d076f9fd56 import: put a time-out on downloads
Let's abort downloads when they are stuck by setting a download speed
threshold (as suggested in the CURL docs)

Fixes: #14215
2020-01-20 22:07:02 +01:00
Lennart Poettering 137c6c6b36 import: don't complain if FS_NOCOW_FL is not available
Let's downgrade the log message to LOG_DEBUG if triggered by an fs that
doesn't support the flag.
2020-01-20 21:10:31 +01:00
Lennart Poettering e594a3b154 repart: add new systemd-repart tool
Fixes: #14052
2020-01-20 17:42:03 +01:00
Lennart Poettering b57ebc6004 conf-parser: add parser for 32bit signed integers 2020-01-20 17:42:03 +01:00
Lennart Poettering 7e70f2cb0e locale-util: add special glyph Σ 2020-01-20 17:42:03 +01:00
Lennart Poettering 1d2a1a0cb8 locale-util: add block drawing special glyphs 2020-01-20 17:42:03 +01:00
Lennart Poettering 137688dff4 format-table: add support for formatting uuids/id128 values 2020-01-20 17:42:03 +01:00
Lennart Poettering 1293a168f1 id128: move make_v4_uuid into id128-util.h to make it generally useful 2020-01-20 17:42:03 +01:00
Lennart Poettering 449d530700 makefs: simplify SPDX header 2020-01-20 17:42:03 +01:00
Lennart Poettering e56a8790a0 test: add test for https://github.com/systemd/systemd/issues/14560 2020-01-20 17:19:51 +01:00
Lennart Poettering 3b7f79dc9f core: make sure StandardInput=file: doesn't get dup'ed to stdout/stderr by default
Fixes: #14560
2020-01-20 17:19:42 +01:00
Daan De Meyer 5cbaf95ee3 wait-online: Support waiting for interfaces to disappear 2020-01-18 18:17:25 +01:00
Daan De Meyer 75cd4a5d92 wait-online: Add maximum operational state option 2020-01-18 18:17:22 +01:00
Sascha Dewald fc57f105d9 pkgconf: add full generator paths 2020-01-18 17:48:28 +01:00
Lennart Poettering 7e284b054e tree-wide: we forgot to destroy some bus errors 2020-01-18 17:47:20 +01:00
Zbigniew Jędrzejewski-Szmek 8a9125cbb3
Merge pull request #14596 from poettering/no-mask-perpetual
core: don't allow perpetual units to be masked
2020-01-18 10:17:10 +01:00
Wieland Hoffmann 287cf2d802 typo: "May modify to" -> "May modify" 2020-01-18 10:08:27 +01:00
Lennart Poettering 0879fbd6fe mount: make checks on perpetual mount units more lax
We don#t really care where perpetual mounts are mounted from, since they
have to exist since before we run anyway.
2020-01-17 15:09:18 +01:00
Lennart Poettering 88414eed6f core: never allow perpetual units to be masked
Fixes: #14550
2020-01-17 15:02:15 +01:00
Zbigniew Jędrzejewski-Szmek 4ca739e20a core: reduce indentation a bit 2020-01-17 08:13:09 +01:00
Zbigniew Jędrzejewski-Szmek b0a94df963 logind: use loop instead of repeated code
https://github.com/systemd/systemd/pull/14096#discussion_r350953689
2020-01-17 08:13:09 +01:00
Zbigniew Jędrzejewski-Szmek ddee3ada46 shared/user-record-nss: use macro to avoid repeats
It's easier to read when each field is intialized in exactly one place.
2020-01-17 08:13:09 +01:00
Zbigniew Jędrzejewski-Szmek 192aee3cae shared/user-record-nss: shorten code a bit
free_and_strdup() already does comparison internally.
2020-01-16 21:57:00 +01:00
Arian van Putten c7d26acce6 Disable reading SystemdOptions EFI Var when in SecureBoot mode
In SecureBoot mode this is probably not what you want. As your cmdline
is cryptographically signed like when using Type #2 EFI Unified Kernel
Images (https://systemd.io/BOOT_LOADER_SPECIFICATION/) The user's
intention is then that the cmdline should not be modified.  You want to
make sure that the system starts up as exactly specified in the signed
artifact.
2020-01-16 18:46:56 +01:00
Zbigniew Jędrzejewski-Szmek c16460cf78 shared/sysctl-util: add missing header
one_zero() is used later in the header...
2020-01-16 15:51:44 +01:00
Zbigniew Jędrzejewski-Szmek 32458cc968 sysctl: downgrade message when we have no permission
We need to run sysctl also in containers, because the network
subtree is namespaces and may legitimately be writable. But logging
all "errors" at notice level creates unwanted noise.

Also downgrade message about missing sysctls to log_info. This might also be
relatively common when configuration is targeted at different kernel
versions. With log_debug it'll still end up in the logs, but isn't really worth
of "notice" most of the time.

https://bugzilla.redhat.com/show_bug.cgi?id=1609806
2020-01-16 14:45:50 +01:00
Zbigniew Jędrzejewski-Szmek b2ae4d9eb8 sysctl: move hashmap allocation out of main function
This allocation is a low level detail, and it seems nicer to keep it
out of run().
2020-01-16 14:45:37 +01:00
Zbigniew Jędrzejewski-Szmek 251d3d20c3
Merge pull request #14581 from poettering/setcred-alternative-fix
alternative pam_setcred() fix
2020-01-16 09:53:26 +01:00
Lennart Poettering 4bb68f2fee core: on each iteration processing /proc/self/mountinfo merge all discovery flags for each path
This extends on d253a45e1c, and instead of
merging just a single flag from previous mount entries of
/proc/self/mountinfo for the same path we merge all three.

This shouldn't change behaviour, but I think make things more readable.

Previously we'd set MOUNT_PROC_IS_MOUNTED unconditionally, we still do.

Previously we'd inherit MOUNT_PROC_JUST_MOUNTED from a previous entry on
the same line, we still do.

MOUNT_PROC_JUST_CHANGED should generally stay set too. Why that? If we
have two mount entries on the same mount point we'd first process one
and then the other, and the almost certainly different mount parameters
of the two would mean we'd set MOUNT_PROC_JUST_CHANGED for the second.
And with this we'll definitely do that still.

This also adds a comment explaining the situation a bit, and why we get
into this situation.
2020-01-15 17:42:12 +01:00
Lennart Poettering 46d7c6afbf execute: allow pam_setcred() to fail, ignore errors
Fixes: #14567
Alternative-To: #14569
2020-01-15 17:10:43 +01:00
Lennart Poettering 5b8d1f6b77 execute: add const to array parameters, where possible 2020-01-15 17:10:28 +01:00
Lennart Poettering f9c1f4e193 pam-systemd: apply user record properties to session
This way any component providing us with JSON user record data can use
this for automatic resource management and other session properties.
2020-01-15 15:30:02 +01:00
Lennart Poettering 7bfbf6cc92 pam-systemd: normalize return values of append_session_xyz()
Let's propagate the PAM errors we got.
2020-01-15 15:29:59 +01:00
Lennart Poettering 9ab0d3ebe5 pam-systemd: port over to use a UserRecord structure
Later on this allows us to set various session properties from user
record.
2020-01-15 15:29:55 +01:00
Lennart Poettering 355c9966c2 pam-systemd: share bus connection with pam_systemd_home if we can
Let's use the pam-util.h provided helpers to acquire them.
2020-01-15 15:29:52 +01:00
Lennart Poettering d750dde2a6 pam-systemd: port to pam_bus_log_{create|parse}_error() and pam_log_oom() 2020-01-15 15:29:48 +01:00
Lennart Poettering cef9f2a647 shared: add pam utility helpers 2020-01-15 15:29:31 +01:00
Lennart Poettering d510589fd0 logind: honour per-user stopDelayUSec property 2020-01-15 15:29:27 +01:00
Lennart Poettering 156a363750 logind: honour killProcesses field of user record 2020-01-15 15:29:24 +01:00
Lennart Poettering e8e4b7a0b6 logind: enforce user record resource settings when user logs in 2020-01-15 15:29:21 +01:00
Lennart Poettering 22c902facc logind: port to UserRecord object
This changes the user tracking of logind to use the new-style UserRecord
object.

In a later commit this enables us to do per-user resource management.
2020-01-15 15:29:17 +01:00
Lennart Poettering 1684c56f40 nss: hook up nss-systemd with userdb varlink bits
This changes nss-systemd to use the new varlink user/group APIs for
looking up everything.

(This also changes the factory /etc/nsswitch.conf line to use for
hooking up nss-system to use glibc's [SUCCESS=merge] feature so that we
can properly merge group membership lists).

Fixes: #12492
2020-01-15 15:29:07 +01:00
Lennart Poettering 19d22d433d core: add user/group resolution varlink interface to PID 1 2020-01-15 15:28:55 +01:00
Lennart Poettering 4bad7eedae core: make return parameter of dynamic_user_lookup_name() optional 2020-01-15 15:28:52 +01:00
Lennart Poettering 1604937f83 userdbd: add userdbctl tool as client for userdbd 2020-01-15 15:28:42 +01:00
Lennart Poettering d093b62c94 userdbd: add new service that can merge userdb queries from multiple clients 2020-01-15 15:28:17 +01:00
Lennart Poettering 295c1a6e45 shared: add helpers for displaying new-style user/group records to users 2020-01-15 15:27:59 +01:00
Lennart Poettering ec8e4a0ef1 shared: add internal API for querying JSON user records via varlink
This new API can be used in place of NSS by our own internal code if
more than the classic UNIX records are needed.
2020-01-15 15:27:41 +01:00
Lennart Poettering 9b2d907877 shared: add helpers for converting NSS passwd/group structures to new JSON objects
These new calls may be used to convert classic UNIX/glibc NSS struct
passwd and struct group records into new-style JSON-based user/group
objects.
2020-01-15 15:27:23 +01:00
Lennart Poettering 71d0b9d422 shared: add generic user/group record structures and JSON parsers 2020-01-15 15:27:04 +01:00
Lennart Poettering 64aa2622a3 libcrypt-util: add superficial validator for UNIX hashed password strings 2020-01-15 15:26:51 +01:00
Lennart Poettering 42f3b2f975 shared: split out crypt() specific helpers into its own .c/.h in src/shared/
This way we can use libxcrypt specific functionality such as
crypt_gensalt() and thus take benefit of the newer algorithms libxcrypt
implements. (Also adds support for a new env var $SYSTEMD_CRYPT_PREFIX
which may be used to select the hash algorithm to use for libxcrypt.)

Also, let's move the weird crypt.h inclusion into libcrypt.h so that
there's a single place for it.
2020-01-15 15:26:27 +01:00
Lennart Poettering 2ee4b118fa nss-util: add macros for generating getpwent()/getgrent() prototypes
We have similar macros already for getpwuid()/getpwnam(), let's add more
of this.
2020-01-15 15:25:32 +01:00
Zbigniew Jędrzejewski-Szmek 98f44b97bb
Merge pull request #14562 from yuwata/table-strv
introduce TABLE_STRV and use it in networkctl and resolvectl
2020-01-15 13:59:11 +01:00
Lennart Poettering eea45a3399
Merge pull request #14424 from poettering/watch-bus-name-rework
pid1: simplify drastically how we watch bus names for service's BusName= setting
2020-01-15 11:46:11 +01:00
Yu Watanabe 222a6aace7
Merge pull request #14547 from keszybz/networkctl-matching
networkctl: return error or warning when interfaces are not matched
2020-01-15 11:56:01 +09:00
Yu Watanabe bbaba5748d test-format-table: add tests for TABLE_STRV 2020-01-15 11:52:40 +09:00
Yu Watanabe 29e15e98c7 resolvectl: use format-table.[ch] 2020-01-15 11:52:40 +09:00
Yu Watanabe 536cdd07b3 networkctl: use TABLE_STRV 2020-01-15 11:52:40 +09:00
Yu Watanabe 4618660d10 format-table: introduce TABLE_STRV 2020-01-15 11:52:40 +09:00
Yu Watanabe 8b75798d12 strv: introduce strv_compare() 2020-01-15 11:52:40 +09:00
Lennart Poettering c238a2f889 cgroup: minor comment improvement
As pointed out here:

https://github.com/systemd/systemd/pull/14564#discussion_r366305882
2020-01-14 16:57:51 +01:00
Lennart Poettering be2bb14f00 logind: refuse overriding idle hint on tty sessions
Previously we'd allow marking TTY sessions as idle, but when the user
tried to unmark it as idle again it we'd just revert to automatic TTY
atime idle detection, thus making it impossible to mark the session as
non-idle, unless its TTY is atime-touched all the time. But of course,
marking a session as idle is pretty much fatal if you never can mark it
as non-idle again.

This change is triggred by bug reports such as this:

https://github.com/systemd/systemd/issues/14053

With this patch we will now output a clean, clear error message if a
client tries to manipulate the idle state of a non-graphical session.
This means we now have clear rules: "manual" idle logic for graphical
sessions, and TTY based ones for all others that have a TTY of some
form.

I considered allowing the idle state to be overriden both ways for tty
sessions but that's problematic: for sessions that are temporarily
upgraded from tty to graphical and thus suddenly want to manage their
own idle state we'd need to a way to detect when the upgrade goes away
and thus we should revert to old behaviour. Without reverting to the
previous TTY idle auto-magic we'd otherwise be stuck in an eternally
idle or eternally non-idle state, with really bad effects in case
auto-suspend is used. Thus, let's instead generate a proper error
message, saying clearly we don't support it.

(Also includes some other fixes and clean-ups in related code)

Closes: #14053
2020-01-14 16:11:39 +01:00
Zbigniew Jędrzejewski-Szmek 952805a9e3
Merge pull request #14564 from poettering/cgroup-realize-fix
pid1: cgroup realization fix
2020-01-14 15:52:56 +01:00
Zbigniew Jędrzejewski-Szmek ea7fe1d1c2
Merge pull request #14390 from poettering/gpt-var-tmp
introduce GPT partition types for /var and /var/tmp and support them for auto-discovery
2020-01-14 15:37:53 +01:00
Frantisek Sumsal de9a8fe18e systemctl: use format-table.[ch] for tables 2020-01-14 15:26:21 +01:00
Zbigniew Jędrzejewski-Szmek 7c286cd6a6
Merge pull request #14505 from poettering/refuse-on-failure
refuse OnFailure= deps on units that have no failure state
2020-01-14 14:19:04 +01:00
Zbigniew Jędrzejewski-Szmek 191a3f1634 basic/strv: drop flags argument from strv_fnmatch() 2020-01-14 13:10:29 +01:00
Zbigniew Jędrzejewski-Szmek 0ef84b80c5 networkctl: return error or warning when interfaces are not matched
We'd just print nothing and exit with 0. If the user gave an explicit
name, we should fail. If a pattern didn't match, we should at least warn.

$ networkctl status enx54ee75cb1dc0a* --no-pager && echo $?
No interfaces matched.
0

$ networkctl status enx54ee75cb1dc0a --no-pager
Interface "enx54ee75cb1dc0a" not found.
1
2020-01-14 13:09:46 +01:00
Jun'ichi Nomura 1d086a6e59 mount: mark an existing "mounting" unit from /proc/self/mountinfo as "just_mounted"
When starting a mount unit, systemd invokes mount command and moves the
unit's internal state to "mounting".  Then it watches for updates of
/proc/self/mountinfo.  When the expected mount entry newly appears in
mountinfo, the unit internal state is changed to "mounting-done".
Finally, when systemd finds the mount command has finished, it checks
whether the unit internal state is "mounting-done" and changes the state
to "mounted".
If the state was not "mounting-done" in the last step though mount command
was successfully finished, the unit is marked as "failed" with following
log messages:
  Mount process finished, but there is no mount.
  Failed with result 'protocol'.

If daemon-reload is done in parallel with starting mount unit, it is
possible that things happen in following order and result in above failure.
  1. the mount unit state changes to "mounting"
  2. daemon-reload saves the unit state
  3. kernel completes the mount and /proc/self/mountinfo is updated
  4. daemon-reload restores the saved unit state, that is "mounting"
  5. systemd notices the mount command has finished but the unit state
     is still "mounting" though it should be "mounting-done"

mount_setup_existing_unit() should take into account that MOUNT_MOUNTING
is transitional state and set MOUNT_PROC_JUST_MOUNTED flag if the unit
comes from /proc/self/mountinfo so that mount_process_proc_self_mountinfo()
later can make state transition from "mounting" to "mounting-done".

Fixes: #10872
2020-01-14 12:15:09 +01:00
Lennart Poettering 48fd01e5f3 cgroup: drop redundant if check 2020-01-14 10:44:58 +01:00
Lennart Poettering e1e98911a8 cgroup: update only siblings that got realized once
Fixes: #14475
Replaces: #14554
2020-01-14 10:44:19 +01:00
Lennart Poettering 95ae4d1420 cgroup: drop unnecessary {} 2020-01-14 10:44:19 +01:00
Lennart Poettering a0d6590c4e cgroup: no need to cast dev_t to dev_t 2020-01-14 10:44:19 +01:00
Lennart Poettering 57f1030b13 cgroup: use log_warning_errno() where possible 2020-01-14 10:44:19 +01:00
Yu Watanabe ab1b472062
Merge pull request #14555 from poettering/table-multine
format-table: proper multi-line support
2020-01-14 06:48:57 +09:00
Lennart Poettering 0bdd282a4e killall: update reference to root storage daemon interface docs 2020-01-13 18:53:46 +01:00
Lennart Poettering 765d88698f
Merge pull request #14400 from keszybz/alias-check
Alias check rework
2020-01-13 18:03:13 +01:00
Lennart Poettering 04d8507f68
Merge pull request #14381 from keszybz/ifindex-cleanup
Resolve alternative names
2020-01-13 17:57:59 +01:00
Lennart Poettering 200427cf7c
Merge pull request #11199 from dargad/restore-pam-setcred
Restore call to pam_setcred
2020-01-13 17:44:34 +01:00
Lennart Poettering 0b9da3d9e8
Merge pull request #14293 from keur/systemctl_with_dependencies
systemctl: Add --with-dependencies switch
2020-01-13 17:42:55 +01:00
Timo Schlüßler 23b3921663 journalctl: Correctly handle combination of --reverse and --lines (fixes #1596) 2020-01-13 17:35:06 +01:00
Timo Schlüßler 3ac9cac7f7 journalctl: Correctly handle --show-cursor in combination with --until or --since and --reverse 2020-01-13 17:33:50 +01:00
Lennart Poettering 575a915a74
Merge pull request #14532 from poettering/namespace-dynamic-user-fix
Make DynamicUser=1 work in a userns container
2020-01-13 16:47:15 +01:00
Lennart Poettering fc6eb08e74 machinectl: modernize address table handling
Primarily, use the new multi-line support in table formatting.

Also, stream-line naming of the "max-addresses" options. We used three
names for the concept internall, let's just unify on the name we use for
this for external users, i.e. "max-addresses".
2020-01-13 16:38:40 +01:00
Lennart Poettering d91614e717 format-table: natively support multiline cells
This adds native support for multiline cells.
2020-01-13 16:38:28 +01:00
Lennart Poettering f6857fa601 string-util: add helper for extracting n'th line of a string 2020-01-13 16:37:42 +01:00
Lennart Poettering 8dd6491ef9 string-util: let's add helper for truncating string after a specified number of lines 2020-01-13 16:36:47 +01:00
Dariusz Gadomski c6cecb744b test: Add tests for gid list ops 2020-01-13 10:29:20 +01:00
Dariusz Gadomski afb11bf1b8 execute: Detect groups added by PAM and merge them with supplementary groups 2020-01-13 10:29:20 +01:00
Dariusz Gadomski 3bb39ea936 execute: Restore call to pam_setcred 2020-01-13 10:29:20 +01:00
Dariusz Gadomski 0c5d667932 user-util: Add helper functions for gid lists operations 2020-01-13 10:29:10 +01:00
Zbigniew Jędrzejewski-Szmek 117caf3765 networkctl: break long line 2020-01-12 11:24:35 +01:00
Zbigniew Jędrzejewski-Szmek 8571210a21 machinectl: reduce scope of iterator variables 2020-01-12 11:24:35 +01:00
Zbigniew Jędrzejewski-Szmek 957d9df388 resolvectl: minor optimizations to allocate less 2020-01-12 11:24:35 +01:00
Zbigniew Jędrzejewski-Szmek d308bb99d2 Resolve alternative ifnames wherever we would resolve an interface name
To keep the names manageable, "ifname_or_ifindex" is replaced by "interface".
2020-01-12 11:24:35 +01:00
Zbigniew Jędrzejewski-Szmek fc2ea97ad0 util-lib: add function to resolve "alternative" names
Calls to if_nametoindex() are expected to use resolve_ifname() instead.
2020-01-12 10:54:31 +01:00
Zbigniew Jędrzejewski-Szmek 5c3fa98db6 util-lib: move things that parse ifnames to shared/
In subsequent commits, calls to if_nametoindex() will be replaced by a wrapper
that falls back to alternative name resolution over netlink. netlink support
requires libsystemd (for sd-netlink), and we don't want to add any functions
that require netlink in basic/. So stuff that calls if_nametoindex() for user
supplied interface names, and everything that depends on that, needs to be
moved.
2020-01-11 12:07:28 +01:00
Zbigniew Jędrzejewski-Szmek 955bb7fac3 basic/socket-util: indent for clarity 2020-01-11 12:07:28 +01:00
Zbigniew Jędrzejewski-Szmek bad7cecc0a sd-netlink: do not require rtnl pointer to be passed 2020-01-11 12:07:28 +01:00
Zbigniew Jędrzejewski-Szmek 231d9de1e3 networkctl: define a helper for interface name resolution 2020-01-11 12:07:28 +01:00
Zbigniew Jędrzejewski-Szmek 9030b50a7b timedatectl: drop ifindex output parameter too 2020-01-11 12:07:28 +01:00
Zbigniew Jędrzejewski-Szmek 597da51bae tree-wide: make parse_ifindex simply return the index
We don't need a seperate output parameter that is of type int.  glibc() says
that the type is "unsigned", but the kernel thinks it's "int".  And the
"alternative names" interface also uses ints. So let's standarize on ints,
since it's clearly not realisitic to have interface numbers in the upper half
of unsigned int range.
2020-01-11 12:06:08 +01:00
rhn bcc0fe635d nspawn: Correct "container" to "host" MAC setting message 2020-01-11 12:21:18 +09:00
Lennart Poettering cd6cf81b3f
Merge pull request #14533 from poettering/swap-prio-fixes
Fix Priority= parsing in .swap units
2020-01-10 17:06:16 +01:00
Lennart Poettering a5292dfdf7
Merge pull request #14508 from poettering/namespace-ro-fix
core: be nicer to read-only images
2020-01-10 17:03:01 +01:00
Lennart Poettering 4504f59fbd
Merge pull request #14538 from yuwata/xyzctl-full
use table_set_width(table, 0) if --full is specified
2020-01-10 16:40:31 +01:00
Zbigniew Jędrzejewski-Szmek 1bf1558552 core,install: allow one more case of "instance propagation"
If we have a template unit template@.service, it should be allowed to specify a
dependency on a unit without an instance, bar@.service. When the unit is created,
the instance will be propagated into the target, so template@inst.service will
depend on bar@inst.service.

This commit changes unit_dependency_name_compatible(), which makes the manager
accept links like that, and unit_file_verify_alias(), so that the installation
function will agree to create a symlink like that, and finally the tests are
adjusted to pass.
2020-01-10 14:31:01 +01:00
Franck Bui 972f3176fa shared/install: drop an unused variable in config_parse_also() 2020-01-10 14:28:52 +01:00
Franck Bui 66a19d85a5 shared/install: try harder to find enablement symlinks when disabling a unit
It might be needed to follow symlinks more deeply when we're looking for
enablement symlinks pointing to the removed service.

Let's consider the case where service 'old' is being renamed 'new' (will happen
most likely during package upgrade). Before the service is going to be renamed,
there's the following enablement symlink:

 /etc/systemd/system/multi-user.target.wants/old.service -> /usr/lib/systemd/system/old.service

In order to rename 'old' into 'new' and transparently restart the service, the
old name is still provided as a 'static' alias for the new service. This should
also help keeping backward compatibilities since the old name might still be
embedded in unit files, scripts, generators and such.

Hence after the package is upgraded, the following symlinks including the
enablement symlink are present:

 /usr/lib/systemd/system/old.service -> new.service
 /etc/systemd/system/multi-user.target.wants/old.service -> /usr/lib/systemd/system/old.service

If later the user decides to disable the service, we should figure out that the
enablement symlink (which still has the old name) is actually referring to 'new'
(indirectly) even if it points to the alias.
2020-01-10 14:28:42 +01:00
Zbigniew Jędrzejewski-Szmek 3f57bc2267 shared/install: rework alias check and add test
This mostly reuses existing checkers used by pid1, so handling of aliases
should be consistent. Hopefully, with the test it'll be clearer what it
happening.

Support for .wants/.requires "aliases" is restored. Those are still used in the
wild quite a bit, so we need to support them.

See https://github.com/systemd/systemd/pull/13119 for a discussion of aliases
with an instance that point to a different template: this is allowed.
2020-01-10 14:27:04 +01:00
Franck Bui 29a743f993 core: explicit mention of unit ID is redundant with log_unit_*() 2020-01-10 14:20:28 +01:00
Zbigniew Jędrzejewski-Szmek 9a4f9e69e1 shared/unit-file: expose function to check .wants/.requires symlink validity
No functional change.
2020-01-10 12:20:18 +01:00
Yu Watanabe 12845a91b5 machinectl: do not truncate addresses when --full is specified 2020-01-10 19:19:15 +09:00
Yu Watanabe bd17fa8cd8 tree-wide: use table_log_add_error() 2020-01-10 18:28:30 +09:00
Yu Watanabe 964a7745de portablectl: optimize table creation 2020-01-10 18:28:23 +09:00
Yu Watanabe 679c7c7a67 machinectl: optimize table creation 2020-01-10 18:28:17 +09:00
Yu Watanabe 9c46b437fc analyze: optimize table creation by using table_add_many() 2020-01-10 18:28:09 +09:00
Yu Watanabe d8aedafb57 format-table: add table_log_add_error() 2020-01-10 18:23:20 +09:00
Anita Zhang 0e05be8405 initctl: (void)ify epoll_ctl()
CID 996298
2020-01-10 10:06:09 +01:00
Anita Zhang e127d90210
Merge pull request #14534 from poettering/cgroup-sibling-fix
core: fix re-realization of cgroup siblings
2020-01-09 23:57:39 -08:00
Kevin Kuehler e9c387c829 systemctl: Add --with-dependencies flag
Will print a unit and all of its dependencies. Works with cat, status,
list-units, and list-unit-files. This flag can also be used in conjunction
with --reverse, --before, and --after.

We also vastly simplify the list_dependencies_get_dependencies logic.
Instead of using 5 strvs and merging them into one, use one strv and
have the bus append all the map values to it.

Fixes #9273
2020-01-09 22:52:04 -08:00
Yu Watanabe 98d886be79
Merge pull request #13927 from ddstreet/ll_no
networkd: set addr_gen_mode and check for tentative ipv6ll before dro…
2020-01-10 15:44:44 +09:00
Yu Watanabe a65e34ccb0 machinectl: do not ellipsize table when --full is specified 2020-01-10 12:24:51 +09:00
Yu Watanabe b683b82fe7 busctl: introduce --full command line option 2020-01-10 12:19:47 +09:00
Yu Watanabe a42d949080 networkctl: set table width 0 when --full is specified 2020-01-10 12:12:00 +09:00
Yu Watanabe a362c069a9 systemd-mount: add --full command line option 2020-01-10 12:07:28 +09:00
Lennart Poettering bcf00b6c0a format-table: allow forcing arbitrary width tables
Useful for implementing systemctl's --full.

See #14470
2020-01-10 11:53:28 +09:00
Anita Zhang 79bb680cbf
Merge pull request #14527 from poettering/socket-state-fix
core: propagate service state to socket in more load states
2020-01-09 17:10:48 -08:00
Dan Streetman 4c64965257 network: drop foreign config after addr_gen_mode has been set
Interfaces may come up at any time, even during our initialization of
them, for various reasons; e.g. the kernel will raise VLAN when its
parent is raised; or we will raise an interface if configured with
BindCarrier and its associated interfaces come up.

When LinkLocalAddressing has been disabled for ipv6, we disable
addr_gen_mode in the kernel, so it will not automatically create a
ipv6ll address when the interface is raised.  However, we currently
drop all foreign addresses before disabling addr_gen_mode.

If the link has been up for a long time, then its kernel-created ipv6ll
address will be correctly dropped.  If the link is down, and stays
down until we raise it after finishing configuration, the addr_gen_mode
setting will be disabled when the interface is raised and the kernel
will not create any ipv6ll address.

However, if the interface is raised after dropping foreign config,
but before we have disabled addr_gen_mode, the kernel will create a
ipv6ll tentative address that will eventually finish DAD and become a
working ipv6ll address, even though we have been configured to disable
ipv6ll.

Moving our call to drop foreign addresses to after we have successfully
set addr_gen_mode closes this window; after we disable addr_gen_mode,
we can safely remove foreign ipv6ll addresses (including tentative ones)
and be sure that the kernel will not create any more.

Fixes: #13882.
2020-01-09 15:19:19 -05:00
Dan Streetman 0917a27178 network: if ipv6ll is disabled, enumerate tentative ipv6 addrs before dropping foreign addrs
The kernel will create an ipv6ll tentative address immediately when an
interface is raised if addr_gen_mode is not disabled; and, the kernel does
not notify netlink listeners about any tentative addresses.  So it's
possible for an interface to contain tentative ipv6 link-local address(es)
that networkd doesn't know about when all foreign addresses are dropped.

In this case, networkd is later notified about the new ipv6ll address(es)
after they finish DAD and are no longer tentative; but since that's after
networkd has already dropped foreign addresses, they are incorrectly left
on the interface.
2020-01-09 15:19:19 -05:00
Dan Streetman 9524014ee6 network: add link->setting_genmode flag
Similar to the link->setting_mtu flag, this delays continued configuration
until after the genmode has been successfully set; this is important
because we do not want networkd to raise the interface before the genmode
has been set, as if we're disabling the genmode, raising the interface
before we have successfully disabled the genmode will result in the kernel
creating a ipv6ll address, even though we don't want that.
2020-01-09 15:19:19 -05:00
Dan Streetman 3a390124b7 network: rename linux_configure_after_setting_mtu() to linux_configure_continue()
This is a simple rename to make the function name more generic;
the next commit expands its usage to more than only the mtu handler.
2020-01-09 15:19:08 -05:00
Lennart Poettering 65f6b6bdcb core: fix re-realization of cgroup siblings
This is a fix-up for eef85c4a3f which
broke this.

Tracked down by @w-simon

Fixes: #14453
2020-01-09 17:31:41 +01:00
Lennart Poettering 6fca66a7f1 core: set error value correctly 2020-01-09 17:08:40 +01:00
Lennart Poettering af4454cb17 core: use unit-based logging instead of generic logging where appropriate 2020-01-09 17:08:36 +01:00
Lennart Poettering eb34a981d6 core: initialize priority_set when parsing swap unit files
Fixes: #14524
2020-01-09 17:08:31 +01:00
Lennart Poettering 6afc31615e core: no need to initialize swap structure fields if all zeroes anyway 2020-01-09 17:08:27 +01:00
Lennart Poettering 6d9e0ca400 core: expose swap priority value via dbus only if it is set 2020-01-09 17:08:10 +01:00
Lennart Poettering 8ac7339648
Merge pull request #14525 from yuwata/mount-use-format-table
systemd-mount: use format-table.[ch]
2020-01-09 15:47:24 +01:00
Lennart Poettering 404308486a core: be more restrictive on the dependency types we allow to be created transiently
We should allow the ones that the [Unit] section of regular unit files
may accet, but no other, in particular not the internal deps we
synthesize as reverse of explicitly configured ones, such was WantedBy=.

Fixes: #14251
2020-01-09 15:42:34 +01:00
Yu Watanabe cf57766d79 timedatectl: use format-table.[ch] 2020-01-09 15:40:50 +01:00
Lennart Poettering 7cce68e1e0 core: make sure we use the correct mount flag when re-mounting bind mounts
When in a userns environment we cannot take away per-mount point flags
set on a mount point that was passed to us. Hence we need to be careful
to always check the actual mount flags in place and manipulate only
those flags of them that we actually want to change and not reset more
as side-effect.

We mostly got this right already in
bind_remount_recursive_with_mountinfo(), but didn't in the simpler
bind_remount_one_with_mountinfo(). Catch up.

(The old code assumed that the MountEntry.flags field contained the
right flag settings, but it actually doesn't for new mounts we just
established as for those mount() establishes the initial flags for us,
and we have to read them back to figure out which ones the kernel
picked.)

Fixes: #13622
2020-01-09 15:18:08 +01:00
Lennart Poettering 8403219fc1 mount-util: line break overly long function prototypes 2020-01-09 15:05:55 +01:00
Lennart Poettering 08b1f5c7d1 mount-util: clean up get_mount_flags()
This cleans up the function in multiple ways:

- change order of parameters to follow our usualy system of putting
  return parameters last
- rename return parameter "ret" as we usually do
- don't initialize local variables we override immediately anyway
- downgrade log messages to LOG_DEBUG (since we don't log about any
  other errors here above LOG_DEBUG, as this is mostly an "API"-style
  function)
- handle that mnt_fs_get_vfs_options() may return NULL (according to
  docs)
- manually map the ST_xyz to MS_xyz flags on statvfs(), because while
  they are mostly the same, they aren't entirely the same, MS_RELATIME and
  ST_RELATIME are defined differently (sad!)
2020-01-09 15:05:21 +01:00
Lennart Poettering 4eaf0d9401 mount-util: don't mask away MS_RDONLY twice
We have the flags mask for that, and if callers really wanted us to mask
this away, then they should pass the correct mask.
2020-01-09 14:55:15 +01:00
Lennart Poettering f3dab34d22 mount-util: rename cleaned → simplified, because that's what we actually did here 2020-01-09 14:53:36 +01:00
Yu Watanabe a5279634c0 systemd-mount: add --no-legend command line option 2020-01-09 20:16:03 +09:00
Yu Watanabe 6ae6ea55d8 systemd-mount: use format-table.[ch] 2020-01-09 20:16:03 +09:00
Yu Watanabe f93d876c80 format-table: introduce TABLE_PATH 2020-01-09 20:16:03 +09:00
Lennart Poettering 4c2ef32767 core: propagate service state to socket in more load states
It makes sense to filter state changes for some load states that
shouldn't happen, but the common cases should be accepted, because they
might happen during runtime when "systemctl daemon-reload" is issued and
unit files changed state in between. Otherwise we lose events.

Fixes: #4708
2020-01-09 11:53:26 +01:00
Lennart Poettering b0a94268f8 core: when we cannot open an image file for write, try read-only
Closes: #14442
2020-01-09 11:18:06 +01:00
Lennart Poettering c8c535d589 namespace: tweak checks whether we can mount image read-only
So far we set up a loopback file read-only iff ProtectSystem= and
ProtectHome= both where set to values that mark these dirs read-only.
Let's extend that and also be happy if /home and the root dir are marked
read-only by some other means.

Fixes: #14442
2020-01-09 11:18:02 +01:00
Lennart Poettering 9a2ec8f7a6 install: use path_strv_contains() where appropriate 2020-01-09 11:17:59 +01:00
Lennart Poettering 3593fa60f2 path-util: express PATH_IN_SET() through path_strv_contains() 2020-01-09 11:17:47 +01:00
Lennart Poettering 3841fee822 path-util: introduce path_strv_contains() helper
it's like strv_contains() but uses path_equal() rather than streq() to
compare strings.
2020-01-09 11:17:21 +01:00
Lennart Poettering c80a9a33d0 core: clearly refuse OnFailure= deps on units that can't fail
Similar, refuse triggering deps on units that cannot trigger.

And rework how we ignore After= dependencies on device units, to work
the same way.

See: #14142
2020-01-09 11:03:53 +01:00
Yu Watanabe 125c7814fa
Merge pull request #14523 from keszybz/refactorings
Refactorings inspired by recent pull requests
2020-01-09 12:50:11 +09:00
Zbigniew Jędrzejewski-Szmek b44d87e200 sd-event: use _cleanup_ in one more place 2020-01-08 17:15:54 +01:00
Zbigniew Jędrzejewski-Szmek 1eac79486e sd-event: use RAII for struct epoll_event
Inspired by #14353.
2020-01-08 17:15:46 +01:00
Zbigniew Jędrzejewski-Szmek 0475919b56 network: use automatic stack allocation and structured init 2020-01-08 17:15:19 +01:00