]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
9 months agosd-radv: fix memory leak
Susant Sahani [Mon, 28 Aug 2023 10:21:22 +0000 (15:51 +0530)] 
sd-radv: fix memory leak

9 months agomeson: restore specifications of dependency on version_h
Zbigniew Jędrzejewski-Szmek [Mon, 28 Aug 2023 11:46:24 +0000 (14:46 +0300)] 
meson: restore specifications of dependency on version_h

This partially reverts 3c1eee5beda642707037b189481c3c30d1668da7.
I thought that it is not necessary, but
https://mesonbuild.com/Reference-manual_functions.html#vcs_tag says:

> This method returns a custom_tgt should be used to signal dependencies if
> other targets use the file outputted by this.
>
> For example, if you generate a header with this and want to use that in a
> build target, you must add the return value to the sources of that build
> target. Without that, Meson will not know the order in which to build the
> targets.

We can use version_h directly, since we already have it.

Hopefully fixes https://github.com/systemd/systemd/issues/28994.

9 months agotest-dhcp-client: add temporary workaround for assertion failure
Luca Boccassi [Mon, 28 Aug 2023 10:03:45 +0000 (11:03 +0100)] 
test-dhcp-client: add temporary workaround for assertion failure

Workaround for https://github.com/systemd/systemd/issues/28990

Introduced by https://github.com/systemd/systemd/pull/28932 but CI was
green there. Add a workaround to get the CI back in shape while it is
being investigated.

9 months agoboot: don't pass kernel cmdline option to UKIs which have the very same line built-in
Lennart Poettering [Mon, 21 Aug 2023 16:18:41 +0000 (18:18 +0200)] 
boot: don't pass kernel cmdline option to UKIs which have the very same line built-in

There's really no point in first extracting a command line from an UKI
to just pass it unmodified to the UKI. In particular as this is
systematically ignored in SecureBoot is enabled.

Let's drop this, so that unless the user actually edits the cmdline we
pass nothing to the invoked kernel.

Note that this low-key is a compat break, since the passed cmdline gets
measured. However, in the interest of minimized the difference between
systems with and without sd-boot to behave the same i think we should
suppress the command line anyway.

9 months ago99-systemd.rules.in: tag PTP devices with systemd
Chris Patterson [Fri, 25 Aug 2023 21:23:40 +0000 (17:23 -0400)] 
99-systemd.rules.in: tag PTP devices with systemd

Chronyd and similar time services, when using PTP devices, may need
the BindsTo/After directives to ensure the devices are available
before starting.  Tag PTP devices with systemd to allow for wider
adoption.

Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
9 months agosd-dhcp-client: make client initially in stopped state
Yu Watanabe [Wed, 23 Aug 2023 04:25:35 +0000 (13:25 +0900)] 
sd-dhcp-client: make client initially in stopped state

Previously, DHCP_STATE_STOPPED and DHCP_STATE_INIT are both handled as
not-running. Moreover, previously after sd_dhcp_client_start() is
called, the client still in INIT state (and thus handled as not-running)
even if its internal timer event sources are initialized.

Let's make only STOPPED state handled as not-running, and make the
client initially in STOPPED state.

Prompted by #28896.

9 months agopkg.m4 macro needs brackets
Michael Vasseur [Thu, 24 Aug 2023 19:47:05 +0000 (21:47 +0200)] 
pkg.m4 macro needs brackets

See documentation at: https://manpages.debian.org/testing/pkgconf/pkg.m4.7.en.html

Without this the macro was not always correctly resolved so the correct command was not used in the rest of the snippet.

9 months agoMerge pull request #28977 from keszybz/drop-versiondep
Luca Boccassi [Mon, 28 Aug 2023 09:02:01 +0000 (10:02 +0100)] 
Merge pull request #28977 from keszybz/drop-versiondep

meson: simplify handling of the version tag

9 months agoman/gpt-auto-generator: avoid saying "negative" for boolean
Zbigniew Jędrzejewski-Szmek [Sun, 27 Aug 2023 14:10:38 +0000 (17:10 +0300)] 
man/gpt-auto-generator: avoid saying "negative" for boolean

Fixes #28928.

9 months agoMerge pull request #28968 from DaanDeMeyer/rlimit
Zbigniew Jędrzejewski-Szmek [Sun, 27 Aug 2023 14:06:58 +0000 (16:06 +0200)] 
Merge pull request #28968 from DaanDeMeyer/rlimit

Limit rlim_max in rlimit_nofile_safe() to nr_open

9 months agoman: Fix typo in config file example for ukify
Alvin Alvarado [Sat, 26 Aug 2023 13:25:46 +0000 (23:25 +1000)] 
man: Fix typo in config file example for ukify

or else it would output 'Unknown config setting [UKI] SecureBootCerificate=' or just an error outright if not overrode.

9 months agomeson: drop "versiondep" object 28977/head
Zbigniew Jędrzejewski-Szmek [Sat, 26 Aug 2023 09:36:02 +0000 (11:36 +0200)] 
meson: drop "versiondep" object

It was added to make sure that the version tag was built early
enough. Now that we use vcs_tag, meson should take care of building
it early enough.

9 months agomeson: simplify version_tag handling
Zbigniew Jędrzejewski-Szmek [Sat, 26 Aug 2023 07:17:44 +0000 (09:17 +0200)] 
meson: simplify version_tag handling

Let's also use vcs_tag() when we're doing a non-git build. In those scenarios,
the build would normally be done just once in a given copy, so doing an extra
call does not matter. We can save a few lines of meson config.

The special path was added in 064b8e2c99ceb348c515353cc5c7d7bd05c49fcb, with
the justifaction that vcs_tag() is slow and -Dversion-tag=foo can be used to
fix the version tag and speed up partial rebuilds. I think the justification
for this is weak: having an accurate version tag is particularly useful when
developing the code. Shaving of a fraction of a second at the cost of having to
manually update the version seems iffy.

Secondly, with vcs_tag() we can be pretty sure that meson will build the
version file first and that it'll be available to all build steps. Because we
didn't use version tag, we had to manually specify the dependency on version.h
in various places. It seems nicer to use vcs_tag() and not have to deal with
this problem at all.

Finally, the savings in time seem much smaller than back when
064b8e2c99ceb348c515353cc5c7d7bd05c49fcb was made. It reported a change
from 94 ms to 521 ms. But now the difference seems to be about 50 ms:

Before this patch:
$ time ninja -C build
ninja: Entering directory `build'
ninja: no work to do.
ninja -C build  0.04s user 0.02s system 97% cpu 0.057 total
ninja -C build  0.03s user 0.01s system 97% cpu 0.049 total
ninja -C build  0.03s user 0.02s system 96% cpu 0.051 total
ninja -C build  0.03s user 0.01s system 96% cpu 0.049 total
ninja -C build  0.03s user 0.01s system 97% cpu 0.046 total

With the two patches in this PR:
systemd-stable [drop-versiondep] time ninja -C build
ninja: Entering directory `build'
[1/669] Generating version.h with a custom command
ninja -C build  0.08s user 0.03s system 98% cpu 0.106 total
ninja -C build  0.08s user 0.03s system 98% cpu 0.104 total
ninja -C build  0.09s user 0.02s system 98% cpu 0.116 total
ninja -C build  0.08s user 0.02s system 97% cpu 0.108 total

Overall, I think the tiny time savings are not worth the complexity.

9 months agoUpdate 60-sensor.hwdb (#28804)
Juno Computers [Sat, 26 Aug 2023 13:35:57 +0000 (09:35 -0400)] 
Update 60-sensor.hwdb (#28804)

Updated T11/Juno Tab 2.

9 months agomeson: Bring back use of vcs_tag
Jan Janssen [Fri, 25 Aug 2023 11:07:55 +0000 (13:07 +0200)] 
meson: Bring back use of vcs_tag

The use of vcs_tag was dropped in #28567, which results in builds having
stale version information once new commit are made.

This also fixes a case where CI builds would have no version information
because they are checked out without any tags for git-describe to use.

Additionally, use `--git-dir` now, as that particular issues seems to
have been fixed by now.

9 months agomount/mount-tool: return correct errno
Mike Yuan [Fri, 25 Aug 2023 17:11:55 +0000 (01:11 +0800)] 
mount/mount-tool: return correct errno

Follow-up for 9269296df05a724c6b121bcbb0b420c8b4088f2f

9 months agoMerge pull request #28913 from keszybz/tmpfs-top-level-dir-mode
Zbigniew Jędrzejewski-Szmek [Fri, 25 Aug 2023 16:36:30 +0000 (18:36 +0200)] 
Merge pull request #28913 from keszybz/tmpfs-top-level-dir-mode

systemd-mount: do not create tmpfs mounts with sticky permission bit

9 months agonetwork: sd-radv - Introduce pref64 support (RFC8781)
Susant Sahani [Fri, 28 Jul 2023 17:21:50 +0000 (22:51 +0530)] 
network: sd-radv - Introduce pref64 support (RFC8781)

Implements: https://datatracker.ietf.org/doc/html/rfc8781

```

[IPv6PREF64Prefix]
Prefix=2003:da8:1:0::/64
ValidLifetimeSec=30m

Frame 16: 126 bytes on wire (1008 bits), 126 bytes captured (1008 bits) on interface veth99, id 0
Ethernet II, Src: 06:c7:41:95:1d:7f (06:c7:41:95:1d:7f), Dst: IPv6mcast_01 (33:33:00:00:00:01)
Internet Protocol Version 6, Src: fe80::4c7:41ff:fe95:1d7f, Dst: ff02::1
Internet Control Message Protocol v6
    Type: Router Advertisement (134)
    Code: 0
    Checksum: 0x0ca0 [correct]
    [Checksum Status: Good]
    Cur hop limit: 0
    Flags: 0x00, Prf (Default Router Preference): Medium
    Router lifetime (s): 1800
    Reachable time (ms): 0
    Retrans timer (ms): 0
    ICMPv6 Option (Source link-layer address : 06:c7:41:95:1d:7f)
    ICMPv6 Option (Prefix information : 2002:da8:1::/64)
    ICMPv6 Option (PREF64 Option)
        Type: PREF64 Option (38)
        Length: 2 (16 bytes)
        0000 0111 0000 1... = Scaled Lifetime: 225
        .... .... .... .001 = PLC (Prefix Length Code): 64 bits prefix length (0x1)
        Prefix: 64:ff9b::

```

9 months agoLimit rlim_max in rlimit_nofile_safe() to nr_open 28968/head
Daan De Meyer [Fri, 25 Aug 2023 11:55:36 +0000 (13:55 +0200)] 
Limit rlim_max in rlimit_nofile_safe() to nr_open

We might inherit a max rlim value that's larger than the kernel's
maximum (nr_open). This will cause setrlimit() to fail as the given
maximum is larger than the kernel's maximum. To get around this,
let's limit the max rlim we pass to rlimit() to the value of nr_open.

Should fix #28965

9 months agomkfs-util: Set FORK_REOPEN_LOG
Daan De Meyer [Fri, 25 Aug 2023 12:25:33 +0000 (14:25 +0200)] 
mkfs-util: Set FORK_REOPEN_LOG

We set FORK_CLOSE_ALL_FDS, so we should also set FORK_REOPEN_LOG to
reopen the log in the child process so we don't miss any logging
messages.

9 months agoMerge pull request #28917 from yuwata/network-address-pool
Zbigniew Jędrzejewski-Szmek [Thu, 24 Aug 2023 13:58:31 +0000 (15:58 +0200)] 
Merge pull request #28917 from yuwata/network-address-pool

undefined

9 months agonspawn: check validity of the internal interface name only explicitly specified
Yu Watanabe [Wed, 23 Aug 2023 03:13:44 +0000 (12:13 +0900)] 
nspawn: check validity of the internal interface name only explicitly specified

Follow-up for 2f091b1b49543aade4aad9ec3b35b3665abac3e7.

Fixes #28844.

9 months agoman/repart: use <filename> and add missing <para>
Zbigniew Jędrzejewski-Szmek [Thu, 24 Aug 2023 11:43:42 +0000 (13:43 +0200)] 
man/repart: use <filename> and add missing <para>

9 months agoMerge pull request #28918 from yuwata/network-dhcp-custom-duid
Zbigniew Jędrzejewski-Szmek [Thu, 24 Aug 2023 13:45:07 +0000 (15:45 +0200)] 
Merge pull request #28918 from yuwata/network-dhcp-custom-duid

network/dhcp: allow to specify custom duid type

9 months agogpt: move basic header/partition structure of GPT into common code
Lennart Poettering [Tue, 15 Aug 2023 07:52:38 +0000 (09:52 +0200)] 
gpt: move basic header/partition structure of GPT into common code

This way we can use it at other places too, not just when dissecting
images.

9 months agoalloc-util: add free_many() helper
Lennart Poettering [Wed, 23 Aug 2023 12:29:40 +0000 (14:29 +0200)] 
alloc-util: add free_many() helper

We often free an array of things. Let's create a common helper for this,
and port some potential users over. (Not all, too lazy for that for
now).

9 months agoMerge pull request #28946 from poettering/json-variant-append-arrayb
Lennart Poettering [Thu, 24 Aug 2023 11:37:10 +0000 (13:37 +0200)] 
Merge pull request #28946 from poettering/json-variant-append-arrayb

add json_variant_append_arrayb() helper + more related

9 months agojson: add json_variant_set_fieldb() helper 28946/head
Lennart Poettering [Thu, 24 Aug 2023 07:55:48 +0000 (09:55 +0200)] 
json: add json_variant_set_fieldb() helper

Let's a "b" helper for json_variant_set_field() that combines
json_build() with json_variant_set_field(), similar to the
json_variant_merge_objectb(), json_variant_append_arrayb().

9 months agojson: rename json_append() → json_variant_merge_objectb()
Lennart Poettering [Thu, 24 Aug 2023 07:41:48 +0000 (09:41 +0200)] 
json: rename json_append() → json_variant_merge_objectb()

json_append() is a useful wrapper around json_variant_merge(). However,
I think the naming sould be cleaned up a bit of both functions.

I thinker "merge" is the better word than "append", since it does
decidedly more than just append: it replaces existing fields of the same
name, hence "merge" sounds more appropriate. This is as opposed to the
similar operations for arrays, where no such override logic is applied
and we really just append, hence those functions are called "append"
already.

To make clearer that "merge" is about objects, and "append" about
arrays, also include "object" in the name.

Also, include "json_variant" in the name, like we do for almost all
other functions in the JSON API that take a JSON object as primary
input, and hence are kinda object methods.

Finally, let's follow the logic that helpers that combine json_build()
with some other operation get suffixed with "b" like we already have in
some cases.

Hence:

json_variant_merge() → json_variant_merge_object()
       json_append() → json_variant_merge_objectb()

This mirrors nicely the existing:
                       json_variant_append_array()
                       json_vairant_append_arrayb()

This also drops the variant of json_append() that takes a va_arg
parameter (i.e. json_appendv()). We have no user of that so far, and
given the nature as a helper function only I don#t see that happening,
and if it happens after all it's trivial to bring back.

9 months agotree-wide: use json_variant_append_arrayb() at many places
Lennart Poettering [Thu, 24 Aug 2023 07:28:42 +0000 (09:28 +0200)] 
tree-wide: use json_variant_append_arrayb() at many places

9 months agojson: add json_variant_append_arrayb() helper
Lennart Poettering [Wed, 16 Aug 2023 07:35:07 +0000 (09:35 +0200)] 
json: add json_variant_append_arrayb() helper

9 months agoutf8: automatically determine length of string if SIZE_MAX is specified
Lennart Poettering [Mon, 14 Aug 2023 11:15:52 +0000 (13:15 +0200)] 
utf8: automatically determine length of string if SIZE_MAX is specified

Let's make utf8_to_utf16() and utf16_to_utf8() a bit nicer to use by
adding shortcuts for common cases.

This is particularly relevant for utf16_to_utf8() since the
multiplication with 2 is easy to forget.

9 months agotest-network: re-add test for custom client identifier 28918/head
Susant Sahani [Tue, 22 Aug 2023 06:00:29 +0000 (15:00 +0900)] 
test-network: re-add test for custom client identifier

9 months agonetwork/dhcp: make DUIDType= take an arbitrary integer
Yu Watanabe [Tue, 22 Aug 2023 05:32:07 +0000 (14:32 +0900)] 
network/dhcp: make DUIDType= take an arbitrary integer

Closes #26745.

9 months agodhcp: DUID-EN identifier has variable length
Yu Watanabe [Tue, 22 Aug 2023 05:44:13 +0000 (14:44 +0900)] 
dhcp: DUID-EN identifier has variable length

Also make `array[0]` -> `array[]`.

See RFC 8415, section 11.3.

9 months agonetwork/dhcp: fix maximal DUID data size
Yu Watanabe [Tue, 22 Aug 2023 05:26:06 +0000 (14:26 +0900)] 
network/dhcp: fix maximal DUID data size

The maximum DUID size is 128, but that includes type specified.
Hence, the maximal data size is 126.

9 months agonetwork: introduce per DUID type setters
Yu Watanabe [Tue, 22 Aug 2023 05:22:03 +0000 (14:22 +0900)] 
network: introduce per DUID type setters

No functional change, just refactoring.

9 months agoRevert "network: DHCP6 client- Allow to send manual DUID"
Yu Watanabe [Tue, 22 Aug 2023 05:12:10 +0000 (14:12 +0900)] 
Revert "network: DHCP6 client- Allow to send manual DUID"

This reverts commits 89e73ce86fb115c2e319bf9f28b63efad2975495 and
543d2a4d45ba199a62c87b3bf69dfd4ff55abf0c.

The commit assign "custom" to fixed DUID type 5. When making DUID fully
configurable, the type number should be also configurable. Also, the
fully custom DUID should be acceptable for DHCPv4.

9 months agohostname: Make sure we pass error to bus_verify_polkit_async()
Daan De Meyer [Thu, 24 Aug 2023 07:00:04 +0000 (09:00 +0200)] 
hostname: Make sure we pass error to bus_verify_polkit_async()

Fixes #28943

9 months agoMerge pull request #24175 from medhefgo/meson-feature
Zbigniew Jędrzejewski-Szmek [Thu, 24 Aug 2023 09:19:55 +0000 (11:19 +0200)] 
Merge pull request #24175 from medhefgo/meson-feature

meson: Use feature options

9 months agomeson: use 'sh' variable everywhere
Zbigniew Jędrzejewski-Szmek [Wed, 23 Aug 2023 10:23:50 +0000 (12:23 +0200)] 
meson: use 'sh' variable everywhere

We went back-and-forth a bit on this. Very old meson would print a message
about detecting the program if a quoted argument was used, leading to a lot of
noise. So we started to convert various places to use the variable, but then it
turned out that meson < 0.56.2 doesn't handle this correctly and we reverted to
using strings everywhere in 7c22f07cbd86b39e78990057687e5509fa299672. Then at
some point we stopped supporting old meson and over time we started using the
variable in various places again, somewhat inconsistently. Then most calls to
'sh' were removed in 9289e093ae6fd5484f9119e1ee07d1dffe37cd10 when
install_emptydir() builtin started being used.

Now meson allows either the string or variable to be used, and doesn't print a
message if the string is used. Let's use the variable everywhere. For 'sh', we
could do either, but for other variables, we _do_ want the detection to happen,
for example for git, find, awk, which might not be installed and we want to
detect that early, before we start the build. It would be ugly to use quotes
for some programs, but not for others. Also, a string is still refused for
test(), so we couldn't use the string version even if we didn't care about
detection.

9 months agorepart: Make verity example more useful
Daan De Meyer [Wed, 23 Aug 2023 19:53:40 +0000 (21:53 +0200)] 
repart: Make verity example more useful

Add Minimize= so the size gets calculated correctly and add a verity
signature partition as well for completeness.

9 months agotest: use the correct file name when restoring the original fstab
Frantisek Sumsal [Wed, 23 Aug 2023 13:10:23 +0000 (15:10 +0200)] 
test: use the correct file name when restoring the original fstab

9 months agorepart: Add partno to output
Daan De Meyer [Wed, 23 Aug 2023 07:54:38 +0000 (09:54 +0200)] 
repart: Add partno to output

9 months agomkosi: Drop fedora workaround
Daan De Meyer [Wed, 23 Aug 2023 12:51:20 +0000 (14:51 +0200)] 
mkosi: Drop fedora workaround

Seems the key issues got resolved so let's drop the workaround.

9 months agomeson: Simplify efi test/fuzz definitions 24175/head
Jan Janssen [Wed, 23 Aug 2023 12:56:41 +0000 (14:56 +0200)] 
meson: Simplify efi test/fuzz definitions

9 months agomeson: Drop skip-deps option
Jan Janssen [Thu, 10 Aug 2023 16:11:25 +0000 (18:11 +0200)] 
meson: Drop skip-deps option

Now that we use meson feature options for our dependencies, we can just
rely on '--auto-features=disabled' to do the same. One benefit of this
is that specific features can still be force-enabled by overriding it
with the appropriate '-Dfeature=enabled' flag.

The two remaining uses for skip-deps can simply rely on their default
logic that sets the value to 'no' when the dependency is disabled.

9 months agomeson: Convert more options to meson features
Jan Janssen [Thu, 10 Aug 2023 14:00:55 +0000 (16:00 +0200)] 
meson: Convert more options to meson features

The semantics for libidn2 and pwquality have changed slightly: We will
pick a preferred one if both are enabled instead of making it an error.

9 months agomeson: Convert bpf-framework to meson feature
Jan Janssen [Thu, 10 Aug 2023 14:33:37 +0000 (16:33 +0200)] 
meson: Convert bpf-framework to meson feature

9 months agomeson: Convert options to meson features (require)
Jan Janssen [Thu, 10 Aug 2023 13:44:11 +0000 (15:44 +0200)] 
meson: Convert options to meson features (require)

These options use requre() to conveniently express their dependency
requirements.

9 months agomeson: Convert dbus to meson feature
Jan Janssen [Thu, 10 Aug 2023 13:16:56 +0000 (15:16 +0200)] 
meson: Convert dbus to meson feature

Also, there is no need to conditionalize the get_variable() calls
because not-found dependencies will just return the passed default value
if provided.

9 months agomeson: Convert options to meson features (find_library fallback)
Jan Janssen [Wed, 9 Aug 2023 17:52:57 +0000 (19:52 +0200)] 
meson: Convert options to meson features (find_library fallback)

This uses a two-step approach to make sure we can fall back to
find_library(), while also skipping the detection if the features are
explicitly disabled.

9 months agomeson: Convert fidsk to meson feature
Jan Janssen [Wed, 9 Aug 2023 16:07:19 +0000 (18:07 +0200)] 
meson: Convert fidsk to meson feature

By making this a disabler dependency, we can slightly simplify the code
and it als fixes the build for -Dfdisk=disabled as we failed to create a
fallback empty libshared_fdisk variable.

9 months agomeson: Use feature options
Jan Janssen [Wed, 9 Aug 2023 16:15:29 +0000 (18:15 +0200)] 
meson: Use feature options

By using meson features we can replace the handcrafted dependency
auto-detection by just passing the value from get_option directly to the
required arg for dependency, find_library etc.
'auto' features make the dependency optional, 'enabled' requires it
while 'disabled' features will skip detection entirely.

Any skipped or not found dependency will just be a no-op when passed to
build steps and therefore we can also skip the creation of empty vars.

The use of skip_deps for these is dropped here as meson provides a way
to disable all optional features in one go by passing
'-Dauto_features=disabled'.

9 months agonetwork: radv - Allow to send hop limit
Susant Sahani [Tue, 22 Aug 2023 11:46:56 +0000 (17:16 +0530)] 
network: radv - Allow to send hop limit

9 months agoMerge pull request #28764 from yuwata/core-namespace
Yu Watanabe [Wed, 23 Aug 2023 03:43:29 +0000 (12:43 +0900)] 
Merge pull request #28764 from yuwata/core-namespace

core/namespace: cleanups

9 months agonetworkd: Add T1 and T2 DHCPv6 options to expose in dbus API
Nandakumar Raghavan [Wed, 2 Aug 2023 10:34:17 +0000 (10:34 +0000)] 
networkd: Add T1 and T2 DHCPv6 options to expose in dbus API

Include T1 and T2 DHCPv6 options to expose in dbus API.
Introduced new field DHCPv6lease where these options are
added. This will be added to the JSON output when we query
org.freedesktop.network1.Manager object.

9 months agoMerge pull request #28926 from yuwata/bsod-cleanups
Yu Watanabe [Wed, 23 Aug 2023 03:41:53 +0000 (12:41 +0900)] 
Merge pull request #28926 from yuwata/bsod-cleanups

bsod: several cleanups

9 months ago network/radv: allow to configure the time between retransmitted Neighbor Solicitatio...
Susant Sahani [Wed, 23 Aug 2023 03:37:44 +0000 (09:07 +0530)] 
 network/radv: allow to configure the time between retransmitted Neighbor Solicitation (#28888)

9 months agoMerge pull request #28496 from ssahani/ndisc-28426
Yu Watanabe [Wed, 23 Aug 2023 03:36:45 +0000 (12:36 +0900)] 
Merge pull request #28496 from ssahani/ndisc-28426

network: ndisc - Also fill router preference

9 months agonetwork: ndisc - drop routes of lifetime 0 28496/head
Susant Sahani [Wed, 26 Jul 2023 09:44:13 +0000 (15:14 +0530)] 
network: ndisc - drop routes of lifetime 0

A Lifetime of 0 indicates that the router is not a default router anymore
and associated default route should be discarded from host's routing table.

https://datatracker.ietf.org/doc/html/rfc4861
```
Router Lifetime
     16-bit unsigned integer.  The lifetime associated
     with the default router in units of seconds.  The
     field can contain values up to 65535 and receivers
     should handle any value, while the sending rules in
     Section 6 limit the lifetime to 9000 seconds.  A
     Lifetime of 0 indicates that the router is not a
     default router and SHOULD NOT appear on the default
     router list.  The Router Lifetime applies only to
     the router's usefulness as a default router; it
     does not apply to information contained in other
     message fields or options.  Options that need time
     limits for their information include their own
     lifetime fields.

```

9 months agocore/namespace: do not return 1 unnecessarily 28764/head
Yu Watanabe [Tue, 22 Aug 2023 11:05:41 +0000 (20:05 +0900)] 
core/namespace: do not return 1 unnecessarily

The caller of this function apply_mounts() -> apply_one_mount() only
checks if the return value is negative or not.

9 months agocore/namespace: add missing string table entries
Yu Watanabe [Fri, 11 Aug 2023 05:56:05 +0000 (14:56 +0900)] 
core/namespace: add missing string table entries

9 months agomount-util: drop unused remount_and_move_sub_mounts()
Yu Watanabe [Thu, 10 Aug 2023 05:36:14 +0000 (14:36 +0900)] 
mount-util: drop unused remount_and_move_sub_mounts()

9 months agocore/namespace: reimplement mount_private_sysfs() in the same logic to mount private...
Yu Watanabe [Thu, 10 Aug 2023 04:58:54 +0000 (13:58 +0900)] 
core/namespace: reimplement mount_private_sysfs() in the same logic to mount private procfs

Previously, mount_private_sysfs() was implemented by using open_tree()
and move_mount() to keep submounts. But these syscalls are slightly new
and supported since kernel version 5.2.

We already do the same thing for /proc/, but without the new syscalls.
Let's use the same logic to mount private procfs. Then, we can mount
new instance of sysfs with older kernels.

9 months agocore/namespace: use ERRNO_IS_NEG_PRIVILEGE()
Yu Watanabe [Thu, 10 Aug 2023 20:39:57 +0000 (05:39 +0900)] 
core/namespace: use ERRNO_IS_NEG_PRIVILEGE()

Also, this makes mount_procfs() always return the last failure in mount(),
and slightly reduces indentation by returning earlier.

9 months agoMerge pull request #28787 from yuwata/credential-next
Zbigniew Jędrzejewski-Szmek [Tue, 22 Aug 2023 14:21:00 +0000 (16:21 +0200)] 
Merge pull request #28787 from yuwata/credential-next

core: do not leak mount for credentials directory if possible

9 months agobsod: several cleanups 28926/head
Yu Watanabe [Tue, 22 Aug 2023 13:54:43 +0000 (22:54 +0900)] 
bsod: several cleanups

- add reference to the service unit in the man page,
- fix several indentation and typos,
- replace '(uint64_t) -1' with 'UINT64_MAX',
- drop unnecessary 'continue'.

9 months agoman/rules: update man rules for systemd-tmpfiles-setup-dev-early.service
Yu Watanabe [Tue, 22 Aug 2023 13:51:00 +0000 (22:51 +0900)] 
man/rules: update man rules for systemd-tmpfiles-setup-dev-early.service

Follow-up for bb7f485f4bddd57bbf50739bafa43d127bab59d6.

9 months agonetwork: ndisc - Also fill router preference
Susant Sahani [Sat, 22 Jul 2023 18:08:47 +0000 (23:38 +0530)] 
network: ndisc - Also fill router preference

9 months agosysext: fix a memory leak
Frantisek Sumsal [Tue, 22 Aug 2023 09:31:07 +0000 (11:31 +0200)] 
sysext: fix a memory leak

Introduced by 41712cd1c0d.

=================================================================
==2194==ERROR: LeakSanitizer: detected memory leaks
Indirect leak of 359856 byte(s) in 459 object(s) allocated from:
    #0 0x7ffff7511df4  (/usr/lib64/clang/16/lib/linux/libclang_rt.asan-powerpc64le.so+0x191df4) (BuildId: 47e1dd371a2b8525b6cb737760a4dc535f30ea10)
    #1 0x7ffff6bb5fb0 in message_from_header /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-message.c:372:13
    #2 0x7ffff6bb5fb0 in bus_message_from_malloc /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-message.c:421:13
    #3 0x7ffff6c23f54 in bus_socket_make_message /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-socket.c:1222:13
    #4 0x7ffff6c22d10 in bus_socket_read_message /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-socket.c
    #5 0x7ffff6c4d414 in bus_read_message /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/sd-bus.c:2082:16
    #6 0x7ffff6c4d414 in sd_bus_call /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/sd-bus.c:2480:21
    #7 0x7ffff6682904 in bus_service_manager_reload /systemd-meson-build/../root/systemd/src/shared/bus-unit-util.c:2823:13
    #8 0x1000d570 in daemon_reload /systemd-meson-build/../root/systemd/src/sysext/sysext.c:233:16
    #9 0x100090f8 in merge /systemd-meson-build/../root/systemd/src/sysext/sysext.c:895:21
    #10 0x10006ff4 in verb_merge /systemd-meson-build/../root/systemd/src/sysext/sysext.c:964:16
    #11 0x7ffff69ae894 in dispatch_verb /systemd-meson-build/../root/systemd/src/shared/verbs.c:103:24
    #12 0x10004570 in sysext_main /systemd-meson-build/../root/systemd/src/sysext/sysext.c:1194:16
    #13 0x10004570 in run /systemd-meson-build/../root/systemd/src/sysext/sysext.c:1214:16
    #14 0x10004570 in main /systemd-meson-build/../root/systemd/src/sysext/sysext.c:1217:1
    #15 0x7ffff5f5a968 in generic_start_main.isra.0 (/lib64/libc.so.6+0x2a968) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
    #16 0x7ffff5f5ab00 in __libc_start_main (/lib64/libc.so.6+0x2ab00) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
Indirect leak of 124984 byte(s) in 459 object(s) allocated from:
...
    #11 0x7ffff5f5a968 in generic_start_main.isra.0 (/lib64/libc.so.6+0x2a968) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
    #12 0x7ffff5f5ab00 in __libc_start_main (/lib64/libc.so.6+0x2ab00) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
SUMMARY: AddressSanitizer: 493766 byte(s) leaked in 1383 allocation(s).

9 months agonetwork: several follow-ups for TCP-RTO setting
Yu Watanabe [Tue, 22 Aug 2023 07:06:01 +0000 (16:06 +0900)] 
network: several follow-ups for TCP-RTO setting

- rename TCPRetransmissionTimeOutSec= -> TCPRetransmissionTimeoutSec,
- refuse infinity,
- fix the input value verifier (USEC_PER_SEC -> USEC_PER_MSEC),
- use DIV_ROUND_UP() when assigning the value.

Follow-ups for 1412d4a4fea234fd2afda26b1241cd700246a672.
Closes #28898.

9 months agoMerge pull request #28914 from poettering/boot-poweroff
Zbigniew Jędrzejewski-Szmek [Tue, 22 Aug 2023 12:55:24 +0000 (14:55 +0200)] 
Merge pull request #28914 from poettering/boot-poweroff

sd-boot: add quick hotkeys for poweroff/reboot

9 months agocore: simplify get_process_umask() invocation
Lennart Poettering [Tue, 22 Aug 2023 08:35:53 +0000 (10:35 +0200)] 
core: simplify get_process_umask() invocation

9 months agomount-tool: override mode of --tmpfs mounts to (rwxrwxrwx & ~umask) 28913/head
Zbigniew Jędrzejewski-Szmek [Mon, 21 Aug 2023 17:32:21 +0000 (19:32 +0200)] 
mount-tool: override mode of --tmpfs mounts to (rwxrwxrwx & ~umask)

The kernel default for tmpfs mounts is rwxrwxrwt, i.e. world-writable with the
sticky bit set. This makes sense for /tmp and /var/tmp, but less so for other
directories. Users will not use systemd-mount to mount /tmp and /var/tmp, so
the existing behaviour is surprising. The defaults are overriden to the
same defaults we use for "internal tmpfs mounts", i.e. no sticky bit, nosuid,
nodev, and limits of size=10%, nr_inodes=400k.

--tmpfs is new, so we can modify the behaviour without breaking compatibility.

9 months agobasic/umask-util: drop clearing of unused bits in call to umask(2)
Zbigniew Jędrzejewski-Szmek [Mon, 21 Aug 2023 18:44:05 +0000 (20:44 +0200)] 
basic/umask-util: drop clearing of unused bits in call to umask(2)

umask(2) says that the kernel does this exact operation on its own, so
we can drop if from our call.

9 months agotest-umask-util: add test for get_process_umask()
Zbigniew Jędrzejewski-Szmek [Mon, 21 Aug 2023 18:25:13 +0000 (20:25 +0200)] 
test-umask-util: add test for get_process_umask()

It didn't have any test, and here we're setting umask, so we can add
the test for free.

9 months agonetwork: fix log message and man page for HopLimit=
Yu Watanabe [Tue, 22 Aug 2023 06:49:49 +0000 (15:49 +0900)] 
network: fix log message and man page for HopLimit=

Follow-up for 88c0642358398240a54d242e812439fcd0564b05.
Closes #28899.

9 months agoupdate TODO 28914/head
Lennart Poettering [Mon, 21 Aug 2023 21:27:21 +0000 (23:27 +0200)] 
update TODO

9 months agoboot: add control-less alias for Ctrl-l hotkey
Lennart Poettering [Tue, 22 Aug 2023 09:28:10 +0000 (11:28 +0200)] 
boot: add control-less alias for Ctrl-l hotkey

I couldn't get ctrl work properly over serial line/qemu. Hence, let's
add an alias for Ctrl-l: a simple Shift-l (i.e. uppercase L)

(Note that lowercase L will result in selection of the first Linux
entry, hence we stay away from that)

9 months agoboot: add hotkeys for rebooting/powering off the system from the boot menu
Lennart Poettering [Mon, 21 Aug 2023 20:59:53 +0000 (22:59 +0200)] 
boot: add hotkeys for rebooting/powering off the system from the boot menu

In a an environment with a serial console it's just too useful to
directly reboot/power off the machine without any further tooling.

9 months agoboot: modernize mangle_stub_cmdline() a bit + drop leading whitespace
Lennart Poettering [Mon, 21 Aug 2023 16:37:46 +0000 (18:37 +0200)] 
boot: modernize mangle_stub_cmdline() a bit + drop leading whitespace

Let's modernize the function a bit, and make it return the string passed
in, as we usually do.

Most importanly though: also drop leading whitespace, not just trailing
whitespace.

9 months agoboot: explain why we refuse to edit kernel cmdline when we do so
Lennart Poettering [Mon, 21 Aug 2023 20:56:07 +0000 (22:56 +0200)] 
boot: explain why we refuse to edit kernel cmdline when we do so

9 months agoMerge pull request #28903 from poettering/verbs-levenshtein
Lennart Poettering [Tue, 22 Aug 2023 08:15:00 +0000 (10:15 +0200)] 
Merge pull request #28903 from poettering/verbs-levenshtein

verbs: give helpful hint when people mistype command verbs on the cmdline of our tools

9 months agomount-tool: reduce scope of iterator variables
Zbigniew Jędrzejewski-Szmek [Mon, 21 Aug 2023 09:56:04 +0000 (11:56 +0200)] 
mount-tool: reduce scope of iterator variables

9 months agoinetwork/address-pool: also check queued addresses 28917/head
Yu Watanabe [Tue, 22 Aug 2023 03:22:13 +0000 (12:22 +0900)] 
inetwork/address-pool: also check queued addresses

After 0a0c2672dbd22dc85d660e5baa7e1bef701beb88, acquired and queued
addresses are not directly saved into Link object, but it will be saved
later the addresses are really assigned to the interface. So, when
searching free address space, we also need to check the queued
addresses.

9 months agonetwork/address-pool: split-out address_intersect()
Yu Watanabe [Tue, 22 Aug 2023 03:14:40 +0000 (12:14 +0900)] 
network/address-pool: split-out address_intersect()

No functional change, just refactoring and preparation for later
commits.

9 months agotest-execute: add tests for credentials directory with mount namespace 28787/head
Yu Watanabe [Sat, 12 Aug 2023 13:08:47 +0000 (22:08 +0900)] 
test-execute: add tests for credentials directory with mount namespace

This also adds cases that open_tree() and move_mount() are filtered, to
emulate old kernel behavior.

9 months agocore: do not leak mount for credentials directory if mount namespace is enabled
Yu Watanabe [Sat, 12 Aug 2023 06:18:41 +0000 (15:18 +0900)] 
core: do not leak mount for credentials directory if mount namespace is enabled

Since kernel v5.2, open_tree() and move_mount() are added. If a service
loads or sets credentials, then let's try to clone the mount that contains
credentials with open_tree(), then mount it after a (private) mount
namespace is initialized for the service. Then, we can setup a mount for
credentials directory without leaking it to the main shared mount
namespace.

With this change, the credentials for services that request their own
private mount namespace become much much safer. And, the number of mount
events triggered by setting up credential directories can be decreased.

Unfortunately, this does not 'fix' the original issue #25527, as the
reported service does not requests private mount namespace, but the
situation should be better now.

9 months agocore/credential: make setup_credentials() return path to credentials directory
Yu Watanabe [Thu, 10 Aug 2023 06:55:25 +0000 (15:55 +0900)] 
core/credential: make setup_credentials() return path to credentials directory

Then, we can reuse the path when building environment variables and setting up
mount namespace.
No functional change, just refactoring.

9 months agocore: set $CREDENTIALS_DIRECTORY only when we set up credentials
Yu Watanabe [Sat, 12 Aug 2023 06:25:03 +0000 (15:25 +0900)] 
core: set $CREDENTIALS_DIRECTORY only when we set up credentials

It is not necessary to set the environment variable on an execution step
we do not support credentials.

9 months agocore/credential: split out unit_add_default_credential_dependencies()
Yu Watanabe [Sat, 12 Aug 2023 06:06:43 +0000 (15:06 +0900)] 
core/credential: split out unit_add_default_credential_dependencies()

No functional change, just refactoring.

9 months agocore: split out functions and definitions from execute.[ch] to credential.[ch]
Yu Watanabe [Thu, 10 Aug 2023 03:52:13 +0000 (12:52 +0900)] 
core: split out functions and definitions from execute.[ch] to credential.[ch]

The functions and definitions related to credential consume about 1000
lines in execute.c. Let's split out them to dedicated files.

9 months agoverbs: make a helpful suggestion when user types unrecognized verb 28903/head
Lennart Poettering [Mon, 21 Aug 2023 12:44:29 +0000 (14:44 +0200)] 
verbs: make a helpful suggestion when user types unrecognized verb

I have been mistyping commands too often myself, and I think the tools
could simply be more helpful, by suggesting to me what I probably wanted
to write. Copy/Paste FTW, after all!

9 months agostring-util: add a function to determine levenshtein distance of two strings
Lennart Poettering [Mon, 21 Aug 2023 11:38:03 +0000 (13:38 +0200)] 
string-util: add a function to determine levenshtein distance of two strings

9 months agoefi: add comment clarifying we should not use EV_IPL anymore
Lennart Poettering [Mon, 21 Aug 2023 16:38:18 +0000 (18:38 +0200)] 
efi: add comment clarifying we should not use EV_IPL anymore

9 months agoman: mention two more things logind does
Lennart Poettering [Mon, 21 Aug 2023 12:46:56 +0000 (14:46 +0200)] 
man: mention two more things logind does

Prompted by: #28902

9 months agoMerge pull request #28907 from poettering/have-seccomp-tweaks
Lennart Poettering [Mon, 21 Aug 2023 21:15:39 +0000 (23:15 +0200)] 
Merge pull request #28907 from poettering/have-seccomp-tweaks

reduce HAVE_SECCOMP ifdeffery

9 months agotree-wide: drop "static inline" use in .c files
Lennart Poettering [Mon, 21 Aug 2023 16:27:12 +0000 (18:27 +0200)] 
tree-wide: drop "static inline" use in .c files

"static inline" makes sense in .h files. But in .c files it's useless
decoration, the compiler should just make its own decisions there, and
it can do that.

hence, replace all remaining uses of "static line" by a simple" static"
in all .c files (but keep them in .h files, where they make sense)

9 months agomount-tool,man: reword comments and error messages
Zbigniew Jędrzejewski-Szmek [Mon, 21 Aug 2023 09:49:14 +0000 (11:49 +0200)] 
mount-tool,man: reword comments and error messages

We were consistenly using --umount everywhere, but add a comment to make this
clearer. Also, reword a few things for clarity.