]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agonetwork: always check dynamic address assignments before entering configured state 19894/head
Yu Watanabe [Fri, 11 Jun 2021 11:34:17 +0000 (20:34 +0900)] 
network: always check dynamic address assignments before entering configured state

Previously (v248 or earlier), even if no static address is configured,
the link did not enter configured state, as e.g. Link::static_addresses_configured
is false until the link gained its carrier.
But, after the commit 1187fc337577cecd685d331eeab656be186ba3b2, the
situation was changed. Static addresses, routes, and etc are requested even
if the link does not have its carrier, and thus the link enters configured
state when no static address and etc are specified.

This makes the link does not enter configured state before it gains its
carrier when at least one of dynamic address assignment protocols (e.g.
DHCP) except for NDISC is enabled.

Note that, unfortunately, netplan always enables ConfigureWithoutCarrier=
for all virtual devices, e.g. bridge. See,
https://github.com/canonical/netplan/commit/978e20f902f6b92a46dc6e0050e2172e834e4617
So, we need to support e.g. the following strange config:
```
[Netowkr]
ConfigureWithoutCarrier=yes
DHCP=yes
```

Fixes #19855.

4 years agotest-network: disable dynamic addressing protocols when ConfigureWithoutCarrier=...
Yu Watanabe [Fri, 11 Jun 2021 21:47:49 +0000 (06:47 +0900)] 
test-network: disable dynamic addressing protocols when ConfigureWithoutCarrier= is enabled

4 years agotest-network: refuse routable state when no-carrier is expected
Yu Watanabe [Fri, 11 Jun 2021 21:45:49 +0000 (06:45 +0900)] 
test-network: refuse routable state when no-carrier is expected

If we do not set the maximum operstate in wait-online, then routable
state is allowed when no-carrier state is expected.

4 years agodocs: update coding style a bit
Zbigniew Jędrzejewski-Szmek [Fri, 11 Jun 2021 16:23:57 +0000 (18:23 +0200)] 
docs: update coding style a bit

Say that r should be declared at the top of the function.

Don't say that fixed buffers result in truncation, right after saying that they
must only be used if size is known.

Adjust order of examples to be consistent.

4 years agoMerge pull request #19882 from keszybz/test-stat-util-more
Zbigniew Jędrzejewski-Szmek [Fri, 11 Jun 2021 16:44:58 +0000 (18:44 +0200)] 
Merge pull request #19882 from keszybz/test-stat-util-more

Add a test for path_is_read_only_fs()

4 years agoupdate TODO
Lennart Poettering [Fri, 11 Jun 2021 14:13:49 +0000 (16:13 +0200)] 
update TODO

4 years agocore: Avoid spurious realization of unit cgroups
Michal Koutný [Thu, 10 Jun 2021 13:58:43 +0000 (15:58 +0200)] 
core: Avoid spurious realization of unit cgroups

Cgroups may be unnecessarily realized when they are not needed. This
happens, e.g. for mount units parsed from /proc/$PID/mountinfo, check

        touch /run/ns_mount
        unshare -n sh -c "mount --bind /proc/self/ns/net /run/ns_mount"
        # no cgroup exists
        file /sys/fs/cgroup/system.slice/run-ns_mount.mount
        systemctl daemon-reload
        # the vain cgroup exists
        file /sys/fs/cgroup/system.slice/run-ns_mount.mount

. (Such cgroups can account to a large number with many similar mounts.)

The code already accounts for "lazy" realization (see various checks for
Unit.cgroup_realized) but the unit_deserialize() in the reload/reexec
path performs unconditional realization.

Invalidate (and queue) the units for realization only if we know that
they were already realized in the past. This is a safe thing to do even
in the case the reload brings some new cgroup setting (controllers, BPF)
because units that aren't realized will use the updated setting when the
time for their realization comes. (It's not even needed to add a code
comment because the current formulation suggests the changed behavior.)

4 years agoman: clarify that global search domains apply to global servers, not all interfaces
Zbigniew Jędrzejewski-Szmek [Fri, 11 Jun 2021 07:13:25 +0000 (09:13 +0200)] 
man: clarify that global search domains apply to global servers, not all interfaces

Fixes #19257.

4 years agotest-stat-util: don't fail under chroot 19882/head
Zbigniew Jędrzejewski-Szmek [Thu, 10 Jun 2021 11:25:59 +0000 (13:25 +0200)] 
test-stat-util: don't fail under chroot

I wanted to see what is_path_read_only_fs() and is_path_temporary_fs() return
in a chroot, and various tests would fail. For most of our codebase, we can
assume that /proc and such are mounted, and it doesn't make sense to make the
tests work in a chroot. But let's do it here. (In general, it would be useful
for most stuff in src/basic/, since it's linked into libraries which might be
invoked in incorrectly set up environments and should not fail too badly.)

4 years agoMerge pull request #19811 from anitazha/revert_mount_rl
Luca Boccassi [Thu, 10 Jun 2021 22:41:55 +0000 (23:41 +0100)] 
Merge pull request #19811 from anitazha/revert_mount_rl

sd-event: fix failure to exit rate limiting state

4 years agoMerge pull request #19864 from keszybz/serialization-cleanup
Luca Boccassi [Thu, 10 Jun 2021 22:40:23 +0000 (23:40 +0100)] 
Merge pull request #19864 from keszybz/serialization-cleanup

Serialization cleanup

4 years agokbd-model-map: add Latvian keyboard layout mapping
nl6720 [Thu, 10 Jun 2021 06:40:04 +0000 (09:40 +0300)] 
kbd-model-map: add Latvian keyboard layout mapping

4 years agoMerge pull request #18851 from yuwata/dissect-try-to-find-partition-on-timeout
Zbigniew Jędrzejewski-Szmek [Thu, 10 Jun 2021 17:09:18 +0000 (19:09 +0200)] 
Merge pull request #18851 from yuwata/dissect-try-to-find-partition-on-timeout

dissect: try to find partition more frequently

4 years agoMerge pull request #19870 from keszybz/install-foo-again
Zbigniew Jędrzejewski-Szmek [Thu, 10 Jun 2021 16:56:03 +0000 (18:56 +0200)] 
Merge pull request #19870 from keszybz/install-foo-again

Tweak the install logic again

4 years agoMerge pull request #19878 from poettering/large-key-file-cryptsetup
Lennart Poettering [Thu, 10 Jun 2021 15:10:32 +0000 (17:10 +0200)] 
Merge pull request #19878 from poettering/large-key-file-cryptsetup

add back support for large key files to systemd-cryptsetup

4 years agodocs/CODING_STYLE: fix some typos
Štěpán Němec [Thu, 10 Jun 2021 13:27:43 +0000 (15:27 +0200)] 
docs/CODING_STYLE: fix some typos

4 years agocore/serialize: drop bogus deserialization of ipcns sockets 19864/head
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jun 2021 14:58:30 +0000 (16:58 +0200)] 
core/serialize: drop bogus deserialization of ipcns sockets

a70581ffb5c13c91c76ff73ba6f5f3ff59c5a915 added ExecRuntime.ipcns_storage_socket[], and
serialization in exec_runtime_serialize(), and deserialization in exec_runtime_deserialize_one(),
but also deserialization in exec_runtime_deserialize_compat(). exec_runtime_deserialize_compat()
is for deserializating ExecRuntime when it was serialized as part of the unit before
e8a565cb660a7a11f76180fe441ba8e4f9383771. There was never any code which would serialize
ExecRuntime.ipcns_storage_socket[] this way, so the deserialization attempts are pointless.

4 years agocore/serialization: shorten code, treat all oom error the same
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jun 2021 14:46:35 +0000 (16:46 +0200)] 
core/serialization: shorten code, treat all oom error the same

4 years agocore/serialization: drop misleadingly-named unit_can_serialize()
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jun 2021 14:30:44 +0000 (16:30 +0200)] 
core/serialization: drop misleadingly-named unit_can_serialize()

All unit types can be serialized. This function was really checking whether the
unit type has custom serialization/deserialization code. But we don't need a
function for this.

Also, the check that both .serialize() and .deserialize_item() are defined is
better written as an assert. Not we have a function which would skip
serialization/deserializaton for the unit if we forgot to set either of the
fields.

4 years agotest-stat-util: add a very basic test for test_path_is_read_only()
Zbigniew Jędrzejewski-Szmek [Thu, 10 Jun 2021 10:31:09 +0000 (12:31 +0200)] 
test-stat-util: add a very basic test for test_path_is_read_only()

4 years agotest-stat-util: add standard test logging
Zbigniew Jędrzejewski-Szmek [Thu, 10 Jun 2021 10:30:38 +0000 (12:30 +0200)] 
test-stat-util: add standard test logging

4 years agocryptsetup: improve error message when key files to load are too large 19878/head
Lennart Poettering [Thu, 10 Jun 2021 08:21:08 +0000 (10:21 +0200)] 
cryptsetup: improve error message when key files to load are too large

Let's make this easier to grok for users.

Prompted-by: #19193
4 years agofileio: bump limit for read_full_file() and friends to 64M
Lennart Poettering [Thu, 10 Jun 2021 08:19:11 +0000 (10:19 +0200)] 
fileio: bump limit for read_full_file() and friends to 64M

Apparently people use such large key files. Specifically, people used 4M
key files, and we lowered the limit from 4M to 4M-1 back in 248.

This raises the limit to 64M for read_full_file() to avoid these
specific issues and give some non-trivial room beyond the 4M files seen
IRL.

Note that that a 64M allocation in glibc is always immediately done via
mmap(), and is thus a lot slower than shorter allocations. This means
read_virtual_file() becomes ridiculously slow if we'd use the large
limit, since we use it all the time for reading /proc and /sys metadata,
and read_virtual_file() typically allocates the full size with malloc()
in advance.  In fact it becomes so slow, that test-process-util kept
timing out on me all the time, once I blindly raised the limit.

This patch hence introduces two distinct limits for read_full_file() and
read_virtual_file(): the former is much larger than the latter and the
latter remains where it is. This is safe since the former uses an
exponentially growing realloc() loop while the latter uses the
aforementioend ahead-of-time full limit allocation.

Fixes: #19193
4 years agoshared/install: ignore enablement of template units w/o instance when presetting 19870/head
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 16:41:17 +0000 (18:41 +0200)] 
shared/install: ignore enablement of template units w/o instance when presetting

When we have a unit which cannot be enabled:
 # foo@.service:
 ...
 [Install]
 WantedBy=foo.target  # there is no instance, so we don't know what to enable

we should throw an error when invoked directly with 'enable', but
not when doing 'preset' or 'preset-all'.

Fixes #19856.

4 years agoshared/install: pass UnitFileFlags down into the call chain
Zbigniew Jędrzejewski-Szmek [Thu, 10 Jun 2021 08:00:16 +0000 (10:00 +0200)] 
shared/install: pass UnitFileFlags down into the call chain

This just propagates the parameter down into leaf functions,
without any functional change.

4 years agoMerge pull request #19857 from yuwata/tmpfile-fix
Lennart Poettering [Thu, 10 Jun 2021 07:30:57 +0000 (09:30 +0200)] 
Merge pull request #19857 from yuwata/tmpfile-fix

tmpfiles: fix an issue found by Coverity

4 years agoMerge pull request #19863 from keszybz/coverity-drop-unitialized-workarounds
Lennart Poettering [Thu, 10 Jun 2021 07:29:59 +0000 (09:29 +0200)] 
Merge pull request #19863 from keszybz/coverity-drop-unitialized-workarounds

Drop some -Wmaybe-unitialized workarounds to help coverity

4 years agoMerge pull request #19867 from yuwata/ether-addr-util
Lennart Poettering [Thu, 10 Jun 2021 07:29:36 +0000 (09:29 +0200)] 
Merge pull request #19867 from yuwata/ether-addr-util

ether-addr-util: introduce hw_addr_equal() and friends

4 years agocore/dbus: rename internal variable for clarity
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 16:33:14 +0000 (18:33 +0200)] 
core/dbus: rename internal variable for clarity

4 years agoman: add note about operation without swap in systemd-oomd
Anita Zhang [Thu, 10 Jun 2021 04:55:38 +0000 (21:55 -0700)] 
man: add note about operation without swap in systemd-oomd

4 years agoClarify help information for --global
nerdopolis [Wed, 9 Jun 2021 13:00:02 +0000 (09:00 -0400)] 
Clarify help information for --global

4 years agosd-event: change ordering of pending/ratelimited events 19811/head
Lennart Poettering [Tue, 8 Jun 2021 07:07:51 +0000 (00:07 -0700)] 
sd-event: change ordering of pending/ratelimited events

Instead of ordering non-pending before pending we should order
"non-pending OR ratelimited" before "pending AND not-ratelimited".
This fixes a bug where ratelimited events were ordered at the end of the
priority queue and could be stuck there for an indeterminate amount of
time.

4 years agotmpfile: always get file descriptor of root or current directory 19857/head
Yu Watanabe [Wed, 9 Jun 2021 04:33:34 +0000 (13:33 +0900)] 
tmpfile: always get file descriptor of root or current directory

Fixes CID#1457467.

4 years agoMerge pull request #19871 from yuwata/man-network-missing-settings
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 20:15:38 +0000 (22:15 +0200)] 
Merge pull request #19871 from yuwata/man-network-missing-settings

man: add missing settings

4 years agocryptsetup: remove unitialized workaround 19863/head
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 10:40:53 +0000 (12:40 +0200)] 
cryptsetup: remove unitialized workaround

Doesn't seem needed anymore.

4 years agotest-capability: drop work-around initialization
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 10:36:06 +0000 (12:36 +0200)] 
test-capability: drop work-around initialization

Since those workarounds have been added, work has been done to tighten
up log_*() return values. Seems we get no warning with
gcc-11.1.1-1.fc34.x86_64 and -O0/-O2.

4 years agonetworkd: drop one workaround initialization
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 10:40:35 +0000 (12:40 +0200)] 
networkd: drop one workaround initialization

As for the other ones in src/network/, if they are removed, gcc warns when they
are removed.

Should fix Coverity CID#1457466.

4 years agoMerge pull request #19861 from poettering/hwdb-249
Lennart Poettering [Wed, 9 Jun 2021 19:54:42 +0000 (21:54 +0200)] 
Merge pull request #19861 from poettering/hwdb-249

hwdb + syscall database updates for 249

4 years agoman: add missing settings 19871/head
Yu Watanabe [Wed, 9 Jun 2021 19:45:54 +0000 (04:45 +0900)] 
man: add missing settings

Fixes #19869.

4 years agonetwork: sort settings about netdev
Yu Watanabe [Wed, 9 Jun 2021 19:43:35 +0000 (04:43 +0900)] 
network: sort settings about netdev

4 years agoman: merge several settings about netdev
Yu Watanabe [Wed, 9 Jun 2021 19:41:08 +0000 (04:41 +0900)] 
man: merge several settings about netdev

4 years agoshared/install: improve message about template mismatch
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 15:24:52 +0000 (17:24 +0200)] 
shared/install: improve message about template mismatch

$ systemctl enable --root=/ serial-getty@.service
Failed to enable unit, unit getty.target is a non-template unit.

Failed to enable serial-getty@.service, destination unit getty.target is a non-template unit.

4 years agoshared/install: remove custom error handling in unit_file_preset_all()
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 14:34:20 +0000 (16:34 +0200)] 
shared/install: remove custom error handling in unit_file_preset_all()

This had some purpose back in the day, but right now I cannot see what
difference this makes. It's hard to keep the list of all possible errors up to
date. So let's remove this, hopefully nothing breaks.

4 years agoshared/install: ignore failures for auxiliary files
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 14:33:23 +0000 (16:33 +0200)] 
shared/install: ignore failures for auxiliary files

If Also= fails, warn, but otherwise ignore the failure.

Fixes #19407.

4 years agotest: add extended test for triggering mount rate limit
Anita Zhang [Tue, 8 Jun 2021 07:04:35 +0000 (00:04 -0700)] 
test: add extended test for triggering mount rate limit

It's hard to trigger the failure to exit the rate limit state in
isolation as it needs multiple event sources in order to show that it
gets stuck in the queue. Hence why this is an extended test.

4 years agoman: fix missing markdown & minor errors
Peter Morrow [Wed, 9 Jun 2021 17:04:08 +0000 (18:04 +0100)] 
man: fix missing markdown & minor errors

In #19771 there were a few missing markdown tags a few style issue.

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
4 years agoether-addr-util, network: introduce ETHER_ADDR_TO_STR() macro and use it 19867/head
Yu Watanabe [Wed, 9 Jun 2021 15:37:50 +0000 (00:37 +0900)] 
ether-addr-util, network: introduce ETHER_ADDR_TO_STR() macro and use it

4 years agonetwork: use hw_addr_equal() or friends
Yu Watanabe [Wed, 9 Jun 2021 15:29:59 +0000 (00:29 +0900)] 
network: use hw_addr_equal() or friends

4 years agoether-addr-util: introduce hw_addr_compare(), hw_addr_equal(), and hw_addr_is_null()
Yu Watanabe [Wed, 9 Jun 2021 15:24:43 +0000 (00:24 +0900)] 
ether-addr-util: introduce hw_addr_compare(), hw_addr_equal(), and hw_addr_is_null()

4 years agoether-addr-util: drop redundant "addr" from struct hw_addr_data
Yu Watanabe [Wed, 9 Jun 2021 15:19:47 +0000 (00:19 +0900)] 
ether-addr-util: drop redundant "addr" from struct hw_addr_data

Also, this makes always specifiy "struct" for hw_addr_data.

4 years agoMerge pull request #19854 from poettering/journal-enum-uniq-fix
Lennart Poettering [Wed, 9 Jun 2021 13:37:01 +0000 (15:37 +0200)] 
Merge pull request #19854 from poettering/journal-enum-uniq-fix

fix journalctl -F

4 years agoseccomp: add some recently added syscalls to filter groups
Lennart Poettering [Wed, 9 Jun 2021 09:56:00 +0000 (11:56 +0200)] 
seccomp: add some recently added syscalls to filter groups

4 years agocore/serialization: call exec_runtime_deserialize_compat() independently of whether...
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jun 2021 14:28:59 +0000 (16:28 +0200)] 
core/serialization: call exec_runtime_deserialize_compat() independently of whether .serialize is defined

There is no reason to tie the two together: in principle we may have
in the future a unit type which does not define .serialize/.deserialize_item,
but we would still want to call the compat deserialization code for it.

4 years agonetworkd: reorder conditional to handle errors first
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 10:23:07 +0000 (12:23 +0200)] 
networkd: reorder conditional to handle errors first

This also avoid the implicit assumption that if r is not -ENOENT, 0, or 1,
it must be negative. The compiler cannot know this.

4 years agohwdb: run ninja hwdb-update 19861/head
Lennart Poettering [Wed, 9 Jun 2021 09:45:08 +0000 (11:45 +0200)] 
hwdb: run ninja hwdb-update

4 years agohwdb: run ninja update-hwdb-autosuspend
Lennart Poettering [Wed, 9 Jun 2021 09:41:13 +0000 (11:41 +0200)] 
hwdb: run ninja update-hwdb-autosuspend

4 years agosyscalls: run ninja update-syscall-*
Lennart Poettering [Wed, 9 Jun 2021 09:40:14 +0000 (11:40 +0200)] 
syscalls: run ninja update-syscall-*

4 years agoupdate NEWS
Lennart Poettering [Wed, 9 Jun 2021 09:37:26 +0000 (11:37 +0200)] 
update NEWS

4 years agodocs/CGROUP_DELEGATION: fix some typos
Štěpán Němec [Wed, 9 Jun 2021 07:22:43 +0000 (09:22 +0200)] 
docs/CGROUP_DELEGATION: fix some typos

4 years agoMerge pull request #19851 from poettering/bpf-firewall-tweaks
Lennart Poettering [Wed, 9 Jun 2021 07:47:23 +0000 (09:47 +0200)] 
Merge pull request #19851 from poettering/bpf-firewall-tweaks

close bpf firewall reload gap

4 years agojournal: don't try to reuse already calculated hash between files with keyed hash... 19854/head
Lennart Poettering [Tue, 8 Jun 2021 21:17:53 +0000 (23:17 +0200)] 
journal: don't try to reuse already calculated hash between files with keyed hash feature

When suppressing duplicate fields between files we so far tried to reuse
the already known hash value of the data fields between files. This was
fine as long as we used the same hash function everywhere. However,
since addition of the keyed hash feature for journal files this doesn't
work anymore, since the hashes will be different for different files.

Fixes: #19172
4 years agojournal: remove an unnecessary 'else'
Lennart Poettering [Tue, 8 Jun 2021 21:17:48 +0000 (23:17 +0200)] 
journal: remove an unnecessary 'else'

4 years agojournal: make return parameters for sd_journal_enumerate_unique() optional
Lennart Poettering [Tue, 8 Jun 2021 21:15:04 +0000 (23:15 +0200)] 
journal: make return parameters for sd_journal_enumerate_unique() optional

4 years agojournal: as per coding style don't clobber return parameters in sd_journal_get_cutoff...
Lennart Poettering [Tue, 8 Jun 2021 20:20:16 +0000 (22:20 +0200)] 
journal: as per coding style don't clobber return parameters in sd_journal_get_cutoff_monotonic_usec() on failure

4 years agojournal: use free_and_strdup() where appropriate
Lennart Poettering [Tue, 8 Jun 2021 20:15:15 +0000 (22:15 +0200)] 
journal: use free_and_strdup() where appropriate

4 years agojournal: add some careful overflow checking
Lennart Poettering [Tue, 8 Jun 2021 20:14:40 +0000 (22:14 +0200)] 
journal: add some careful overflow checking

4 years agotmpfile: several minor coding style fixes
Yu Watanabe [Wed, 9 Jun 2021 04:30:16 +0000 (13:30 +0900)] 
tmpfile: several minor coding style fixes

This makes the followings:
- reduces scope of variables,
- drop unnecessary 'else'
- use CLOSE_AND_REPLACE() macro
- use strnull() for possible NULL string

4 years agoMerge pull request #19852 from yuwata/network-stable-secret
Yu Watanabe [Wed, 9 Jun 2021 03:30:57 +0000 (12:30 +0900)] 
Merge pull request #19852 from yuwata/network-stable-secret

network: introduce IPv6StableSecretAddress= to configure secret key for generating IPv6LL address

4 years agojournald: when journald namespace instances log, they can do so safely to the main...
Lennart Poettering [Tue, 8 Jun 2021 17:43:47 +0000 (19:43 +0200)] 
journald: when journald namespace instances log, they can do so safely to the main journald instance

Fixes: #18951
4 years agoMerge pull request #19831 from yuwata/network-next2
Yu Watanabe [Wed, 9 Jun 2021 03:27:37 +0000 (12:27 +0900)] 
Merge pull request #19831 from yuwata/network-next2

network: several interface up/down and setting MTU related updates

4 years agoNEWS: list more recent changes
Luca Boccassi [Thu, 3 Jun 2021 17:17:16 +0000 (18:17 +0100)] 
NEWS: list more recent changes

4 years agobpf-firewall: close gap when updating the firewall 19851/head
Lennart Poettering [Tue, 8 Jun 2021 17:26:39 +0000 (19:26 +0200)] 
bpf-firewall: close gap when updating the firewall

If we have BPF_F_ALLOW_MULTI support we can install the new program
before we drop the old (because we can install two program at the same
time). Let's do that, and thus fully close the firewall
gap.

4 years agobpf-program: document BPFProgram a bit
Lennart Poettering [Tue, 8 Jun 2021 16:49:50 +0000 (18:49 +0200)] 
bpf-program: document BPFProgram a bit

4 years agobpf-program: serialize attached BPF programs across daemon reexec/reload
Lennart Poettering [Tue, 8 Jun 2021 16:20:02 +0000 (18:20 +0200)] 
bpf-program: serialize attached BPF programs across daemon reexec/reload

Alternative to #17495

4 years agobpf-program: export hash_ops for BPFProgam objects
Lennart Poettering [Tue, 8 Jun 2021 16:19:38 +0000 (18:19 +0200)] 
bpf-program: export hash_ops for BPFProgam objects

4 years agobpf-program: use structured initialization when allocating BPFProgram objects
Lennart Poettering [Tue, 8 Jun 2021 16:52:43 +0000 (18:52 +0200)] 
bpf-program: use structured initialization when allocating BPFProgram objects

4 years agobpf-link: prefix function names with "bpf_"
Lennart Poettering [Tue, 8 Jun 2021 15:00:48 +0000 (17:00 +0200)] 
bpf-link: prefix function names with "bpf_"

we generally do this for all bpf functions, do so here too.

4 years agocore: rename socket-bind.[ch] → bpf-socket-bind.[ch]
Lennart Poettering [Tue, 8 Jun 2021 14:30:45 +0000 (16:30 +0200)] 
core: rename socket-bind.[ch] → bpf-socket-bind.[ch]

The other BPF infra has a file name prefix of "bpf-" hence do so here
too.

4 years agonetwork: do not process requests which conditionalized with link flags while the... 19831/head
Yu Watanabe [Mon, 7 Jun 2021 07:26:10 +0000 (16:26 +0900)] 
network: do not process requests which conditionalized with link flags while the flags are updating

E.g. nexthop requires IFF_UP flag, but the currently stored flag may be
outdated if we called link_down(). This makes such requests pending if
at least one of the flags are updating.

4 years agonetwork: make several link settings critical
Yu Watanabe [Sun, 6 Jun 2021 08:09:42 +0000 (17:09 +0900)] 
network: make several link settings critical

4 years agonetwork: use request queue to handle always-up or -down activation policy
Yu Watanabe [Sun, 6 Jun 2021 08:02:00 +0000 (17:02 +0900)] 
network: use request queue to handle always-up or -down activation policy

4 years agonetwork: use request queue to handle bound_to list
Yu Watanabe [Sun, 6 Jun 2021 07:59:41 +0000 (16:59 +0900)] 
network: use request queue to handle bound_to list

4 years agonetwork: handle bound_by list even if IgnoreCarrierLoss=yes
Yu Watanabe [Sun, 6 Jun 2021 07:36:54 +0000 (16:36 +0900)] 
network: handle bound_by list even if IgnoreCarrierLoss=yes

4 years agonetwork: add brief comments about bound_to and bound_by list
Yu Watanabe [Sun, 6 Jun 2021 06:32:24 +0000 (15:32 +0900)] 
network: add brief comments about bound_to and bound_by list

4 years agonetwork: apply activation policy only when it is once activated
Yu Watanabe [Sun, 6 Jun 2021 06:24:43 +0000 (15:24 +0900)] 
network: apply activation policy only when it is once activated

Otherwise, e.g., if activation policy is always-up is set for bond
slave, then setting bond configuration may fail.

4 years agonetwork: do not drop requests on carrier lost
Yu Watanabe [Mon, 7 Jun 2021 06:54:48 +0000 (15:54 +0900)] 
network: do not drop requests on carrier lost

On carrier lost, then all requests which require carrier will not be
processed. And they will be processed when the interface gained its
carrier again. So, it is not necessary to drop requests here.

4 years agonetwork: route: update error message
Yu Watanabe [Sun, 6 Jun 2021 11:06:12 +0000 (20:06 +0900)] 
network: route: update error message

4 years agonetwork: also adjust IPv6 MTU by the maximum MTU of the interface
Yu Watanabe [Sun, 6 Jun 2021 06:18:43 +0000 (15:18 +0900)] 
network: also adjust IPv6 MTU by the maximum MTU of the interface

4 years agonetwork: read the minimum and maximum MTU of the interface, and adjust requested...
Yu Watanabe [Sun, 6 Jun 2021 05:46:58 +0000 (14:46 +0900)] 
network: read the minimum and maximum MTU of the interface, and adjust requested MTU based on these values

4 years agonetwork: use request queue to configure CAN interfaces
Yu Watanabe [Sun, 6 Jun 2021 05:14:44 +0000 (14:14 +0900)] 
network: use request queue to configure CAN interfaces

This also makes SR-IOV configurations are ignored for CAN interfaces,
as CAN interfaces seem not to support SR-IOV features.

4 years agotest-network: add a test case for IPv6StableSecretAddress= 19852/head
Yu Watanabe [Tue, 8 Jun 2021 18:12:56 +0000 (03:12 +0900)] 
test-network: add a test case for IPv6StableSecretAddress=

4 years agonetwork: introduce IPv6StableSecretAddress= setting
Yu Watanabe [Mon, 7 Jun 2021 21:21:57 +0000 (06:21 +0900)] 
network: introduce IPv6StableSecretAddress= setting

Previously, IPv6LinkLocalAddressGenerationMode= is not set, then we
define the address generation mode based on the result of reading
stable_secret sysctl value. This makes the mode is determined by whether
a secret address is specified in the new setting.

Closes #19622.

4 years agobpf: various coding style fixes
Lennart Poettering [Tue, 8 Jun 2021 14:24:10 +0000 (16:24 +0200)] 
bpf: various coding style fixes

Mostly logging related: let's downgrade logging in dlopen_bpf() for
example, and remove duplicate logging at various places. Add %m to log
messages and so on.

4 years agobpf-firewall: move destruction of IP firewall objects to bpf-firewall.c
Lennart Poettering [Tue, 8 Jun 2021 13:25:28 +0000 (15:25 +0200)] 
bpf-firewall: move destruction of IP firewall objects to bpf-firewall.c

These are so many runtime objects, let's add a bpf_firewall_close()
helper that destroys them all, and call that from unit_free(), simply as
an excercise of encapsulating more BPF code in bpf-firewall.c.

This also brings the destruction order and variable declaration order in
struct Unit into the same systematic order.

No change in behaviour just some minor refactoring.

4 years agotest-libcrypt-util: print out default for password settings, run make_salt() a few...
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jun 2021 11:48:10 +0000 (13:48 +0200)] 
test-libcrypt-util: print out default for password settings, run make_salt() a few times

Inspired by
https://fedoraproject.org/wiki/Changes/yescrypt_as_default_hashing_method_for_shadow.

4 years agoresolved: fix strange function recursion
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jun 2021 16:17:44 +0000 (18:17 +0200)] 
resolved: fix strange function recursion

In dns_server_unlink_marked() and dns_server_mark_all() we done recursively.
People might have dozens of servers defined, and it's better to avoid recursion
when a simple loop suffices.

dns_server_unlink_marked() would only unmark the first marked server.

Fixes #19651.

4 years agojournal-file: truncate archived journals
Vito Caputo [Sat, 14 Nov 2020 22:06:48 +0000 (14:06 -0800)] 
journal-file: truncate archived journals

Journal files have space allocated in 8MiB-aligned increments.

This can add up to substantial wasted space as many archived journals
accumulate without using all the allocated space.

This commit introduces truncating to the offset a subsequent append
would get written at when archiving.

Fixes https://github.com/systemd/systemd/issues/17613

4 years agodissect: find partition more frequently 18851/head
Yu Watanabe [Tue, 2 Mar 2021 23:25:05 +0000 (08:25 +0900)] 
dissect: find partition more frequently

With the previous commit, the partition may be found after 45 sec. It is
too late. Let's find partition more frequently.

4 years agodissect: try to find partition again on timeout
Yu Watanabe [Tue, 2 Mar 2021 22:34:32 +0000 (07:34 +0900)] 
dissect: try to find partition again on timeout

Not sure, but at the time the target partition device is created or
enumerated, some sysattrs or properties may not be ready.

So, let's find partition on timeout. The device may be ready at that
time.

4 years agotmpfiles: extend "Age" to accept an "age-by" argument
Srinidhi Kaushik [Tue, 8 Jun 2021 10:19:48 +0000 (15:49 +0530)] 
tmpfiles: extend "Age" to accept an "age-by" argument

For "systemd-tmpfiles --cleanup", when the "Age" parameter
is specified, the criteria for deletion is determined from
the path's last modification timestamp ("mtime"), its last
access timestamp ("atime") and its last status change
timestamp ("ctime").

For instance, if one of those paths to be cleaned up are
opened, it results in the modification of "atime", which
results file system entry to not be removed because the
default aging algorithm would skip the entry.

Add an optional "age-by" argument by extending the "Age"
parameter to restrict the clean-up for a particular type
of file timestamp, which can be specified in "tmpfiles.d"
as follows:

  [age-by:]cleanup-age, where age-by is "[abcmACBM]+"

For example:

  d /foo/bar - - - abM:1m -

Would clean-up any files that were not accessed and created,
or directories that were not modified less than a minute ago
in "/foo/bar".

Fixes: #17002