]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agoGet rid of in_addr_port_from_string_auto() again
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 15:12:06 +0000 (17:12 +0200)] 
Get rid of in_addr_port_from_string_auto() again

With the commit "shared/socket-netlink: only allow ifindex if explicitly supported"
this helper is not necessary anymore.

3 years agoshared: check interface name validity in in_addr_port_ifindex_name_from_string_auto()
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 13:38:46 +0000 (15:38 +0200)] 
shared: check interface name validity in in_addr_port_ifindex_name_from_string_auto()

We don't try to resolve invalid ifnames as all. A different return
code is used. This difference will be verified later in test_socket_address_parse()
when socket_address_parse() is converted to use
in_addr_port_ifindex_name_from_string_auto().

3 years agobasic: show interface scope in sockaddr_pretty()
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 13:20:31 +0000 (15:20 +0200)] 
basic: show interface scope in sockaddr_pretty()

If the interface scope is specified, this changes the meaning of the address
quite significantly. Let's show the IPv6 scope_id if present.

Sadly we don't even have a test for sockaddr_pretty() output :(
This will be implicitly tested through socket_address_parse() later on.

3 years agobasic: convert ifname_valid_full() to take flags and allow numeric interfaces
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 12:59:21 +0000 (14:59 +0200)] 
basic: convert ifname_valid_full() to take flags and allow numeric interfaces

3 years agoshared/socket-netlink: only allow ifindex if explicitly supported
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 08:05:12 +0000 (10:05 +0200)] 
shared/socket-netlink: only allow ifindex if explicitly supported

Instead of ignoring ifindex if not wanted, refuse it is the caller
does not allow it.

3 years agotest-socket-netlink: print the proper expected string
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 10:58:30 +0000 (12:58 +0200)] 
test-socket-netlink: print the proper expected string

We would use the return value from the tested function to decide
what to print as "expected", which is confusing when something is wrong
with the tested function.

3 years agotest-in-addr-util: add log headers
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 14:55:10 +0000 (16:55 +0200)] 
test-in-addr-util: add log headers

3 years agoresolved: unify the two functions to create main stubs
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 14:45:58 +0000 (16:45 +0200)] 
resolved: unify the two functions to create main stubs

There is a small functional difference: IP_TTL==1 is now also set for the UDP
socket. I assume that it wasn't set by mistake.

3 years agoresolved: unify the two functions to create extra stubs
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 14:14:54 +0000 (16:14 +0200)] 
resolved: unify the two functions to create extra stubs

There is a minor functional change:
IPV6_FREEBIND is set of IPv6 sockets, not IP_FREEBIND. This was missed in
af8b1384, but I noticed only after the merging the two functions.

And a not-so-minor functional chagnge:
7216a3b5dcde36245 changed manager_dns_stub_tcp_fd_extra() to return the fd even
if the source was already initialized, but it didn't do the same change for
manager_dns_stub_udp_fd_extra(), so it would return 0 in that case. But
0354029bf572489b uses manager_dns_stub_udp_fd_extra() when preparing to call
manager_send(), and will pass 0 as the fd in that case. For both socket types
fd is now always returned.

3 years agoresolve: move handler functions higher
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 14:29:44 +0000 (16:29 +0200)] 
resolve: move handler functions higher

No functional change, preparation for subsequent refactoring.

3 years agoman: document that sd_bus_message_close_container() may only be called at end of...
Lennart Poettering [Wed, 9 Sep 2020 16:56:24 +0000 (18:56 +0200)] 
man: document that sd_bus_message_close_container() may only be called at end of container

Prompted-by: https://lists.freedesktop.org/archives/systemd-devel/2020-September/045264.html
3 years agoMerge pull request #16985 from poettering/resolve-dns-stub-extra-fixlets
Zbigniew Jędrzejewski-Szmek [Wed, 9 Sep 2020 20:03:31 +0000 (22:03 +0200)] 
Merge pull request #16985 from poettering/resolve-dns-stub-extra-fixlets

resolved: dns stub listener extra fixes

3 years agoMerge pull request #16997 from poettering/foreach-word-followup
Zbigniew Jędrzejewski-Szmek [Wed, 9 Sep 2020 20:00:27 +0000 (22:00 +0200)] 
Merge pull request #16997 from poettering/foreach-word-followup

fix two coverity issues

3 years agocryptsetup: Fix null pointer dereference (#16987)
Mikael Szreder [Wed, 9 Sep 2020 19:26:21 +0000 (21:26 +0200)] 
cryptsetup: Fix null pointer dereference (#16987)

cryptsetup: Fix null pointer dereference

Fix null pointer dereference in the pkcs11 related code of systemd-cryptsetup

3 years agosd-login: fix memory leak 16997/head
Lennart Poettering [Wed, 9 Sep 2020 17:38:04 +0000 (19:38 +0200)] 
sd-login: fix memory leak

Fixes: CID1432652
3 years agosocket: fix copy/paste error
Lennart Poettering [Wed, 9 Sep 2020 17:37:38 +0000 (19:37 +0200)] 
socket: fix copy/paste error

Fixes: CID1432653
3 years agologind: fix merge issue
Lennart Poettering [Wed, 9 Sep 2020 17:17:31 +0000 (19:17 +0200)] 
logind: fix merge issue

The two PRs #16664 and #16635 individually passed CI, but when combined
cannot build. Since both are merged now, let's fix that.

3 years agologin: Add KEY_RESTART handling
Robert Marko [Fri, 14 Aug 2020 11:10:18 +0000 (13:10 +0200)] 
login: Add KEY_RESTART handling

KEY_RESTART is widely used in Linux to indicate device reboot.
So lets handle it in the same fashion as KEY_POWER.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
3 years agologind.conf: document UserStopDelaySec in logind.conf
Franck Bui [Wed, 9 Sep 2020 08:49:12 +0000 (10:49 +0200)] 
logind.conf: document UserStopDelaySec in logind.conf

3 years agoMerge pull request #16635 from keszybz/do-not-for-each-word
Lennart Poettering [Wed, 9 Sep 2020 15:43:38 +0000 (17:43 +0200)] 
Merge pull request #16635 from keszybz/do-not-for-each-word

Drop FOREACH_WORD

3 years agoMerge pull request #16972 from wusto/ambient-and-keep-caps-corrections
Lennart Poettering [Wed, 9 Sep 2020 15:09:42 +0000 (17:09 +0200)] 
Merge pull request #16972 from wusto/ambient-and-keep-caps-corrections

Ambient capabilities documenation and keep-caps usage corrections

3 years agoMerge pull request #16984 from yuwata/make-log_xxx_error-void
Lennart Poettering [Wed, 9 Sep 2020 14:28:51 +0000 (16:28 +0200)] 
Merge pull request #16984 from yuwata/make-log_xxx_error-void

Make log_xxx_error() or friends return void

3 years agoMerge pull request #16982 from yuwata/socket-buffer-size
Lennart Poettering [Wed, 9 Sep 2020 14:28:21 +0000 (16:28 +0200)] 
Merge pull request #16982 from yuwata/socket-buffer-size

Fixes for socket buffer size

3 years agocore: fix set keep caps for ambient capabilities 16972/head
Tobias Kaufmann [Fri, 31 Jul 2020 08:57:39 +0000 (10:57 +0200)] 
core: fix set keep caps for ambient capabilities

The securebit keep-caps retains the capabilities in the permitted set
over an UID change (ambient capabilities are cleared though).

Setting the keep-caps securebit after the uid change and before execve
doesn't make sense as it is cleared during execve and there is no
additional user ID change after this point.

Altough the documentation (man 7 capabilities) is ambigious, keep-caps
is reset during execve although keep-caps-locked is set. After execve
only keep-caps-locked is set and keep-caps is cleared.

3 years agocore: fix comments on ambient capabilities
Tobias Kaufmann [Fri, 31 Jul 2020 08:57:15 +0000 (10:57 +0200)] 
core: fix comments on ambient capabilities

The comments on the code for ambient capabilities was wrong/outdated.

3 years agoRename strv_split_extract() to strv_split_full() 16635/head
Zbigniew Jędrzejewski-Szmek [Mon, 3 Aug 2020 15:52:01 +0000 (17:52 +0200)] 
Rename strv_split_extract() to strv_split_full()

Now that _full() is gone, we can rename _extract() to have the usual suffix
we use for the more featureful version.

3 years agoRemove FOREACH_WORD and friends
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 13:04:26 +0000 (15:04 +0200)] 
Remove FOREACH_WORD and friends

3 years agotree-wide: replace strv_split_full() with strv_split_extract() everywhere
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 14:21:14 +0000 (16:21 +0200)] 
tree-wide: replace strv_split_full() with strv_split_extract() everywhere

Behaviour is not identical, as shown by the tests in test-strv.
The combination of EXTRACT_UNQUOTE without EXTRACT_RELAX only appears in
the test, so it doesn't seem particularly important. OTOH, the difference
in handling of squished parameters could make a difference. New behaviour
is what both bash and python do, so I think we can ignore this corner case.

This change has the following advantages:
- the duplication of code paths that do a very similar thing is removed
- extract_one_word() / strv_split_extract() return a proper error code.

3 years agotest-string-util: stop testing FOREACH_WORD
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 13:07:23 +0000 (15:07 +0200)] 
test-string-util: stop testing FOREACH_WORD

3 years agoshared/fstab-util: replace FOREACH_WORD_SEPARATOR() with open-coded loop
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 12:40:23 +0000 (14:40 +0200)] 
shared/fstab-util: replace FOREACH_WORD_SEPARATOR() with open-coded loop

The tricky part here is that the function is not allowed to fail in this code
path. Initially, I wanted to change the return value to allow it to fail, but
this cascades through all the places where fstab_test_option() and friends are
used; updating all those sites would be a lot of work. And since quoting is not
allowed here, a simple loop with strcspn() is easy to do.

3 years agoshared/fstab-util: use free_and_str[n]dup()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 12:27:14 +0000 (14:27 +0200)] 
shared/fstab-util: use free_and_str[n]dup()

No functional change. I'm keeping this separate to make review easier.

3 years agoUse extract_first_word() in generated conf parsers
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 10:07:49 +0000 (12:07 +0200)] 
Use extract_first_word() in generated conf parsers

3 years agonspawn: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:57:03 +0000 (11:57 +0200)] 
nspawn: use extract_first_word()

3 years agogetty-generator: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:47:03 +0000 (11:47 +0200)] 
getty-generator: use extract_first_word()

3 years agosd-journal: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:38:08 +0000 (11:38 +0200)] 
sd-journal: use extract_first_word()

3 years agodelta: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:28:11 +0000 (11:28 +0200)] 
delta: use extract_first_word()

3 years agocryptsetup: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:23:44 +0000 (11:23 +0200)] 
cryptsetup: use extract_first_word()

3 years agocore/load-fragment: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:19:25 +0000 (11:19 +0200)] 
core/load-fragment: use extract_first_word()

This is much nicer, and also fixes a potential overflow when we used
'word' in log_error() as if it was a NUL-terminated string.

3 years agoLet sd_machine_get_ifindices() omit the output param too
Zbigniew Jędrzejewski-Szmek [Thu, 30 Jul 2020 11:08:52 +0000 (13:08 +0200)] 
Let sd_machine_get_ifindices() omit the output param too

Nowadays we do that almost everywhere, let's also do it here.

3 years agoRewrite sd_machine_get_ifindices() to avoid FOREACH_WORD()
Zbigniew Jędrzejewski-Szmek [Thu, 30 Jul 2020 10:56:51 +0000 (12:56 +0200)] 
Rewrite sd_machine_get_ifindices() to avoid FOREACH_WORD()

If we fail to parse the index, the failure is propogated as -EUNCLEAN.
(-EINVAL would be confused with invalid args to the function itself.)

3 years agoFix output value of sd_seat_get_sessions() and drop FOREACH_WORD use
Zbigniew Jędrzejewski-Szmek [Thu, 30 Jul 2020 10:43:07 +0000 (12:43 +0200)] 
Fix output value of sd_seat_get_sessions() and drop FOREACH_WORD use

sd_seat_get_sessions() would return 0 in the 'n_uids' (now 'ret_n_uids') output
parameter when 'uid' (now 'ret_uids') was passed as NULL.

While at it, drop FOREACH_WORD() use.

Also use any whitespace as separator. In practice this shouldn't matter, since
logind always uses spaces, but it seems nicer to not specify this explicitly,
and the default is more flexible.

3 years agosd-device: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Wed, 29 Jul 2020 10:09:08 +0000 (12:09 +0200)] 
sd-device: use extract_first_word()

3 years agobasic/cgroup-util: port over to string_contains_word()
Zbigniew Jędrzejewski-Szmek [Wed, 29 Jul 2020 10:01:21 +0000 (12:01 +0200)] 
basic/cgroup-util: port over to string_contains_word()

3 years agologind: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Wed, 29 Jul 2020 09:47:38 +0000 (11:47 +0200)] 
logind: use extract_first_word()

3 years agoudev: warn if failed to set buffer size for device monitor 16982/head
Yu Watanabe [Tue, 8 Sep 2020 21:46:54 +0000 (06:46 +0900)] 
udev: warn if failed to set buffer size for device monitor

3 years agonetwork: increase receive buffer size for device monitor
Yu Watanabe [Tue, 8 Sep 2020 14:28:22 +0000 (23:28 +0900)] 
network: increase receive buffer size for device monitor

If networkd creates huge amount of netdevs, then the buffer of device
monitor becomes easily flowed.

Hopefully fixes #16865.

3 years agonetwork: do not start device monitor if /sys is read-only
Yu Watanabe [Tue, 8 Sep 2020 14:26:28 +0000 (23:26 +0900)] 
network: do not start device monitor if /sys is read-only

Follow-up for bf331d87171b7750d1c72ab0b140a240c0cf32c3.

3 years agonetwork: honor the buffer size specified in networkd.socket
Yu Watanabe [Tue, 8 Sep 2020 15:33:11 +0000 (00:33 +0900)] 
network: honor the buffer size specified in networkd.socket

3 years agocore/socket: use fd_set_{rcv,snd}buf()
Yu Watanabe [Tue, 8 Sep 2020 15:25:23 +0000 (00:25 +0900)] 
core/socket: use fd_set_{rcv,snd}buf()

3 years agosd-device-monitor: use fd_set_rcvbuf()
Yu Watanabe [Tue, 8 Sep 2020 15:22:21 +0000 (00:22 +0900)] 
sd-device-monitor: use fd_set_rcvbuf()

3 years agoutil: introduce fd_set_{snd,rcv}buf()
Yu Watanabe [Tue, 8 Sep 2020 16:12:38 +0000 (01:12 +0900)] 
util: introduce fd_set_{snd,rcv}buf()

3 years agoutil: try to set with SO_{RCV,SND}BUFFORCE when requested size is larger than the...
Yu Watanabe [Tue, 8 Sep 2020 15:11:14 +0000 (00:11 +0900)] 
util: try to set with SO_{RCV,SND}BUFFORCE when requested size is larger than the kernel limit

The commit 10ce2e0681ac16e7bb3619b7bb1a72a6f98a2f2c inverts the order of
SO_{RCV,SND}BUFFORCE and SO_{RCV,SND}BUF. However, setting buffer size with
SO_{RCV,SND}BUF does not fail even if the requested size is larger than
the kernel limit. Hence, SO_{RCV,SND}BUFFORCE will not use anymore and
the buffer size is always limited by the kernel limit even if we have
the priviledge to ignore the limit.

This makes the buffer size is checked after configuring it with
SO_{RCV,SND}BUF, and if it is still not sufficient, then try to set it
with FORCE command. With this commit, if we have enough priviledge, the
requested buffer size is correctly set.

Hopefully fixes #14417.

3 years agoutil: refuse to set too large value for socket buffer size
Yu Watanabe [Tue, 8 Sep 2020 15:07:50 +0000 (00:07 +0900)] 
util: refuse to set too large value for socket buffer size

3 years agonetwork: ignore error on increasing netlink receive buffer size
Yu Watanabe [Tue, 8 Sep 2020 17:48:25 +0000 (02:48 +0900)] 
network: ignore error on increasing netlink receive buffer size

3 years agoMerge pull request #16973 from poettering/btrfs-dev-root
Lennart Poettering [Tue, 8 Sep 2020 17:55:12 +0000 (19:55 +0200)] 
Merge pull request #16973 from poettering/btrfs-dev-root

print friendly error message if btrfs tells us /dev/root was backing block device of root fs

3 years agoMerge pull request #16979 from keszybz/return-log-debug
Lennart Poettering [Tue, 8 Sep 2020 17:54:38 +0000 (19:54 +0200)] 
Merge pull request #16979 from keszybz/return-log-debug

Fix 'return log_error()' and 'return log_warning()' patterns

3 years agocgroup: freezer action must be NOP when cgroup v2 freezer is not available
Michal Sekletár [Tue, 8 Sep 2020 12:51:39 +0000 (14:51 +0200)] 
cgroup: freezer action must be NOP when cgroup v2 freezer is not available

Low-level cgroup freezer state manipulation is invoked directly from the
job engine when we are about to execute the job in order to make sure
the unit is not frozen and job execution is not blocked because of
that.

Currently with cgroup v1 we would needlessly do a bunch of work in the
function and even falsely update the freezer state. Don't do any of this
and skip the function silently when v2 freezer is not available.

Following bug is fixed by this commit,

$ systemd-run --unit foo.service /bin/sleep infinity
$ systemctl restart foo.service
$ systemctl show -p FreezerState foo.service

Before (cgroup v1, i.e. full "legacy" mode):
FreezerState=thawing

After:
FreezerState=running

3 years agoresolved: don't store udp/tcp fd in DnsPacket object 16985/head
Lennart Poettering [Tue, 8 Sep 2020 17:41:44 +0000 (19:41 +0200)] 
resolved: don't store udp/tcp fd in DnsPacket object

DnsPacket should better be a "dead" object, i.e. list facts, not track
resources. By including an fd in its fields it started tracking
resources however, without actually taking a ref to the fd (i.e. no
dup() or so was called on it).

Let's hence rework things so that we don#t have to keep track of the fd
a packet came in from. Instead, pass around the DnsStubListenerExtra
object wherever we need to.

This should be useful as soon as we start caching whole DnsPacket
objects to allow replying to DNSSEC/CO packets, i.e. where we have to
keep a copy of the original DnsPacket around for a long time in cache,
potentially much longer than the fds the packet was received on.

3 years agoresolved: move dns stub definitions to resolved-dns-stub.[ch]
Lennart Poettering [Tue, 8 Sep 2020 17:13:29 +0000 (19:13 +0200)] 
resolved: move dns stub definitions to resolved-dns-stub.[ch]

Just some moving around, no logic changes.

3 years agoresolve: DNSStubListenerExtra → DnsStubListenerExtra
Lennart Poettering [Tue, 8 Sep 2020 17:00:47 +0000 (19:00 +0200)] 
resolve: DNSStubListenerExtra → DnsStubListenerExtra

All our other struct types use the "Dns" spelling, rather than "DNS". Do
the same for this struct.

3 years agonetwork: make log_link_error() or friends return void 16984/head
Yu Watanabe [Tue, 8 Sep 2020 17:33:03 +0000 (02:33 +0900)] 
network: make log_link_error() or friends return void

3 years agocore: make log_unit_error() or friends return void
Yu Watanabe [Tue, 8 Sep 2020 17:28:36 +0000 (02:28 +0900)] 
core: make log_unit_error() or friends return void

3 years agocore/slice: explicitly specify return value
Yu Watanabe [Tue, 8 Sep 2020 17:27:56 +0000 (02:27 +0900)] 
core/slice: explicitly specify return value

3 years agoudev: do not discard const qualifier
Yu Watanabe [Tue, 8 Sep 2020 17:14:55 +0000 (02:14 +0900)] 
udev: do not discard const qualifier

3 years agosd-device: make log_device_error() or friends return void
Yu Watanabe [Tue, 8 Sep 2020 17:10:27 +0000 (02:10 +0900)] 
sd-device: make log_device_error() or friends return void

3 years agoudev: explicitly specify return value
Yu Watanabe [Tue, 8 Sep 2020 17:08:24 +0000 (02:08 +0900)] 
udev: explicitly specify return value

3 years agoudev: return negative errno for invalid EVDEV_ABS_XXX= property
Yu Watanabe [Tue, 8 Sep 2020 17:07:15 +0000 (02:07 +0900)] 
udev: return negative errno for invalid EVDEV_ABS_XXX= property

3 years agoudev: make log_rule_error() or friends return void
Yu Watanabe [Tue, 8 Sep 2020 16:46:06 +0000 (01:46 +0900)] 
udev: make log_rule_error() or friends return void

3 years agoMerge pull request #16955 from keszybz/test-execute-cleanup
Lennart Poettering [Tue, 8 Sep 2020 16:33:12 +0000 (18:33 +0200)] 
Merge pull request #16955 from keszybz/test-execute-cleanup

One patch for test-execute and assorted cleanups

3 years agotree-wide: if get_block_device() returns zero devno, check for it in all cases 16973/head
Lennart Poettering [Mon, 7 Sep 2020 17:01:41 +0000 (19:01 +0200)] 
tree-wide: if get_block_device() returns zero devno, check for it in all cases

And add a comment for the existing cases where things aren't clear
already.

3 years agobtrfs: if BTRFS_IOC_DEV_INFO returns /dev/root generate a friendly error message
Lennart Poettering [Mon, 7 Sep 2020 16:50:41 +0000 (18:50 +0200)] 
btrfs: if BTRFS_IOC_DEV_INFO returns /dev/root generate a friendly error message

On systems that boot without initrd on a btrfs root file systems the
BTRFS_IOC_DEV_INFO ioctl returns /dev/root as backing device. That
sucks, since that is not a real device visible to userspace.

Since this has been that way since forever, and it doesn't look like the
kernel will get fixed soon for this, let's at least generate a useful
error message in this case.

This is not a bug fix, just a tweak to make this more recognizable.

Once the kernel gets fixed to report the correct device nodes in this
case, in a way userspace can make sense of them things will magically
work for systemd, too.

(Note that this doesn't add a log message about this to really all cases
we call get_device() in, but just the main ones that are called in early
boot context, after all all there's no benefit in seeing this message
too many times.)

https://github.com/systemd/systemd/issues/16953
https://bugs.freedesktop.org/show_bug.cgi?id=84689
https://bugzilla.kernel.org/show_bug.cgi?id=89721

3 years agosleep: reword some debug messages 16979/head
Zbigniew Jędrzejewski-Szmek [Tue, 8 Sep 2020 11:19:53 +0000 (13:19 +0200)] 
sleep: reword some debug messages

I think the sentences sound more natural this way.

3 years agobasic/log: make log_{info,warning,...} return void
Zbigniew Jędrzejewski-Szmek [Tue, 8 Sep 2020 11:18:25 +0000 (13:18 +0200)] 
basic/log: make log_{info,warning,...} return void

log_debug still returns 0. I think it is legitimate to use 'return log_debug()' to
return 0. It is different than the other functions, since we often want to supress
errors logged at debug level. This case is quite common in the codebase and
we could use 'return log_debug_errno()' to make the code more consise.

For all other variants, a separate return line is required.
Previous commit changes all the non-conforming instances, now we can make it mandatory.

3 years agotree-wide: correct cases where return log_{error,warning} is used without value
Zbigniew Jędrzejewski-Szmek [Tue, 8 Sep 2020 10:51:23 +0000 (12:51 +0200)] 
tree-wide: correct cases where return log_{error,warning} is used without value

In various cases, we would say 'return log_warning()' or 'return log_error()'. Those
functions return 0 if no error is passed in. For log_warning or log_error this doesn't
make sense, and we generally want to propagate the error. In the few cases where
the error should be ignored, I think it's better to split it in two, and call 'return 0'
on a separate line.

3 years agoman: fix quickhelp listing in sysusers.d(5)
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 20:09:02 +0000 (22:09 +0200)] 
man: fix quickhelp listing in sysusers.d(5)

Fixes #16958.

3 years agoMerge pull request #16978 from keszybz/two-variable-reduction-patches
Lennart Poettering [Tue, 8 Sep 2020 15:13:21 +0000 (17:13 +0200)] 
Merge pull request #16978 from keszybz/two-variable-reduction-patches

Two variable reduction patches

3 years agoMerge pull request #16618 from yuwata/network-ipv6token-prefixstable
Zbigniew Jędrzejewski-Szmek [Tue, 8 Sep 2020 11:36:27 +0000 (13:36 +0200)] 
Merge pull request #16618 from yuwata/network-ipv6token-prefixstable

network: make prefixstable mode of IPv6Token= can be applied any received prefixes

3 years agotree-wide: define iterator inside of the macro 16978/head
Zbigniew Jędrzejewski-Szmek [Tue, 8 Sep 2020 09:58:29 +0000 (11:58 +0200)] 
tree-wide: define iterator inside of the macro

3 years agocore/unit: reduce scope of variables
Zbigniew Jędrzejewski-Szmek [Tue, 1 Sep 2020 17:09:24 +0000 (19:09 +0200)] 
core/unit: reduce scope of variables

3 years agoMerge pull request #16725 from yuwata/network-fix-ndisc-multiple-routers
Zbigniew Jędrzejewski-Szmek [Tue, 8 Sep 2020 06:16:33 +0000 (08:16 +0200)] 
Merge pull request #16725 from yuwata/network-fix-ndisc-multiple-routers

network: fix NDisc behavior when multiple routers exist

3 years agocore: introduce support for setting NUMAMask= to special "all" value
Michal Sekletár [Tue, 1 Sep 2020 10:12:32 +0000 (12:12 +0200)] 
core: introduce support for setting NUMAMask= to special "all" value

Fixes #14113

3 years agotest-network: add test for IPv6Token=prefixstable 16618/head
Yu Watanabe [Thu, 30 Jul 2020 03:38:17 +0000 (12:38 +0900)] 
test-network: add test for IPv6Token=prefixstable

3 years agonetwork: make prefixstable mode of IPv6Token= can be applied to any received prefixes
Yu Watanabe [Thu, 30 Jul 2020 03:12:23 +0000 (12:12 +0900)] 
network: make prefixstable mode of IPv6Token= can be applied to any received prefixes

Closes #4625.

3 years agonetwork: fix NDisc handling for the case when multiple routers exist 16725/head
Yu Watanabe [Fri, 14 Aug 2020 08:45:44 +0000 (17:45 +0900)] 
network: fix NDisc handling for the case when multiple routers exist

69203fba700ea8d7b0c4f4e3d1e1f809ac4644a1 does not consider the case that
multiple routers exist, and causes #16719.

Fixes #16719.

3 years agonetwork: expose route_{hash,compare}_func()
Yu Watanabe [Fri, 4 Sep 2020 01:56:03 +0000 (10:56 +0900)] 
network: expose route_{hash,compare}_func()

3 years agonetwork: expose address_{hash,compare}_func()
Yu Watanabe [Fri, 4 Sep 2020 01:55:40 +0000 (10:55 +0900)] 
network: expose address_{hash,compare}_func()

3 years agoutil: expose in6_addr_{hash,compare}_func()
Yu Watanabe [Fri, 14 Aug 2020 08:44:02 +0000 (17:44 +0900)] 
util: expose in6_addr_{hash,compare}_func()

3 years agoMerge pull request #16928 from poettering/statx-fallback
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 20:04:18 +0000 (22:04 +0200)] 
Merge pull request #16928 from poettering/statx-fallback

stat-util: provide single statx() fallback on top of fstatat()

3 years agoselinux: create /run/user/${USERID}/systemd with default context
Christian Göttsche [Sat, 5 Sep 2020 15:42:56 +0000 (17:42 +0200)] 
selinux: create /run/user/${USERID}/systemd with default context

3 years agoselinux: early exit in mac_selinux_maybe_reload if not initialized
Christian Göttsche [Sat, 5 Sep 2020 15:49:48 +0000 (17:49 +0200)] 
selinux: early exit in mac_selinux_maybe_reload if not initialized

Binaries might not initialize SELinux, e.g. when they normally do not
create files with the SELinux default context.
If they, via an internal libary function, call a _label() function,
mac_selinux_maybe_reload() gets called. Since the SELinux status page
has not been opened, selinux_status_updated() will fail with EINVAL.

This affects particularly test binaries.

Just exit early and avoid confusing debug logs.

3 years agoman: fix typo in resolved.conf
George Rawlinson [Sat, 5 Sep 2020 17:57:00 +0000 (05:57 +1200)] 
man: fix typo in resolved.conf

3 years agoMerge pull request #16951 from yuwata/resolve-follow-ups-for-extra-dns-stub-listener
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 13:55:22 +0000 (15:55 +0200)] 
Merge pull request #16951 from yuwata/resolve-follow-ups-for-extra-dns-stub-listener

resolve: follow-ups for extra DNS stub listener

3 years agoMerge pull request #16854 from yuwata/sd-bus-error-set-errnofv
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 13:47:37 +0000 (15:47 +0200)] 
Merge pull request #16854 from yuwata/sd-bus-error-set-errnofv

sd-bus: rework sd_bus_error_set_errnofv()

3 years agoMerge pull request #16957 from poettering/sd-bus-proto-def-move
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 10:06:15 +0000 (12:06 +0200)] 
Merge pull request #16957 from poettering/sd-bus-proto-def-move

three unrelated, minor fixes

3 years agovarlink: properly allocate connection event source 16957/head
Lennart Poettering [Fri, 4 Sep 2020 21:54:11 +0000 (23:54 +0200)] 
varlink: properly allocate connection event source

Let's make sure we keep a reference to the event source

(Note that this code is currently not used, which is why this was never
used: in all cases we do not add listener fds after the event is
attached, but before. In that case this code is not called.)

3 years agoptyfwd: don't set prio if event source that might not exist
Lennart Poettering [Fri, 4 Sep 2020 21:52:39 +0000 (23:52 +0200)] 
ptyfwd: don't set prio if event source that might not exist

We support read-only ptyfwd options, and on those the input event source
won't be allocated. Deal with that and don't invoke a function on it
that will then instantly fail.

3 years agosd-bus: move SD_BUS_MAXIMUM_(SIGNATURE|NAME)_LENGTH to sd-bus-protocol.h
Lennart Poettering [Fri, 4 Sep 2020 21:49:44 +0000 (23:49 +0200)] 
sd-bus: move SD_BUS_MAXIMUM_(SIGNATURE|NAME)_LENGTH to sd-bus-protocol.h

So far we kept all defines directly originating from the spec in
sd-bus-protocol.h, do this for this too.

The precise place doesn't matter much API-wise given that sd-bus.h includes
sd-bus-protocol.h, hence let's just clean this up.

3 years agotest-sizeof: print pointer sizes 16955/head
Zbigniew Jędrzejewski-Szmek [Fri, 4 Sep 2020 16:32:43 +0000 (18:32 +0200)] 
test-sizeof: print pointer sizes

This is useful information, I don't know why we forgot to add it there.

gcc doesn't like arithemetic on a pointer to a function or void*, so don't
print signedness info there. It doesn't matter anyway.
C says function pointers can be different... Though I guess our code isn't
prepared for that.

3 years agoudev-test: do not rely on "mail" group being defined
Zbigniew Jędrzejewski-Szmek [Fri, 4 Sep 2020 16:09:20 +0000 (18:09 +0200)] 
udev-test: do not rely on "mail" group being defined

"audio" should be there, at least we declare it. "mail" nowadays is less
likely to exist than in the past.

Fixes one of the items in #16942.

3 years agotest-execute: check if private directories have bad permissions before running test_e...
Zbigniew Jędrzejewski-Szmek [Fri, 4 Sep 2020 16:02:57 +0000 (18:02 +0200)] 
test-execute: check if private directories have bad permissions before running test_exec_dynamicuser()

If the directory (/var/lib/private is most likely) has borked permissions, the
test will fail with a cryptic message and EXIT_STATE_DIRECTORY or similar. The
message from the child with more details gets lost somewhere. Let's avoid running
the test in that case and provide a simple error message instead.

E.g. systemd-238-12.git07f8cd5.fc28.ppc64 (which I encountered on a test machine)
has /var/lib/private with 0755.