Commit Graph

46937 Commits

Author SHA1 Message Date
Yu Watanabe d31f33e3c9 network: do not start device monitor if /sys is read-only
Follow-up for bf331d8717.
2020-09-09 06:39:05 +09:00
Yu Watanabe e13af7bdb6 network: honor the buffer size specified in networkd.socket 2020-09-09 06:39:05 +09:00
Yu Watanabe ded71ab3bc core/socket: use fd_set_{rcv,snd}buf() 2020-09-09 06:39:05 +09:00
Yu Watanabe 2807a79424 sd-device-monitor: use fd_set_rcvbuf() 2020-09-09 06:39:05 +09:00
Yu Watanabe d9d9b2a0ae util: introduce fd_set_{snd,rcv}buf() 2020-09-09 06:39:05 +09:00
Yu Watanabe b92f350789 util: try to set with SO_{RCV,SND}BUFFORCE when requested size is larger than the kernel limit
The commit 10ce2e0681 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.
2020-09-09 06:39:05 +09:00
Yu Watanabe 1263c85ef3 util: refuse to set too large value for socket buffer size 2020-09-09 06:39:05 +09:00
Yu Watanabe 8c63924c8d network: ignore error on increasing netlink receive buffer size 2020-09-09 06:39:05 +09:00
Lennart Poettering a1447e77a7
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
2020-09-08 19:55:12 +02:00
Lennart Poettering f3f4abad29
Merge pull request #16979 from keszybz/return-log-debug
Fix 'return log_error()' and 'return log_warning()' patterns
2020-09-08 19:54:38 +02:00
Michal Sekletár 9a1e90aee5 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
2020-09-08 19:54:13 +02:00
Lennart Poettering 0354029bf5 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.
2020-09-08 19:47:30 +02:00
Lennart Poettering ae8f0ec323 resolved: move dns stub definitions to resolved-dns-stub.[ch]
Just some moving around, no logic changes.
2020-09-08 19:47:25 +02:00
Lennart Poettering 36aaabc35e resolve: DNSStubListenerExtra → DnsStubListenerExtra
All our other struct types use the "Dns" spelling, rather than "DNS". Do
the same for this struct.
2020-09-08 19:47:19 +02:00
Yu Watanabe d157714b68 network: make log_link_error() or friends return void 2020-09-09 02:34:38 +09:00
Yu Watanabe 8ed6f81ba3 core: make log_unit_error() or friends return void 2020-09-09 02:34:38 +09:00
Yu Watanabe 93c5b90459 core/slice: explicitly specify return value 2020-09-09 02:34:38 +09:00
Yu Watanabe 38104ee2a5 udev: do not discard const qualifier 2020-09-09 02:34:38 +09:00
Yu Watanabe ab54f12b78 sd-device: make log_device_error() or friends return void 2020-09-09 02:34:38 +09:00
Yu Watanabe 09c69ecaeb udev: explicitly specify return value 2020-09-09 02:34:38 +09:00
Yu Watanabe a718b951ac udev: return negative errno for invalid EVDEV_ABS_XXX= property 2020-09-09 02:34:38 +09:00
Yu Watanabe 3b4e123173 udev: make log_rule_error() or friends return void 2020-09-09 02:34:38 +09:00
Lennart Poettering c6552f7cd5
Merge pull request #16955 from keszybz/test-execute-cleanup
One patch for test-execute and assorted cleanups
2020-09-08 18:33:12 +02:00
Lennart Poettering d161680e7a 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.
2020-09-08 18:10:26 +02:00
Lennart Poettering 67f0ac8c79 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
2020-09-08 18:10:26 +02:00
Zbigniew Jędrzejewski-Szmek 1c5950bd61 sleep: reword some debug messages
I think the sentences sound more natural this way.
2020-09-08 17:40:46 +02:00
Zbigniew Jędrzejewski-Szmek 44f0dd628c 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.
2020-09-08 17:40:46 +02:00
Zbigniew Jędrzejewski-Szmek c413bb28df 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.
2020-09-08 17:40:46 +02:00
Zbigniew Jędrzejewski-Szmek fc706b4816 man: fix quickhelp listing in sysusers.d(5)
Fixes #16958.
2020-09-08 17:30:42 +02:00
Lennart Poettering 26c65933ba
Merge pull request #16978 from keszybz/two-variable-reduction-patches
Two variable reduction patches
2020-09-08 17:13:21 +02:00
Zbigniew Jędrzejewski-Szmek a9aa8deb29
Merge pull request #16618 from yuwata/network-ipv6token-prefixstable
network: make prefixstable mode of IPv6Token= can be applied any received prefixes
2020-09-08 13:36:27 +02:00
Zbigniew Jędrzejewski-Szmek 90e74a66e6 tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
Zbigniew Jędrzejewski-Szmek 12375b95dd core/unit: reduce scope of variables 2020-09-08 12:07:05 +02:00
Zbigniew Jędrzejewski-Szmek 8195283265
Merge pull request #16725 from yuwata/network-fix-ndisc-multiple-routers
network: fix NDisc behavior when multiple routers exist
2020-09-08 08:16:33 +02:00
Michal Sekletár 332d387f47 core: introduce support for setting NUMAMask= to special "all" value
Fixes #14113
2020-09-08 08:16:03 +02:00
Yu Watanabe 68248f43fc test-network: add test for IPv6Token=prefixstable 2020-09-08 14:32:44 +09:00
Yu Watanabe b27caa34f6 network: make prefixstable mode of IPv6Token= can be applied to any received prefixes
Closes #4625.
2020-09-08 14:32:33 +09:00
Yu Watanabe 50550722e3 network: fix NDisc handling for the case when multiple routers exist
69203fba70 does not consider the case that
multiple routers exist, and causes #16719.

Fixes #16719.
2020-09-08 02:30:04 +09:00
Yu Watanabe 501b09dbf2 network: expose route_{hash,compare}_func() 2020-09-08 02:30:04 +09:00
Yu Watanabe 99a2878457 network: expose address_{hash,compare}_func() 2020-09-08 02:30:04 +09:00
Yu Watanabe badd49288d util: expose in6_addr_{hash,compare}_func() 2020-09-08 02:30:04 +09:00
Zbigniew Jędrzejewski-Szmek 6743a1caf4
Merge pull request #16928 from poettering/statx-fallback
stat-util: provide single statx() fallback on top of fstatat()
2020-09-05 22:04:18 +02:00
Christian Göttsche e813a74ae8 selinux: create /run/user/${USERID}/systemd with default context 2020-09-05 21:39:44 +02:00
Christian Göttsche 1006038cf1 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.
2020-09-05 21:39:12 +02:00
George Rawlinson 22c2f841db man: fix typo in resolved.conf 2020-09-05 21:38:01 +02:00
Zbigniew Jędrzejewski-Szmek ad161cd6bb
Merge pull request #16951 from yuwata/resolve-follow-ups-for-extra-dns-stub-listener
resolve: follow-ups for extra DNS stub listener
2020-09-05 15:55:22 +02:00
Zbigniew Jędrzejewski-Szmek 5615e92efa
Merge pull request #16854 from yuwata/sd-bus-error-set-errnofv
sd-bus: rework sd_bus_error_set_errnofv()
2020-09-05 15:47:37 +02:00
Zbigniew Jędrzejewski-Szmek 7de6b05160
Merge pull request #16957 from poettering/sd-bus-proto-def-move
three unrelated, minor fixes
2020-09-05 12:06:15 +02:00
Lennart Poettering 8d91b2206c 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.)
2020-09-04 23:54:14 +02:00
Lennart Poettering 1ba37106b3 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.
2020-09-04 23:52:41 +02:00