]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
23 months agotmpfiles: always list tmpfiles line types in same order
Lennart Poettering [Thu, 4 Jan 2024 13:57:59 +0000 (14:57 +0100)] 
tmpfiles: always list tmpfiles line types in same order

otherwise it just gets too confusing to follow.

2 years agoexecute: make sure Type=exec and PAMName= work together
Lennart Poettering [Wed, 29 Nov 2023 11:49:37 +0000 (12:49 +0100)] 
execute: make sure Type=exec and PAMName= work together

If PAMName= is used we'll spawn a PAM session for the service, and leave
a process around that closes the PAM session eventually. That process
must close the "exec_fd" that we use to implement Type=exec. After all
the logic relies on the fact that execve() will implicitly close the
exec_fd, and the EOF seen on it is hence indication for the service
manager that execve() has worked. But if we keep an fd open in the PAM
service process, then this is not going to work.

Hence close the fd explicitly so that it definitely doesn't stay pinned
in the child.

2 years agoFix typo in verb_make_policy explanation
Alberto Planas [Thu, 4 Jan 2024 12:32:59 +0000 (13:32 +0100)] 
Fix typo in verb_make_policy explanation

Signed-off-by: Alberto Planas <aplanas@suse.com>
2 years agoMerge pull request #30725 from YHNdnzj/string-util
Mike Yuan [Thu, 4 Jan 2024 12:34:41 +0000 (20:34 +0800)] 
Merge pull request #30725 from YHNdnzj/string-util

string-util,strv: follow-ups

2 years agonetwork/netdev: call done() per netdev kind before freeing netdev name or so
Yu Watanabe [Wed, 3 Jan 2024 19:10:31 +0000 (04:10 +0900)] 
network/netdev: call done() per netdev kind before freeing netdev name or so

Otherwise, log_netdev_xyz() does not provide netdev name if it is called
in done(). It is hard to debug.

This should not change any effective behavior, at least with the current
implementation of done() per netdev kind.

2 years agotpm2-generator: sort includes
Mike Yuan [Thu, 4 Jan 2024 08:53:45 +0000 (16:53 +0800)] 
tpm2-generator: sort includes

2 years agologind: use FOREACH_ARRAY() where appropriate
Lennart Poettering [Mon, 27 Nov 2023 15:55:31 +0000 (16:55 +0100)] 
logind: use FOREACH_ARRAY() where appropriate

2 years agoMerge pull request #30513 from rpigott/resolved-ede
Lennart Poettering [Thu, 4 Jan 2024 08:59:19 +0000 (09:59 +0100)] 
Merge pull request #30513 from rpigott/resolved-ede

resolved: support RFC 8914 EDE error codes

2 years agostrv: rename strv_endswith to endswith_strv and dedup ENDSWITH_SET 30725/head
Mike Yuan [Thu, 4 Jan 2024 08:45:54 +0000 (16:45 +0800)] 
strv: rename strv_endswith to endswith_strv and dedup ENDSWITH_SET

2 years agostring-util: move startswith_strv to strv
Mike Yuan [Thu, 4 Jan 2024 08:44:15 +0000 (16:44 +0800)] 
string-util: move startswith_strv to strv

2 years agostring-util: use strneq
Mike Yuan [Thu, 4 Jan 2024 08:48:42 +0000 (16:48 +0800)] 
string-util: use strneq

2 years agostring-util-fundamental: postfix -> suffix, use streq
Mike Yuan [Thu, 4 Jan 2024 08:30:10 +0000 (16:30 +0800)] 
string-util-fundamental: postfix -> suffix, use streq

2 years agoresolved: add transaction result for upstream failures 30513/head
Ronan Pigott [Fri, 22 Dec 2023 04:50:45 +0000 (21:50 -0700)] 
resolved: add transaction result for upstream failures

This new transaction result is emitted when the upstream server
indicates a fatal error that we will not try to recover from.

Currently, it is emitted when a validating recursive resolver reports an
error validating dnssec records for a domain. The extended error message
should help give context to the admin.

2 years agoresolved: support RFC 8914 EDE error codes
Ronan Pigott [Mon, 18 Dec 2023 05:33:31 +0000 (22:33 -0700)] 
resolved: support RFC 8914 EDE error codes

If the server is able to indicate an extended error to us, using a
degraded feature set is unlikely to help.

2 years agoresolved: delay server feature detection
Ronan Pigott [Wed, 20 Dec 2023 22:16:41 +0000 (15:16 -0700)] 
resolved: delay server feature detection

Some fields of the DnsPacket are not populated until we extract an
answer, like p->opt, despite being referenced by macros like
DNS_PACKET_RCODE. We can reorder some of the basic checks to follow
dns_packet_extract.

2 years agodns: remove some magic numbers
Ronan Pigott [Mon, 18 Dec 2023 04:30:03 +0000 (21:30 -0700)] 
dns: remove some magic numbers

Let's use enum values for the EDNS codes now that we have them, for
readability.

2 years agodns: introduce more EDNS codes from IANA
Ronan Pigott [Mon, 18 Dec 2023 00:41:47 +0000 (17:41 -0700)] 
dns: introduce more EDNS codes from IANA

2 years agoMerge pull request #26663 from poettering/vpick
Lennart Poettering [Wed, 3 Jan 2024 21:17:32 +0000 (22:17 +0100)] 
Merge pull request #26663 from poettering/vpick

add new "vpick" concept for automatically picking newest resource from .v/ dir containing versioned files

2 years agoMerge pull request #28797 from Werkov/eff_limits
Yu Watanabe [Wed, 3 Jan 2024 20:38:06 +0000 (05:38 +0900)] 
Merge pull request #28797 from Werkov/eff_limits

Add MemoryMaxEffective=, MemoryHighEffective= and TasksMaxEff…  …ective= properties

2 years agologind: don't setup idle session watch for lock-screen and greeter
Michal Sekletar [Tue, 12 Dec 2023 18:03:39 +0000 (19:03 +0100)] 
logind: don't setup idle session watch for lock-screen and greeter

Reason to skip the idle session logic for these session classes is that
they are idle by default.

2 years agobasic: fix overflow detection in sigbus_pop
Rose [Tue, 2 Jan 2024 15:13:27 +0000 (10:13 -0500)] 
basic: fix overflow detection in sigbus_pop

The current check checks for n_sigbus_queue
being greater than or equal to SIGBUS_QUEUE_MAX,
when it should be just greater than as
n_sigbus_queue being SIGBUS_QUEUE_MAX indicates
that the queue is full, but not overflowed.

2 years agoMerge pull request #30710 from YHNdnzj/logind-ret-gather
Yu Watanabe [Wed, 3 Jan 2024 20:25:41 +0000 (05:25 +0900)] 
Merge pull request #30710 from YHNdnzj/logind-ret-gather

logind-session: modernization

2 years agotest: temporarily adjust the default mount rate limit
Frantisek Sumsal [Wed, 3 Jan 2024 18:00:39 +0000 (19:00 +0100)] 
test: temporarily adjust the default mount rate limit

(Hopefully) a temporary workaround for #30573 where starting a user
session when PID 1 is rate limited stalls even after it leaves the rate
limited state:

[   11.658201] H systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=UnitRemoved cookie=4208 reply_cookie=0 signature=so error-name=n/a error-mes>
[   11.658233] H systemd[1]: Event source 0x559babdd8bb0 (mount-monitor-dispatch) left rate limit state.
[  101.562697] H busctl[784]: Failed to get credentials: Transport endpoint is not connected
[  101.563480] H systemd[1]: systemd-journald.service: Got notification message from PID 300 (WATCHDOG=1)
[  101.563725] H testsuite-74.sh[784]: BusAddress=unixexec:path=systemd-run,argv1=-M.host,argv2=-PGq,argv3=--wait,argv4=-pUser%3dtestuser,argv5=-pPAMName%3dlogin,argv6=systemd-stdio-bridge,argv7=-punix:path%3d%24%7bXDG_RUNTIME_DIR%7d/bus
[  101.564136] H systemd[1]: Successfully forked off '(sd-expire)' as PID 787.
[  101.564754] H systemd[1]: Successfully forked off '(sd-expire)' as PID 788.
[  101.564831] H testsuite-74.sh[381]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/testsuite-74.busctl.sh failed'

The issue appeared after ee07fff03b which does a bunch of mounts/umounts
that get PID 1 into a rate limited state, and is frequent enough to be
annoying, so let's temporarily bump the rate limit to alleviate that.

2 years agotest: install correct kpartx udev rules on Debian
Frantisek Sumsal [Wed, 3 Jan 2024 16:24:03 +0000 (17:24 +0100)] 
test: install correct kpartx udev rules on Debian

Resolves: #30703

2 years agoMerge pull request #30532 from yuwata/udev-extend-timeout-kill-worker
Yu Watanabe [Wed, 3 Jan 2024 20:21:50 +0000 (05:21 +0900)] 
Merge pull request #30532 from yuwata/udev-extend-timeout-kill-worker

udev: extend timeout to prevent kill worker

2 years agoMerge pull request #28836 from msekletar/aux-scope
Yu Watanabe [Wed, 3 Jan 2024 19:52:39 +0000 (04:52 +0900)] 
Merge pull request #28836 from msekletar/aux-scope

core/manager: add dbus API to create auxiliary scope from running service

2 years agoFix KeepCarrier tun/tap device option
Dmitry Konishchev [Sat, 16 Dec 2023 16:41:57 +0000 (19:41 +0300)] 
Fix KeepCarrier tun/tap device option

When KeepCarrier is set, networkd doesn't close tun/tap file descriptor
preserving the active interface state, but doesn't disable its queue
which makes kernel to think that it's still active and send packets to
it.

This patch disables the created queue right after tun/tap interface
creation.

Here is the steps to reproduce the bug:

Having:

systemd/network/10-tun-test.netdev:

    [NetDev]
    Name=tun-test
    Kind=tun

    [Tun]
    MultiQueue=yes
    KeepCarrier=yes

systemd/network/10-tun-test.network:

    [Match]
    Name=tun-test

    [Network]
    DHCP=no
    IPv6AcceptRA=false

    LLMNR=false
    MulticastDNS=false

    Address=172.31.0.1/24

app.c:

    #include <fcntl.h>
    #include <stdio.h>
    #include <string.h>
    #include <unistd.h>
    #include <linux/if.h>
    #include <sys/ioctl.h>
    #include <linux/if_tun.h>

    int main() {
        int fd;
        struct ifreq ifr;

        memset(&ifr, 0, sizeof ifr);
        strcpy(ifr.ifr_name, "tun-test");
        ifr.ifr_flags = IFF_TUN | IFF_NO_PI | IFF_MULTI_QUEUE;

        if((fd = open("/dev/net/tun", O_RDWR)) < 0) {
            perror("Open error");
            return 1;
        }

        if(ioctl(fd, TUNSETIFF, &ifr)) {
            perror("Configure error");
            return 1;
        }

        puts("Ready.");

        char buf[1500];

        while(1) {
            int size = read(fd, buf, sizeof buf);
            if(size < 0) {
                perror("Read error");
                return 1;
            }
            printf("Read %d bytes.\n", size);
        }

        return 0;
    }

Run:
* gcc -o app app.c && ./app
* ping -I tun-test 172.31.0.2

Before the patch the app shows no pings, but after it works properly.

2 years agoupdate TODO 26663/head
Lennart Poettering [Fri, 3 Mar 2023 17:55:18 +0000 (18:55 +0100)] 
update TODO

2 years agotests: add integration tests for vpick logic
Lennart Poettering [Thu, 16 Nov 2023 15:40:54 +0000 (16:40 +0100)] 
tests: add integration tests for vpick logic

2 years agoman: document the new vpick concept
Lennart Poettering [Thu, 16 Nov 2023 10:31:02 +0000 (11:31 +0100)] 
man: document the new vpick concept

2 years agodiscover-image: add support for vpick
Lennart Poettering [Wed, 15 Nov 2023 17:36:24 +0000 (18:36 +0100)] 
discover-image: add support for vpick

2 years agoexecute: teach RootDirectory= and RootImage= the new vpick logic
Lennart Poettering [Mon, 13 Nov 2023 17:01:19 +0000 (18:01 +0100)] 
execute: teach RootDirectory= and RootImage= the new vpick logic

2 years agodissect: port to vpick for selecting image
Lennart Poettering [Tue, 20 Jun 2023 20:05:53 +0000 (22:05 +0200)] 
dissect: port to vpick for selecting image

2 years agonspawn: hook up --image=/--directory=/--template= with vpick logic
Lennart Poettering [Fri, 3 Mar 2023 17:25:37 +0000 (18:25 +0100)] 
nspawn: hook up --image=/--directory=/--template= with vpick logic

2 years agovpick: add new tool "systemd-vpick" which exposes vpick on the command line
Lennart Poettering [Fri, 3 Mar 2023 17:26:45 +0000 (18:26 +0100)] 
vpick: add new tool "systemd-vpick" which exposes vpick on the command line

Usecase:

    $ du $(systemd-vpick /srv/myimages.v/foo___.raw)

In order to determine size of newest image in /srv/myimages.v/

2 years agoshared: add new "vpick" concept for ".v/" directories that contain versioned resources
Lennart Poettering [Fri, 3 Mar 2023 17:18:05 +0000 (18:18 +0100)] 
shared: add new "vpick" concept for ".v/" directories that contain versioned resources

This adds a new concept for handling paths. At appropriate places, if a
path such as /foo/bar/baz.v/ is specified, we'll
automatically enumerate all entries in /foo/bar/baz.v/baz* and then
do a version sort and pick the newest file.

A slightly more complex syntax is available, too:

/foo/bar/baz.v/quux___waldo

if that's used, then we'll look for all files matching
/foo/bar/baz.v/quux*waldo, and split out the middle, and version sort
it, and pick the nwest.

The ___ wildcard indicates both a version string, and if needed an
architecture ID, in case per-arch entries shall be supported.

This is a very simple way to maintain versioned resources in a dir, and
make systemd's components automatically pick the newest. Example:

    /srv/myimages.v/foobar_1.32.65_x86-64.raw
    /srv/myimages.v/foobar_1.33.45_x86-64.raw
    /srv/myimages.v/foobar_1.31.5_x86-64.raw
    /srv/myimages.v/foobar_1.31.5_arm64.raw

If now nspawn is invoked like this:

    systemd-nspawn --image=/srv/myimages.v/foobar___.raw

Then it will automatically pick
/srv/myimages.v/foobar_1.33.45_x86-64.raw as the version to boot on
x86-64, and /srv/myimages.v/foobar_1.31.5_arm64.raw on arm64.

This commit only adds the basic implementation for picking files from a
dir, but no hook-up anywhere.

2 years agostat-util: add inode_type_from_string() helper
Lennart Poettering [Tue, 20 Jun 2023 14:18:37 +0000 (16:18 +0200)] 
stat-util: add inode_type_from_string() helper

2 years agostring-util: add strrstr() helper
Lennart Poettering [Fri, 3 Mar 2023 13:01:02 +0000 (14:01 +0100)] 
string-util: add strrstr() helper

2 years agostrv: add new strv_endswith() helper
Lennart Poettering [Wed, 15 Nov 2023 15:55:22 +0000 (16:55 +0100)] 
strv: add new strv_endswith() helper

2 years agoMerge pull request #29940 from poettering/stub-confext-pickup
Lennart Poettering [Wed, 3 Jan 2024 16:40:36 +0000 (17:40 +0100)] 
Merge pull request #29940 from poettering/stub-confext-pickup

stub/sysext: pick up confexts from ESP, too

2 years agoMerge pull request #30194 from poettering/tpm-target
Lennart Poettering [Wed, 3 Jan 2024 16:40:17 +0000 (17:40 +0100)] 
Merge pull request #30194 from poettering/tpm-target

units: add a tpm2.target synchronization point and small generator that pulls in

2 years agologind-session: use RET_GATHER more 30710/head
Mike Yuan [Wed, 3 Jan 2024 15:18:46 +0000 (23:18 +0800)] 
logind-session: use RET_GATHER more

2 years agologind-session-device: trivial modernizations
Mike Yuan [Wed, 3 Jan 2024 15:15:14 +0000 (23:15 +0800)] 
logind-session-device: trivial modernizations

2 years agolabeler: add matches for login and logind
Mike Yuan [Wed, 3 Jan 2024 14:09:52 +0000 (22:09 +0800)] 
labeler: add matches for login and logind

2 years agoMerge pull request #30704 from yuwata/sd-dhcp-server-lease
Lennart Poettering [Wed, 3 Jan 2024 12:58:30 +0000 (13:58 +0100)] 
Merge pull request #30704 from yuwata/sd-dhcp-server-lease

dhcp-server: use sd_dhcp_client_id and split out lease handling to sd-dhcp-server-lease.[ch]

2 years agoMerge pull request #30697 from yuwata/network-address-remove-and-cancel
Lennart Poettering [Wed, 3 Jan 2024 12:55:26 +0000 (13:55 +0100)] 
Merge pull request #30697 from yuwata/network-address-remove-and-cancel

network/address: several cleanups for address removal

2 years agotpm2-util: handle TPMs gracefully that do not support ECC and return TPM2_RC_VALUES
Lennart Poettering [Tue, 2 Jan 2024 17:33:37 +0000 (18:33 +0100)] 
tpm2-util: handle TPMs gracefully that do not support ECC and return TPM2_RC_VALUES

If a TPM doesn't do ECC it could either return zero curves when asked
for it, or it could simply fail with TPM2_RC_VALUES because it doesn't
recognize the capability at all.

Handle both cases the same way.

Fixes: #30679
2 years agotests: add test for StartAuxiliaryScope() 28836/head
Michal Sekletar [Mon, 30 Oct 2023 11:12:28 +0000 (12:12 +0100)] 
tests: add test for StartAuxiliaryScope()

2 years agocore/manager: add dbus API to create auxiliary scope from running service
Michal Sekletar [Mon, 30 Oct 2023 11:08:59 +0000 (12:08 +0100)] 
core/manager: add dbus API to create auxiliary scope from running service

This commit introduces new D-Bus API, StartAuxiliaryScope(). It may be
used by services as part of the restart procedure. Service sends an
array of PID file descriptors corresponding to processes that are part
of the service and must continue running also after service restarts,
i.e. they haven't finished the job why they were spawned in the first
place (e.g. long running video transcoding job). Systemd creates new
scope unit for these processes and migrates them into it. Cgroup
properties of scope are copied from the service so it retains same
cgroup settings and limits as service had.

2 years agoupdate TODO 30194/head
Lennart Poettering [Fri, 24 Nov 2023 17:05:16 +0000 (18:05 +0100)] 
update TODO

2 years agounits: add a tpm2.target synchronization point and small generator that pulls in
Lennart Poettering [Fri, 24 Nov 2023 17:01:56 +0000 (18:01 +0100)] 
units: add a tpm2.target synchronization point and small generator that pulls in

Distributions apparently only compile a subset of TPM2 drivers into the
kernel. For those not compiled it but provided as kmod we need a
synchronization point: we must wait before the first TPM2 interaction
until the driver is available and accessible.

This adds a tpm2.target unit as such a synchronization point. It's
ordered after /dev/tpmrm0, and is pulled in by a generator whenever we
detect that the kernel reported a TPM2 to exist but we have no device
for it yet.

This should solve the issue, but might create problems: if there are TPM
devices supported by firmware that we don't have Linux drivers for we'll
hang for a bit. Hence let's add a kernel cmdline switch to disable (or
alternatively force) this logic.

Fixes: #30164
2 years agotest-64: only look at plugged devices, not all of them
Lennart Poettering [Wed, 29 Nov 2023 21:34:34 +0000 (22:34 +0100)] 
test-64: only look at plugged devices, not all of them

2 years agocgroup: Restrict effective limits with global resource provision 28797/head
Michal Koutný [Mon, 14 Aug 2023 17:59:57 +0000 (19:59 +0200)] 
cgroup: Restrict effective limits with global resource provision

Global resource (whole system or root cg's (e.g. in a container)) is
also a well-defined limit for memory and tasks, take it into account
when calculating effective limits.

2 years agotest: Add effective cgroup limits testing
Michal Koutný [Wed, 9 Aug 2023 20:43:31 +0000 (22:43 +0200)] 
test: Add effective cgroup limits testing

2 years agotest: Convert rlimit test to subtest of generic limit testing
Michal Koutný [Wed, 9 Aug 2023 20:42:36 +0000 (22:42 +0200)] 
test: Convert rlimit test to subtest of generic limit testing

No functional change intended. Preparation for new tests.

2 years agocgroup: Add EffectiveMemoryMax=, EffectiveMemoryHigh= and EffectiveTasksMax= properties
Michal Koutný [Fri, 11 Aug 2023 11:51:20 +0000 (13:51 +0200)] 
cgroup: Add EffectiveMemoryMax=, EffectiveMemoryHigh= and EffectiveTasksMax= properties

Users become perplexed when they run their workload in a unit with no
explicit limits configured (moreover, listing the limit property would
even show it's infinity) but they experience unexpected resource
limitation.

The memory and pid limits come as the most visible, therefore add new
unit read-only properties:
- EffectiveMemoryMax=,
- EffectiveMemoryHigh=,
- EffectiveTasksMax=.

These properties represent the most stringent limit systemd is aware of
for the given unit -- and that is typically(*) the effective value.

Implement the properties by simply traversing all parents in the
leaf-slice tree and picking the minimum value. Note that effective
limits are thus defined even for units that don't enable explicit
accounting (because of the hierarchy).

(*) The evasive case is when systemd runs in a cgroupns and cannot
reason about outer setup. Complete solution would need kernel support.

2 years agoresolve/mdns: do not append goodby packet entries to known answers section
Yu Watanabe [Tue, 2 Jan 2024 19:36:47 +0000 (04:36 +0900)] 
resolve/mdns: do not append goodby packet entries to known answers section

When we receive a goodby packet about a host, and we have a cache entry about
the host, we do not immediately remove the cache entry, but update it with TTL 1.
See RFC 6762 section 10.1 and 3755027c2cada70345c96787a9b5569994dd23ed.

If we receive a request soon after the goodby packet, previously the
entry was included in the known answers section of the reply. But such
information should not be appended.

Follow-up for 3755027c2cada70345c96787a9b5569994dd23ed.

2 years agoMerge pull request #30694 from yuwata/sd-netlink-move-macro-and-introduce-tos-getter
Mike Yuan [Wed, 3 Jan 2024 10:47:12 +0000 (18:47 +0800)] 
Merge pull request #30694 from yuwata/sd-netlink-move-macro-and-introduce-tos-getter

sd-netlink: two cleanups

2 years agoMerge pull request #30686 from poettering/uki-measured-check-imply-tpm2
Mike Yuan [Wed, 3 Jan 2024 10:39:22 +0000 (18:39 +0800)] 
Merge pull request #30686 from poettering/uki-measured-check-imply-tpm2

efi-loader: when detecting if we are booted in UKI measured boot mode, imply a check for TPM2

2 years agoconfext: make sure we pick up configuration extensions passed to us from the stub 29940/head
Lennart Poettering [Wed, 8 Nov 2023 18:10:44 +0000 (19:10 +0100)] 
confext: make sure we pick up configuration extensions passed to us from the stub

With fixes from Maanya Goenka.

2 years agostub: pick up confexts from the ESP as well
Lennart Poettering [Wed, 8 Nov 2023 18:02:03 +0000 (19:02 +0100)] 
stub: pick up confexts from the ESP as well

This does what we do for system extension also for configuration
extension.

This is complicated by the fact that we previously looked for
<uki-binary>.d/*.raw for system extensions. We want to measure sysexts
and confexts to different PCRs (13 vs. 12) hence we must distinguish
them, but *.raw would match both kinds.

This commit solves this via the following mechanism: we'll load confexts
from *.confext.raw and sysexts from *.raw but will then enclude
*.confext.raw from the latter. This preserves compatibility but allows
us to somewhat reasonable distinguish both types of images.

The documentation is updated not going into this detail though, and
instead now claims that sysexts shall be *.sysext.raw and confexts
*.confext.raw even though we actually are more lenient than this. This
is simply to push people towards using the longer, more descriptive
suffixes.

I added an XML comment (<!-- … -->) about this to the docs, so that
whenever somebody notices the difference between code and docs
understands why and leaves it that way.

2 years agosd-dhcp-server: rename DHCPLease -> sd_dhcp_server_lease 30704/head
Yu Watanabe [Tue, 2 Jan 2024 21:06:45 +0000 (06:06 +0900)] 
sd-dhcp-server: rename DHCPLease -> sd_dhcp_server_lease

Then, move basic functions for the object to sd-dhcp-server-lease.[ch].

No effective funcional changes.

2 years agosd-dhcp-server: use sd_dhcp_client_id
Yu Watanabe [Tue, 2 Jan 2024 21:06:42 +0000 (06:06 +0900)] 
sd-dhcp-server: use sd_dhcp_client_id

2 years agofundamental: prefer byte swap builtins over byte swapping manually
Rose [Tue, 2 Jan 2024 20:24:58 +0000 (15:24 -0500)] 
fundamental: prefer byte swap builtins over byte swapping manually

This builtin reduces complexity and GCC/Clang have supported these builtins for a long time.

2 years agoMerge pull request #30702 from yuwata/sd-dhcp-client-id
Yu Watanabe [Wed, 3 Jan 2024 06:10:46 +0000 (15:10 +0900)] 
Merge pull request #30702 from yuwata/sd-dhcp-client-id

dhcp: introduce sd_dhcp_client_id and relevant functions

2 years agobacklight: supprt ID_LEDS_CLAMP udev property for leds subsystem devices
Yu Watanabe [Tue, 2 Jan 2024 19:22:27 +0000 (04:22 +0900)] 
backlight: supprt ID_LEDS_CLAMP udev property for leds subsystem devices

Closes #30507.

2 years agoudev/dmi-memory-id: update table with latest SMBIOS specification
Yu Watanabe [Tue, 2 Jan 2024 20:54:12 +0000 (05:54 +0900)] 
udev/dmi-memory-id: update table with latest SMBIOS specification

Closes #30699.

2 years agoMerge pull request #30700 from yuwata/storagetm-fixlets
Yu Watanabe [Tue, 2 Jan 2024 23:42:58 +0000 (08:42 +0900)] 
Merge pull request #30700 from yuwata/storagetm-fixlets

storagetm: several trivial fixlets

2 years agonetwork/route: drop TTL propagate support for MPLS routes
Yu Watanabe [Sun, 31 Dec 2023 22:06:58 +0000 (07:06 +0900)] 
network/route: drop TTL propagate support for MPLS routes

This effectively reverts 9b88f20aba6a78baf18d89e99ff31d5ee40856b8.

We do not support MPLS routes, only IPv4 or IPv6 routes are supported.

2 years agonetwork/queue: fix potential double-free on oom
Yu Watanabe [Tue, 2 Jan 2024 19:19:33 +0000 (04:19 +0900)] 
network/queue: fix potential double-free on oom

Currently, link_queue_request_safe(), which is a wrapper of
request_new(), is called with a free function at
- link_request_stacked_netdev() at netdev/netdev.c,
- link_request_address() at networkd-address.c,
- link_request_nexthop() at networkd-nexthop.c,
- link_request_neighbor() at networkd-networkd.c.

For the netdev case, the reference counter of the passed object is increased
only when the function returns 1. So, on failure (with -ENOMEM)
previously we unexpectedly dropped the reference of the NetDev object.
Similarly, for Address and friends, the ownership of the object is moved to the
Request object only when the function returns 1. And on failure, previously
the object was freed twice.

Also, netdev_queue_request(), which is another wrapper of request_new()
potentially leaks memory when the same NetDev object is queued twice.
Fortunately, that should not happen as the function is called only once
per object.

This fixes the above issue, and now the ownership or the reference
counter of the object is changed only when it is succeeded with 1.

2 years agoMerge pull request #30691 from yuwata/resolve-ipv6
Yu Watanabe [Tue, 2 Jan 2024 23:41:14 +0000 (08:41 +0900)] 
Merge pull request #30691 from yuwata/resolve-ipv6

resolve: do not listen to IPv6 when disabled by sysctl

2 years agotest: rewrite test-exec-deserialization.py
Frantisek Sumsal [Tue, 2 Jan 2024 17:27:45 +0000 (18:27 +0100)] 
test: rewrite test-exec-deserialization.py

Rewrite the test in bash and make it part of our integration test suite,
so it's actually executed in all our upstream CI environments.

The original test is flaky in environments where daemon-reload might
occur during the test runtime (e.g. when running the test in parallel
with the systemd-networkd test suite). Also, it was run only in CentOS
CI in limited way (i.e. without sanitizers), since it tests the host's
systemd, instead of the just built one.

Resolves: #29943

2 years agovarious: unexport a few internal structs
Mike Yuan [Tue, 2 Jan 2024 12:27:02 +0000 (20:27 +0800)] 
various: unexport a few internal structs

We don't expose destructors for these internal structs already.
Let's make the struct itself implementation detail too.

2 years agosd-dhcp-lease: use sd_dhcp_client_id 30702/head
Yu Watanabe [Tue, 2 Jan 2024 21:06:38 +0000 (06:06 +0900)] 
sd-dhcp-lease: use sd_dhcp_client_id

2 years agodhcp: move sd_dhcp_client_id_to_string() to sd-dhcp-client-id.[ch]
Yu Watanabe [Tue, 2 Jan 2024 21:06:36 +0000 (06:06 +0900)] 
dhcp: move sd_dhcp_client_id_to_string() to sd-dhcp-client-id.[ch]

Then, this makes it take sd_dhcp_client_id object, and introduce
sd_dhcp_client_id_to_string_from_raw().

2 years agodhcp: introduce sd_dhcp_client_id and relevant functions
Yu Watanabe [Tue, 2 Jan 2024 21:06:34 +0000 (06:06 +0900)] 
dhcp: introduce sd_dhcp_client_id and relevant functions

This splits out client ID handling from sd-dhcp-client.c to
sd-dhcp-client-id.[ch]. This will be used later in other places.

2 years agostoragetm: ensure we pass dev_t* to sd_device_get_devnum
Mike Gilbert [Fri, 29 Dec 2023 18:45:26 +0000 (13:45 -0500)] 
storagetm: ensure we pass dev_t* to sd_device_get_devnum

On MIPS32 OABI, st_rdev is unsigned long, not dev_t. Use a temporary
variable to avoid an incompatible pointer.

Bug: https://bugs.gentoo.org/920576
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21278
Fixes: https://github.com/systemd/systemd/issues/30626
2 years agostoragetm: fix use of wrong stat element 30700/head
Yu Watanabe [Tue, 2 Jan 2024 20:19:00 +0000 (05:19 +0900)] 
storagetm: fix use of wrong stat element

2 years agostoragetm: always hash stat.st_mode
Yu Watanabe [Tue, 2 Jan 2024 20:07:40 +0000 (05:07 +0900)] 
storagetm: always hash stat.st_mode

To make the hash function consistent with the compare function.

2 years agonetwork/address: introduce address_remove_and_cancel() 30697/head
Yu Watanabe [Tue, 2 Jan 2024 19:40:29 +0000 (04:40 +0900)] 
network/address: introduce address_remove_and_cancel()

Then, replace address_remove_and_drop() with it.

If an address is requested, and the request is already called,
we may not received its reply and notification from the kernel, and
the corresponding address object may not be remmbered. Even in such
case, we need to remove the address, otherwise the address will come
later after the function called.

2 years agonetwork/address: not necessary to remmber address before remove
Yu Watanabe [Tue, 2 Jan 2024 19:40:24 +0000 (04:40 +0900)] 
network/address: not necessary to remmber address before remove

2 years agonetwork/address: make address_remove() take Link object that the address assigned to
Yu Watanabe [Tue, 2 Jan 2024 19:40:08 +0000 (04:40 +0900)] 
network/address: make address_remove() take Link object that the address assigned to

No functional change. Preparation for later commits.

2 years agotest: update test case for failed udev event 30532/head
Yu Watanabe [Tue, 2 Jan 2024 19:23:26 +0000 (04:23 +0900)] 
test: update test case for failed udev event

2 years agoudev: wait for an extra time before the manager kills workers
Yu Watanabe [Tue, 2 Jan 2024 19:23:22 +0000 (04:23 +0900)] 
udev: wait for an extra time before the manager kills workers

Otherwise, udev workers cannot detect slow programs invoked by
IMPORT{program}=, PROGRAM=, or RUN=, and whole worker process may be
killed.

Fixes #30436.

Co-authored-by: sushmbha <sushmita.bhattacharya@oracle.com>
2 years agoudev-spawn: skip executing RUN= if exec_delay= is too long
Yu Watanabe [Tue, 2 Jan 2024 19:23:18 +0000 (04:23 +0900)] 
udev-spawn: skip executing RUN= if exec_delay= is too long

To prevent the worker process killed by the manager.

2 years agoudev-spawn: refuse to spawn commands if the event already takes too long
Yu Watanabe [Tue, 2 Jan 2024 19:23:12 +0000 (04:23 +0900)] 
udev-spawn: refuse to spawn commands if the event already takes too long

Also, calculate the timeout for warning based on the remaining time for
the timeout of the event, rather than the timeout itself.

Currently, udev manager kills the worker if the timeout exceeds. So,
this does not change anything except for the timing of the warning.

Just refactoring and preparation for later commits.

2 years agosd-netlink: introduce sd_rtnl_message_route_set_tos() 30694/head
Yu Watanabe [Tue, 2 Jan 2024 19:21:51 +0000 (04:21 +0900)] 
sd-netlink: introduce sd_rtnl_message_route_set_tos()

We already have the getter for the parameter, but forgot to introduce the setter.

2 years agosd-netlink: move definitions of RTA_TYPE() and RTA_FLAGS() to netlink-util.h
Yu Watanabe [Tue, 2 Jan 2024 19:21:28 +0000 (04:21 +0900)] 
sd-netlink: move definitions of RTA_TYPE() and RTA_FLAGS() to netlink-util.h

2 years agounit: order systemd-resolved after systemd-sysctl 30691/head
Yu Watanabe [Tue, 2 Jan 2024 19:07:11 +0000 (04:07 +0900)] 
unit: order systemd-resolved after systemd-sysctl

Otherwise, IPv6 enable/disable setting may be changed after resolved is
started.

2 years agoresolve: do not listen to IPv6 when disabled by sysctl
Yu Watanabe [Tue, 2 Jan 2024 19:03:25 +0000 (04:03 +0900)] 
resolve: do not listen to IPv6 when disabled by sysctl

Fixes #30669.

2 years agoMerge pull request #30689 from mrc0mmand/even-more-cocci-tweaks
Yu Watanabe [Tue, 2 Jan 2024 18:25:30 +0000 (03:25 +0900)] 
Merge pull request #30689 from mrc0mmand/even-more-cocci-tweaks

coccinelle: drop a couple of FIXMEs

2 years agococcinelle: add a rule for in_addr_hash_func() 30689/head
Frantisek Sumsal [Thu, 28 Dec 2023 17:02:26 +0000 (18:02 +0100)] 
coccinelle: add a rule for in_addr_hash_func()

Follow-up for c01a5c0.

2 years agococcinelle: drop a couple of FIXMEs
Frantisek Sumsal [Thu, 28 Dec 2023 16:12:24 +0000 (17:12 +0100)] 
coccinelle: drop a couple of FIXMEs

Turns out Coccinelle can handle compound literals just fine, the parsing
errors were caused by incorrectly parsed macros in code before the
literals, so let's just provide simplified versions for such macros.

The parsing error in `Type *foo[ELEMENTSOF(bar)] = {};` is actually
harmless; it occurs only when creating an array of pointers for a type
that's in an external header and it occurs only on the first parser's
pass, subsequent passes resolve the type correctly.

Also, unset ENABLE_DEBUG_HASHMAP, so Coccinelle doesn't expand the
hashmap debug macros.

As for the remaining FIXMEs, I opened a couple of issues in the
Coccinelle upstream to see if they can be fixed there (or at least
properly analyzed).

2 years agoRevert "units: add ConditionSecurity=tpm2 to systemd-tpm2-setup units" 30686/head
Lennart Poettering [Tue, 2 Jan 2024 16:40:55 +0000 (17:40 +0100)] 
Revert "units: add ConditionSecurity=tpm2 to systemd-tpm2-setup units"

Now that the ConditionSecurity=uki-measured check is tighter we can drop
the explicit TPM2 check again.

This reverts commit aa735b02196cf6f947fd1e4b2ec46b544ec7c3e1.

2 years agoefi-loader: when detecting if we are booted in UKI measured boot mode, imply a check...
Lennart Poettering [Tue, 2 Jan 2024 16:44:53 +0000 (17:44 +0100)] 
efi-loader: when detecting if we are booted in UKI measured boot mode, imply a check for TPM2

We simply don't carry any userspace support for TPM1.2 in our tree, and
we shouldn't given it's too weak by today's standards. Hence, if we
check if we are booted in UKI measured boot mode, don't just check if we
are booted in EFI, but also check that we have a TPM2 chip (as opposed
to none or only a TPM1.2 chip).

This is an alternative to #30652 but more comprehensive (and simpler),
since it covers all invocations of efi_measured_uki().

Fixes: #30650
Replaces: #30652

2 years agoMerge pull request #30684 from systemd/update-labeler-configuration
Luca Boccassi [Tue, 2 Jan 2024 12:24:48 +0000 (13:24 +0100)] 
Merge pull request #30684 from systemd/update-labeler-configuration

ci: migrate labeler configuration to the new format

2 years agoci: allow testing changes made to labeler configuration 30684/head
Frantisek Sumsal [Tue, 2 Jan 2024 11:38:09 +0000 (12:38 +0100)] 
ci: allow testing changes made to labeler configuration

2 years agoci: use a boolean value for the boolean field
Frantisek Sumsal [Tue, 2 Jan 2024 11:18:52 +0000 (12:18 +0100)] 
ci: use a boolean value for the boolean field

The issue[0] behind this workaround has been resolved[1], so we can set it
to a proper boolean field.

[0] https://github.com/systemd/systemd/issues/18671
[1] https://github.com/actions/labeler/pull/480

2 years agoci: migrate labeler configuration to the new format
Frantisek Sumsal [Tue, 2 Jan 2024 11:14:41 +0000 (12:14 +0100)] 
ci: migrate labeler configuration to the new format

Turns out updating the labeler action is a bit annoying[0], so the
breaking change wasn't detected in the version bump PR.

[0] https://github.com/actions/labeler/#notes-regarding-pull_request_target-event

Follow-up to f88c9b0728.

2 years agosd-journal: introduce cleanup function and hash ops for Directory
Yu Watanabe [Fri, 8 Dec 2023 07:01:06 +0000 (16:01 +0900)] 
sd-journal: introduce cleanup function and hash ops for Directory

This makes the folloing:
- Each Directory object now has a reference to sd-journal.
- Hence, directory_free(), which is renamed from remove_directory(), can
  be called without sd-journal as an argument.
- Introduces hash ops for Directory, so the finalization becomes
  slightly simpler.
- Allocate hashmaps that store Directory objects when necessary.
- Split out add_directory_impl().

No functional changes, just refactoring.