Commit Graph
54455 Commits
Author SHA1 Message Date
Lennart Poettering 883946f0d2 process-util: rework TAKE_PID() to be side-effect free 2021-11-03 15:57:02 +01:00
Lennart Poettering 2c1612100d process-util: wait for processes we killed even if killing failed
The processes might be zombies in which case killing will fail, but
reaping them still matters.
2021-11-03 15:57:02 +01:00
Lennart Poettering a70877d881 test: add test that ensures TAKE_FD() works as it should 2021-11-03 15:57:02 +01:00
Zbigniew Jędrzejewski-Szmek 384c2c3239 Make pager_open() return void 2021-11-03 15:24:56 +01:00
Lennart Poettering 90d59676b3 fd-util: make TAKE_FD free of double evaluation
Better be safe than sorry.
2021-11-03 15:22:18 +01:00
Zbigniew Jędrzejewski-Szmek 028f7d3ac6 manager: fix confusion when to send READY=1
I got the logic reversed in 6d93265955.
Let's just remove the conditionalization of the status message: if we're
sending something, we might just as well always attach READY=1, the extra
few bytes don't make much of a difference.

FWIW, it seems that this bug didn't cause problems, probably because we'd send
READY=1 either from user_manager_send_ready() or from a later call to
manager_send_ready().
2021-11-03 11:32:31 +01:00
Zbigniew Jędrzejewski-Szmek d4341b76d0 tree-wide: drop "f" from sd_notify() calls with a static string
If we don't need to do any formatting, let's optimize things a bit.
2021-11-03 11:29:49 +01:00
Zbigniew Jędrzejewski-Szmek d7737416f5 journald: modernize code to send notifications
No change except making things a bit less verbose.
2021-11-03 11:29:49 +01:00
Zbigniew Jędrzejewski-Szmek 4bf4f50faa tree-wide: warn when sd_notify fails with READY=1 or FDSTOREREMOVE=1
Most sd_notify() calls are like log_info() — the result is only informative
and if they fail, it's best ignore this. But if a call with READY=1 fails,
the unit may enter a failed state, so we should warn about this. Similarly
for FSTOREREMOVE=1: the manager may be left with a stale fd, at least wasting
resources.
2021-11-03 11:29:49 +01:00
Zbigniew Jędrzejewski-Szmek 9214f2999b CODING_STYLE: allow joined variable declarations and function calls
… but only for a single variable.

The guidelines already allowed declaring variables at the point of
initialization. But not making a function call to do that. Let's allow that
now.  The existing style of declaring and initializing seperate is still
allowed, and whatever makes most sense should be used.
2021-11-03 10:30:36 +01:00
Zbigniew Jędrzejewski-Szmek 6434a83d01 test-process-util: also add EROFS to the list of "good" errors
It is only added in the one place where we actually try to set the
setting to a new value. Before we were testing if we can set to it the
existing value, which was a noop. We could still get a permission error,
but this is the first place where we would propagate EROFS.
2021-11-03 09:39:16 +01:00
Zbigniew Jędrzejewski-Szmek c3dead53d5 procfs-util: fix confusion wrt. quantity limit and maximum value
From packit/rawhide-arm64 logs:
Assertion 'limit >= INT_MAX || get_process_ppid(limit+1, NULL) == -ESRCH' failed at src/test/test-process-util.c:855, function test_get_process_ppid(). Aborting.
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

The kernel has a few different limits. In particular kernel.threads-max can be
set to some lower value, and kernel.pid_max can be set to a higher value. This
is nice because it reduces PID reuse, even if the number of threads that is
allowed is limited. But the tests assumed that we cannot have a thread with
PID above MIN(kernel.threads-max, kernel.pid_max-1), which is not valid.

So let's rework the whole thing: let's expose the helpers to read
kernel.threads-max and kernel.pid_max, and print what they return in tests.
procfs_tasks_get_limit() was something that is only used in tests, and wasn't
very well defined, so let's drop it.

Fixes #21193.
2021-11-03 09:36:08 +01:00
Yu Watanabe ab7b261663 Merge pull request #21210 from yuwata/network-dhcp-server-introduce-router-setting
network: dhcp-server: introduce Router= setting to specify router address
2021-11-03 12:41:34 +09:00
Lennart Poettering 2f2cdd7250 percent-util: clamp percent range before converting to 2^32 scale
Let#s better be safe than sorry and clamp the input, so that we don't
hit overflow issues.
2021-11-03 12:41:17 +09:00
Lennart Poettering 4768cc450d missing: add missing header inclusions
These headers should work without any manual header inclusion.
2021-11-03 12:41:01 +09:00
Yu Watanabe 32d97330df test-network: add a testcase for Router= setting 2021-11-03 03:15:05 +09:00
Yu Watanabe 59aa622013 network: dhcp-server: introduce Router= setting to specify router address
Closes #21202.
2021-11-03 03:15:00 +09:00
Franck Bui be0cc2ce6c test-keymap-util: always use kbd-model-map we ship
This test makes assumptions on the availability of some mappings contained in
kbd-model-map and therefore strongly relies on the version shipped by
upstream. IOW the test is likely to fail if it's installed on a system with a
more comprehensive kbd-model-map.

This patch makes the upstream kbd-model-map file available via a symlink in
test/testdata/test-keymap-util dir and makes sure that this specific version is
always used by test-keymap-util regardless of whether the test is installed and
run on a different system or directly run (optionally via meson) from the
project working dir.
2021-11-02 16:48:55 +01:00
Lennart Poettering 0bada3f8b7 man: document cryptenroll limitations
Let's document this for now. We should be able to lift these limitations
sooner or later, at which point we can drop this documentation again.

These two limitations are a pitfall that people should be aware of,
before going FIDO2-only.

See: #20230 #19208
2021-11-02 15:03:11 +00:00
Frantisek Sumsal c7448e741a Merge pull request #21207 from mrc0mmand/test-tweak-lvm-installation
test: support the new lvm udev autoactivation
2021-11-02 14:09:57 +00:00
Frantisek Sumsal 29f8bef05e test: support both lvm vgroup activation methods 2021-11-02 12:32:48 +01:00
Daan De Meyer db2aef5a1d Merge pull request #21209 from yuwata/veth-peer-mtu
network: also set MTU for veth peer interface
2021-11-02 09:58:39 +00:00
Yu Watanabe 0874be35c3 test-network: add test case for MTUBytes= for veth 2021-11-02 12:35:07 +09:00
Yu Watanabe 60b4af930e network/veth: also set MTU for peer interface
Fixes #21206.
2021-11-02 12:25:15 +09:00
Frantisek Sumsal e50d743f99 test: support the new lvm udev autoactivation
Introduced in lvm 2.03.14.
See: https://sourceware.org/git/?p=lvm2.git;a=commit;h=67722b312390cdab29c076c912e14bd739c5c0f6
2021-11-01 20:55:38 +01:00
Yu Watanabe 222cd15654 Merge pull request #21204 from yuwata/sd-dhcp6-client-cleanups
sd-dhcp6-client: further cleanups
2021-11-02 03:11:02 +09:00
Yu Watanabe aa5a0f959c sd-dhcp6-client: simplify code a bit
Also this adds a note.
2021-11-01 23:13:08 +09:00
Yu Watanabe 0936c189c9 sd-dhcp6-client: do not implicitly cast to boolean 2021-11-01 23:13:08 +09:00
Yu Watanabe e79b4b8534 sd-dhcp6-client: introduce dhcp6_lease_{get,set}_clientid() 2021-11-01 23:13:08 +09:00
Yu Watanabe 65457c17e6 sd-dhcp6-client: shorten code a bit 2021-11-01 23:13:08 +09:00
Yu Watanabe 4f81f0d241 sd-dhcp6-client: prefix variables which store results with "ret_" 2021-11-01 23:13:08 +09:00
Yu Watanabe d3aa9d6a80 sd-dhcp6-client: update log messages 2021-11-01 23:13:08 +09:00
Yu Watanabe 7e6abd25f4 Merge pull request #21200 from yuwata/sd-dhcp6-client-server-address
sd-dhcp6-client: introduce sd_dhcp6_lease_get_server_address()
2021-11-01 21:04:48 +09:00
Yu Watanabe 3b73ebc08a Merge pull request #21199 from yuwata/sd-dhcp6-client-trivial-cleanups
sd-dhcp6-client: trivial cleanups
2021-11-01 21:04:05 +09:00
Yu Watanabe c30f9aafed network: save server address to DHCPv6 addresses
The server address will be used in later commits.
2021-11-01 18:22:55 +09:00
Yu Watanabe ef4edc1546 sd-dhcp6-client: introduce sd_dhcp6_lease_get_server_address() 2021-11-01 18:22:49 +09:00
Yu Watanabe 2c269a4e2a sd-lldp-tx: drop unused and useless function
sd-lldp-tx does not call any callback function. So, the function is
mostly useless.
2021-11-01 08:57:17 +00:00
Yu Watanabe 7f402e5b7b sd-dhcp6: drop unused functions 2021-11-01 08:56:42 +00:00
Yu Watanabe 29ff62473b core: ignore failure on setting smack process label when allowed 2021-11-01 08:46:01 +00:00
Yu Watanabe 01b4e90f32 sd-dhcp6-client: request IA_PD by default
For consistency with 0f5ef9b62a.
2021-11-01 10:02:50 +09:00
Yu Watanabe 5e82251913 sd-dhcp6-client: always set suitable ARP type
Also, drops unnecessary comparisons.
2021-11-01 09:51:52 +09:00
Topi Miettinen 2ad2925de5 execute: respect selinux_context_ignore
When `SELinuxContext=` parameter is prefixed with `-`, the documentation states
that any errors determining or changing context should be ignored, but this
doesn't actually happen and the service may fail with `229/SELINUX_CONTEXT`.

Fix by adding checks to `context->selinux_context_ignore`.

Closes: #21057
2021-11-01 08:28:41 +09:00
Daan De Meyer 7454acd73f mkosi: Add netcat to fedora image
This helps with testing socket units.
2021-10-30 22:13:46 +01:00
Daan De Meyer ce2146f525 core: Delay start rate limit check when starting a unit
Doing start rate limit checks before doing condition checks made
condition check failures count towards the start rate limit which
broke existing assumptions (see #21025). Run the rate limit checks
after the condition checks again to restore the previous behaviour.
2021-10-30 22:13:45 +01:00
Daan De Meyer 5f37c1a955 core: Move 'r' variable declaration to start of unit_start() 2021-10-30 22:13:31 +01:00
Daan De Meyer 6b64d74091 mkosi: Install less in the mkosi Fedora image
We're actually falling back to `more` in the mkosi image which doesn't
behave quite the same as less which is somewhat annoying. Let's make
sure `less` is installed so systemd can use it as the pager.
2021-10-30 11:53:49 +01:00
Yu Watanabe 6db9b30066 Merge pull request #21175 from tohojo/dhcp-server-expire
sd-dhcp-server: clear out expired leases when finding new address
2021-10-30 04:13:40 +09:00
Yu Watanabe 43b7a806df Merge pull request #21180 from yuwata/libsystemd-network-cleanups
libsystemd-network: drop unused functions, and _public_ attribute
2021-10-30 01:18:28 +09:00
Toke Høiland-Jørgensen cb3c06a02e sd-dhcp-server: fix address availability checks
The checks for finding a new available address in the pool were broken in two
ways: not using UINT32_TO_PTR() on hashmap lookups resulted in false negatives,
and the check wasn't skipping the server address if that was part of the pool.

Move the check for available addresses to a small helper function and fix both
issues, and also add a check to the REQUEST code for the server address.
2021-10-29 15:29:05 +02:00
Toke Høiland-Jørgensen d635a7f9e4 sd-dhcp-server: clear out expired leases when processing requests
The DHCP server configuration supports setting a maximum lease time, but old
leases are never actually cleared out if the client doesn't send a RELEASE.
This causes the pool to run out of addresses on networks where clients just
disappear, which is a fairly common occurrence on wireless networks.

Fix this by cleaning up expired leases before processing client requests, so
addresses can be reused for new clients.
2021-10-29 15:29:05 +02:00