]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agohomed: optionally, drop caches on logout
Lennart Poettering [Tue, 5 Oct 2021 08:32:25 +0000 (10:32 +0200)] 
homed: optionally, drop caches on logout

Fixes: #20857
2 years agohomed: take BSD file lock on LUKS file while activated
Lennart Poettering [Tue, 5 Oct 2021 08:26:25 +0000 (10:26 +0200)] 
homed: take BSD file lock on LUKS file while activated

Fixes: #19758
2 years agohomed: retry deactivation every 15s until successful
Lennart Poettering [Mon, 30 Aug 2021 11:23:20 +0000 (13:23 +0200)] 
homed: retry deactivation every 15s until successful

Fixes: #17445
2 years agohomed: keep "pinning" fd open while home dir active
Lennart Poettering [Sat, 28 Aug 2021 05:36:25 +0000 (07:36 +0200)] 
homed: keep "pinning" fd open while home dir active

The pin fd keeps the mount busy, ensuring that unmount requests need to
go through us.

Note that this doesn't change too much IRL, since a logged in user
generally has processes keeping the home dir busy anyway. However, in
some corner cases it is safer to protect from accidental unmounts this
way. (e.g. if user manually called "homectl activate" first).

2 years agorm-rf: optionally fsync() after removing directory tree
Lennart Poettering [Tue, 5 Oct 2021 08:32:56 +0000 (10:32 +0200)] 
rm-rf: optionally fsync() after removing directory tree

2 years agovarlink: make one more parameter const
Lennart Poettering [Mon, 11 Oct 2021 13:37:18 +0000 (15:37 +0200)] 
varlink: make one more parameter const

2 years agoutil: define initializer for 'struct ucred' that properly invalidates all fields
Lennart Poettering [Mon, 11 Oct 2021 13:25:14 +0000 (15:25 +0200)] 
util: define initializer for 'struct ucred' that properly invalidates all fields

i.e. let's make sure to invalid uid/gid to UID_INVAID + GID_INVALID
instead of zero.

2 years agovirt: Fix Xen PV detection when nested inside another hypervisor
Bogdan Seniuc [Sat, 9 Oct 2021 12:00:36 +0000 (15:00 +0300)] 
virt: Fix Xen PV detection when nested inside another hypervisor

Currently, when Xen PV domains are nested within a hypervisor which is
detected through CPUID (such as VMware), the detected hypervisor might
not be Xen, because we don't check for Xen until after the CPUID check.

This change moves the Xen check before CPUID checks to fix the issue,
and moves Dom0 checking to detect_vm_xen so that we keep ignoring Xen
when we are in Dom0.

2 years agosd-stub: Provide initrd with LINUX_EFI_INITRD_MEDIA_GUID
Max Resch [Thu, 30 Sep 2021 16:43:52 +0000 (18:43 +0200)] 
sd-stub: Provide initrd with LINUX_EFI_INITRD_MEDIA_GUID

Register a LINUX_EFI_INITRD_MEDIA_GUID DevicePath with a LoadFile2Protocol interface and serve the initrd to a supported Linux kernel (Version 5.8+)
Leave the x86 code for older kernels in place until supported kernels become more mainstream

2 years agoMerge pull request #20979 from poettering/ac-power-tweak
Lennart Poettering [Mon, 11 Oct 2021 12:04:51 +0000 (14:04 +0200)] 
Merge pull request #20979 from poettering/ac-power-tweak

tweaks to ac_power()

2 years agoutil: invert ac_power() source type check 20979/head
Lennart Poettering [Mon, 11 Oct 2021 08:54:31 +0000 (10:54 +0200)] 
util: invert ac_power() source type check

So far we assumed every power source was a battery except for the ones
which definitely are not. I think this logic makes little sense, as
"battery" is kinda the exceptional case here, not the other way round.
Hence let's invert the type check, and denylist "Battery" devices rather
than allowlist "Mains" devices.

This should increase compatibility with alternative types of power
sources, in particular USB ones.

This takes into account that additional power types have been added
since we wrote the original code, and in particular should cover the
siutation discussed here OK:

https://sources.debian.org/src/powermgmt-base/1.36/power_supply.txt/#L31
https://sources.debian.org/src/powermgmt-base/1.36/on_ac_power/#L25

Also, modernizes the code in various was ways.

Inspired by and fixes: #20964

2 years agofileio: add read_virtual_file_at() flavour that takes dir_fd/path pair
Lennart Poettering [Mon, 11 Oct 2021 08:53:56 +0000 (10:53 +0200)] 
fileio: add read_virtual_file_at() flavour that takes dir_fd/path pair

2 years agoMerge pull request #20744 from yuwata/udev-netlink
Zbigniew Jędrzejewski-Szmek [Mon, 11 Oct 2021 07:40:43 +0000 (09:40 +0200)] 
Merge pull request #20744 from yuwata/udev-netlink

udev: use netlink more aggressively

I'm pasting the comment from https://github.com/systemd/systemd/pull/20744#issuecomment-934485287
which is quite informative. The code wasn't changed significantly since then:

atenart commented 6 days ago:
> I ran tests without (93caec7) and with this PR (06735f2) on Fedora, having a few udev rules
> using attributes eligible to be cached and creating 50 veth on 4 CPUs. Although the time spent
> running the test is variable between runs, I generally saw an improvement when using this PR, e.g:
>
249-910-g93caec7:
> real 0m3.691s
> user 0m0.022s
> sys 0m1.338s
>
249-920-g06735f2:
> real 0m2.950s
> user 0m0.005s
> sys 0m0.399s
>
> On a different system than the one used above, I even saw a 40% improvement; results depend
> on many parameters (distro, udev rules, concurrent daemons accessing sysfs, etc.).
>
> Because it's quite hard to measure the improvement here (as the kernel behave differently between
> the two test cases), I also ran tests using a modified kernel not hitting the trylock logic. There was
> an improvement with this PR as well. (Take this with a grain of salt though, as the kernel was
> modified not using patches approved upstream).

2 years agomacro: fix ALIGN_TO() to use ULLONG_MAX instead of ULONGLONG_MAX
Thomas Haller [Fri, 8 Oct 2021 07:44:39 +0000 (09:44 +0200)] 
macro: fix ALIGN_TO() to use ULLONG_MAX instead of ULONGLONG_MAX

<limits.h> calls this ULLONG_MAX. It's not clear to me where ULONGLONG_MAX
can be found. This seems to be just a mistake.

Fixes: c7ed7187203c ('macro: handle overflow in ALIGN_TO() somewhat reasonably')
2 years agoMerge pull request #20973 from yuwata/busctl-trivial-cleanups
Yu Watanabe [Mon, 11 Oct 2021 05:03:48 +0000 (14:03 +0900)] 
Merge pull request #20973 from yuwata/busctl-trivial-cleanups

busctl: trivial cleanups

2 years agoAvoid passing NULL to underlying fprintf() in sysusers (#20974)
(GalaxyMaster) [Mon, 11 Oct 2021 05:03:15 +0000 (16:03 +1100)] 
Avoid passing NULL to underlying fprintf() in sysusers (#20974)

2 years agotest: add a test for parsing xml obtained by DBus Introspect method 20973/head
Yu Watanabe [Sun, 10 Oct 2021 12:28:18 +0000 (21:28 +0900)] 
test: add a test for parsing xml obtained by DBus Introspect method

2 years agobusctl: add missing header
Yu Watanabe [Sun, 10 Oct 2021 12:15:04 +0000 (21:15 +0900)] 
busctl: add missing header

2 years agobusctl: shorten code a bit
Yu Watanabe [Sun, 10 Oct 2021 10:18:08 +0000 (19:18 +0900)] 
busctl: shorten code a bit

2 years agobusctl: use set_ensure_consume()
Yu Watanabe [Sun, 10 Oct 2021 10:10:56 +0000 (19:10 +0900)] 
busctl: use set_ensure_consume()

2 years agoMerge pull request #20969 from poettering/cryptenroll-no-homed
Yu Watanabe [Sun, 10 Oct 2021 07:00:07 +0000 (16:00 +0900)] 
Merge pull request #20969 from poettering/cryptenroll-no-homed

cryptenroll: politely refuse enrolling keys into homed volumes

2 years agoMerge pull request #20915 from bluca/libsystemd_openssl
Luca Boccassi [Sat, 9 Oct 2021 17:37:59 +0000 (18:37 +0100)] 
Merge pull request #20915 from bluca/libsystemd_openssl

libsystemd/sd-id128: use only internal hmac, remove khash/OpenSSL support

2 years agotest: set 5 minute timeout on TEST-11-ISSUE-3166 and TEST-50-DISSECT
Dimitri John Ledkov [Fri, 8 Oct 2021 11:50:13 +0000 (12:50 +0100)] 
test: set 5 minute timeout on TEST-11-ISSUE-3166 and TEST-50-DISSECT

When they work they finish quickly in under two minutes on slow machines, when
soft lock ups happen in the nested virt machine each test can run for like 5
hours clogging up CI infrastructure. It's best to fail quicker than that when
qemu or kernel are broken.

2 years agoupdate TODO 20969/head
Lennart Poettering [Fri, 8 Oct 2021 15:25:39 +0000 (17:25 +0200)] 
update TODO

2 years agocryptenroll: politely refuse enrolling keys into homed volumes
Lennart Poettering [Fri, 8 Oct 2021 15:26:19 +0000 (17:26 +0200)] 
cryptenroll: politely refuse enrolling keys into homed volumes

People should use homectl to enroll tokens into home directories, hence
point them there. Otherwise the auth data for the account and for the
LUKS volume will end up being different.

2 years agohomed: don't forget to look at all enrolled tokens
Lennart Poettering [Fri, 8 Oct 2021 14:59:35 +0000 (16:59 +0200)] 
homed: don't forget to look at all enrolled tokens

We accidentally increased the token index twice whenever we found our
token. Fix that.

2 years agohomed: use crypt_token_max() where appropriate
Lennart Poettering [Fri, 8 Oct 2021 14:58:42 +0000 (16:58 +0200)] 
homed: use crypt_token_max() where appropriate

Let's use the new crypt_token_max() API in systemd-homework too, to cut
iteration of tokens short.

We already use it in cryptenroll/cryptsetup, so let's use it here too.

2 years agocryptsetup: also define crypt_token_max() as fallback locally, not just sym_crypt_tok...
Lennart Poettering [Fri, 8 Oct 2021 21:48:51 +0000 (23:48 +0200)] 
cryptsetup: also define crypt_token_max() as fallback locally, not just sym_crypt_token_max()

Our code that links directly against libcryptsetup, and doesn't use
dlopen() might want to use this fallback glue function too.

2 years agotree-wide: assorted Coccinelle fixes
Frantisek Sumsal [Fri, 8 Oct 2021 09:53:23 +0000 (11:53 +0200)] 
tree-wide: assorted Coccinelle fixes

It's that time of year again.

2 years agoAdd benchmark for sha256 calculations 20915/head
Zbigniew Jędrzejewski-Szmek [Fri, 8 Oct 2021 07:35:50 +0000 (09:35 +0200)] 
Add benchmark for sha256 calculations

2 years agotest-id128: split into functions and add the usual headers
Zbigniew Jędrzejewski-Szmek [Fri, 8 Oct 2021 07:29:47 +0000 (09:29 +0200)] 
test-id128: split into functions and add the usual headers

2 years agobasic: remove khash helpers
Luca Boccassi [Thu, 7 Oct 2021 20:49:19 +0000 (21:49 +0100)] 
basic: remove khash helpers

No longer used anywhere. So long, and thanks for all the hashes!

2 years agolibsystemd/sd-id128: use only internal hmac, remove khash/OpenSSL support
Luca Boccassi [Thu, 30 Sep 2021 10:01:45 +0000 (11:01 +0100)] 
libsystemd/sd-id128: use only internal hmac, remove khash/OpenSSL support

Using OpenSSL brings in an additional dependency for all users of
libsystemd.so even though it's just one API that makes use of it.

The khash implementation is awkward as it requires context switches and
computation inside the kernel, thus leaving the process.

Remove both from libsystemd.so, and use exclusively the internal hmac fallback.
While this is not optimized, the sd-id128 API is not used in
performance-critical contexts where hardware acceleration would make a
noticeable difference.

2 years agobasic: add hmac_sha256 implementation
Luca Boccassi [Thu, 7 Oct 2021 20:02:44 +0000 (21:02 +0100)] 
basic: add hmac_sha256 implementation

Based on the FIPS 198 specification. Not optimized and probably
completely unsafe, to be used only for non-strong-cryptographic
purposes when OpenSSL cannot be used.

2 years agoboot/sha256: sd-ify and move to src/fundamental
Luca Boccassi [Thu, 7 Oct 2021 16:15:32 +0000 (17:15 +0100)] 
boot/sha256: sd-ify and move to src/fundamental

2 years agofundamental: define size_t and memcpy for sd-boot
Luca Boccassi [Fri, 8 Oct 2021 12:06:51 +0000 (13:06 +0100)] 
fundamental: define size_t and memcpy for sd-boot

2 years agoMerge pull request #20962 from poettering/dttoif
Lennart Poettering [Fri, 8 Oct 2021 09:14:03 +0000 (11:14 +0200)] 
Merge pull request #20962 from poettering/dttoif

Some tweaks to dirent-util.c

2 years agodirent-util: tweak readdir_ensure_type() a bit 20962/head
Lennart Poettering [Thu, 7 Oct 2021 20:58:43 +0000 (22:58 +0200)] 
dirent-util: tweak readdir_ensure_type() a bit

So far we ignored if readdir_ensure_type() failed, the .d_type would
then still possibly report DT_UNKNOWN, possibly confusing the caller.

Let's make this safer: if we get an error on readdir_ensure_type() then
report it — except if it is ENOENT which indicates the dirent vanished
by now, which is not a problem and we should just skip to the next
entry.

2 years agodirent-util: use statx() in readdir_ensure_type()
Lennart Poettering [Thu, 7 Oct 2021 20:55:20 +0000 (22:55 +0200)] 
dirent-util: use statx() in readdir_ensure_type()

Let's ask exactly for the one field we actually want to know, i.e.
STATX_TYPE.

(While we are at it, also copy over the inode number, if we have it,
simply to report the most recent info we have)

(Also, see AT_NO_AUTOMOUNT, so that we don't trigger automounts here.
After all, if we want to know the inode type of a dirent here, then
there's not need to trigger the automount, the inode type is not going
to change by that.)

2 years agodirent-util: get rid of stat_mode_to_dirent_type()
Lennart Poettering [Thu, 7 Oct 2021 20:23:35 +0000 (22:23 +0200)] 
dirent-util: get rid of stat_mode_to_dirent_type()

Apparently glibc already has a helper for this. (Not in the man pages
for Linux, but FreeBSD does document these cryptic helpers, and its
exported by glibc. That should be good enough for us.)

2 years agodissect: print more useful error messages for two more error cases
Lennart Poettering [Thu, 7 Oct 2021 12:14:02 +0000 (14:14 +0200)] 
dissect: print more useful error messages for two more error cases

2 years agocoredump: Add --all option
Daan De Meyer [Wed, 6 Oct 2021 12:47:46 +0000 (13:47 +0100)] 
coredump: Add --all option

This option has coredumpctl look at all journals instead of only the
local ones. This allows coredumpctl to show information about remote
coredumps if the coredumps are made available in /var/lib/systemd/coredump
and the corresponding journals are made available in /var/log/journal.

This is already possible using the --directory option but --all makes it
more user friendly since users don't have to enter the journal directory
anymore as long as it's available under /var/log/journal.

2 years agoMerge pull request #20910 from poettering/nftw-no-more
Lennart Poettering [Thu, 7 Oct 2021 20:12:41 +0000 (22:12 +0200)] 
Merge pull request #20910 from poettering/nftw-no-more

basic: add recurse_dir() function as modern replacement for nftw()

2 years agonetwork: assert on dereferenced pointer
Luca Boccassi [Thu, 7 Oct 2021 12:34:42 +0000 (13:34 +0100)] 
network: assert on dereferenced pointer

CID#1462762

2 years agoMerge pull request #20778 from yuwata/network-ipv6-token
Yu Watanabe [Thu, 7 Oct 2021 14:24:00 +0000 (23:24 +0900)] 
Merge pull request #20778 from yuwata/network-ipv6-token

network: rework IPv6 address generation mode

2 years agohomed: typo fix
Lennart Poettering [Mon, 4 Oct 2021 21:44:19 +0000 (23:44 +0200)] 
homed: typo fix

2 years agoupdate TODO
Lennart Poettering [Mon, 4 Oct 2021 08:31:04 +0000 (10:31 +0200)] 
update TODO

2 years agoMerge pull request #20948 from poettering/cgls-xattr
Lennart Poettering [Thu, 7 Oct 2021 13:25:03 +0000 (15:25 +0200)] 
Merge pull request #20948 from poettering/cgls-xattr

cgls: show cgroup id and xattr info in output

2 years agoupdate TODO 20910/head
Lennart Poettering [Fri, 1 Oct 2021 13:56:54 +0000 (15:56 +0200)] 
update TODO

2 years agomount-setup: port from nftw() to recurse_dir()
Lennart Poettering [Fri, 1 Oct 2021 13:56:27 +0000 (15:56 +0200)] 
mount-setup: port from nftw() to recurse_dir()

2 years agokbd-util: port from nftw() to recurse_dir()
Lennart Poettering [Fri, 1 Oct 2021 13:55:53 +0000 (15:55 +0200)] 
kbd-util: port from nftw() to recurse_dir()

2 years agocgroup-util: port from nftw() to recurse_dir()
Lennart Poettering [Fri, 1 Oct 2021 13:55:37 +0000 (15:55 +0200)] 
cgroup-util: port from nftw() to recurse_dir()

2 years agokmod-setup: port from nftw() to recurse_dir()
Lennart Poettering [Fri, 1 Oct 2021 13:55:16 +0000 (15:55 +0200)] 
kmod-setup: port from nftw() to recurse_dir()

2 years agotests: add test for recurse_dir()
Lennart Poettering [Fri, 1 Oct 2021 14:36:21 +0000 (16:36 +0200)] 
tests: add test for recurse_dir()

2 years agobasic: add new recurse_dir() tool as replacement for nftw()
Lennart Poettering [Fri, 1 Oct 2021 13:49:25 +0000 (15:49 +0200)] 
basic: add new recurse_dir() tool as replacement for nftw()

libc nftw() shows its age a bit, let's replace it with a more moden
infra that is built around openat(), O_PATH, statx(). This makes the
interface less prone to races and cleans up the API a bit adding
substantially more functionality.

2 years agotree-wide: remove a few unnecessary inclusions of ftw.h
Lennart Poettering [Fri, 1 Oct 2021 13:48:23 +0000 (15:48 +0200)] 
tree-wide: remove a few unnecessary inclusions of ftw.h

2 years agofileio: add shortcut for xopendirat() when called in opendir() compatible mode
Lennart Poettering [Fri, 1 Oct 2021 13:47:53 +0000 (15:47 +0200)] 
fileio: add shortcut for xopendirat() when called in opendir() compatible mode

2 years agodirent-util: split out new function stat_mode_to_dirent_type()
Lennart Poettering [Fri, 1 Oct 2021 13:46:42 +0000 (15:46 +0200)] 
dirent-util: split out new function stat_mode_to_dirent_type()

This contains the mapping between mode_t inode type flags and dirent's
d_type. Splitting this out allows us to use the mapping elsewhere later.

2 years agobash-completion: add the two new switches to systemd-cgls 20948/head
Lennart Poettering [Thu, 7 Oct 2021 09:46:10 +0000 (11:46 +0200)] 
bash-completion: add the two new switches to systemd-cgls

(completion hookup for zsh doesn't appear to exist, hence not adding
there.)

2 years agoman: document the two new switches for systemd-cgls
Lennart Poettering [Wed, 6 Oct 2021 15:12:26 +0000 (17:12 +0200)] 
man: document the two new switches for systemd-cgls

2 years agocgls: enable cgroupid/xattr output by default (but make it configurable)
Lennart Poettering [Wed, 6 Oct 2021 15:07:43 +0000 (17:07 +0200)] 
cgls: enable cgroupid/xattr output by default (but make it configurable)

2 years agocgroups-show: optionally show cgroup xattrs + cgroup id in cgroup tree output
Lennart Poettering [Wed, 6 Oct 2021 15:06:50 +0000 (17:06 +0200)] 
cgroups-show: optionally show cgroup xattrs + cgroup id in cgroup tree output

2 years agocgroups-show: use path_join() when concatenating cgroup paths
Lennart Poettering [Wed, 6 Oct 2021 15:06:05 +0000 (17:06 +0200)] 
cgroups-show: use path_join() when concatenating cgroup paths

2 years agocgroups-show: validate specified hostname before including it in fs path
Lennart Poettering [Wed, 6 Oct 2021 15:04:16 +0000 (17:04 +0200)] 
cgroups-show: validate specified hostname before including it in fs path

let's make sure the specified hostname is really valid before we build
an fs path from it. Just as a safety future, so that people can't trick
us with hostnames including "/../" or so.

2 years agocgroup-util: add reusable union type for cgroupfs file_handle structs
Lennart Poettering [Wed, 6 Oct 2021 15:02:08 +0000 (17:02 +0200)] 
cgroup-util: add reusable union type for cgroupfs file_handle structs

That way we can easily call name_to_handle_at() on cgroupfs2 elsewhere.

2 years agoxattr-util: merge various getxattr()/listxattr() helpers into getxattr_at_malloc...
Lennart Poettering [Wed, 6 Oct 2021 14:31:49 +0000 (16:31 +0200)] 
xattr-util: merge various getxattr()/listxattr() helpers into getxattr_at_malloc() + listxattr_at_malloc()

Unfortunately fgetxattr() and flistxattr() don't work via O_PATH fds.
Let's thus add fallbacks to go via /proc/self/fd/ in these cases.

Also, let's merge all the various flavours we have here into singular
implementations that can do everything we need:

1. malloc() loop handling
2. by fd, by path, or combination (i.e. a proper openat() like API)
3. work on O_PATH

2 years agotest: make OpenSSL checks optional in TEST-50-DISSECT
Luca Boccassi [Wed, 6 Oct 2021 23:26:26 +0000 (00:26 +0100)] 
test: make OpenSSL checks optional in TEST-50-DISSECT

If the packages are built without libssl simply skip the signature
checks.

Oct 06 21:21:32 H systemd[1]: systemd 249.1249.gcc4df1f787.0 running in system mode (+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS -OPENSSL
...
Oct 06 21:22:21 H systemd[459]: Activation of signed Verity volume worked neither via the kernel nor in userspace, can't activate.

Follow-up for #20691

2 years agoMerge pull request #20926 from yuwata/udev-net-wol-sopass
Luca Boccassi [Wed, 6 Oct 2021 22:36:05 +0000 (23:36 +0100)] 
Merge pull request #20926 from yuwata/udev-net-wol-sopass

udev/net: introduce WakeOnLanPassword=

2 years agotest: test udev with a _very_ long device name
Frantisek Sumsal [Fri, 1 Oct 2021 11:56:25 +0000 (13:56 +0200)] 
test: test udev with a _very_ long device name

Let's attempt to provide some coverage for #16161, #6867, and similar.

2 years agocoredump: Don't log an error if D-Bus isn't running
Daan De Meyer [Wed, 6 Oct 2021 12:20:36 +0000 (13:20 +0100)] 
coredump: Don't log an error if D-Bus isn't running

coredumpctl could be used in a chroot where D-Bus isn't running. If
that's the case, we shouldn't consider it an error if we can't connect
to the D-Bus daemon so let's reduce the severity of the error we log
when we can't connect to D-Bus because the socket doesn't exist.

2 years agoMerge pull request #20935 from unusual-thoughts/fix-empty-argv
Yu Watanabe [Wed, 6 Oct 2021 16:53:51 +0000 (01:53 +0900)] 
Merge pull request #20935 from unusual-thoughts/fix-empty-argv

Fix #20933

2 years agoudev/net: introduce WakeOnLanPassword= 20926/head
Yu Watanabe [Wed, 6 Oct 2021 12:49:58 +0000 (21:49 +0900)] 
udev/net: introduce WakeOnLanPassword=

Closes #20913.

2 years agotest-network: add tests for Token= in [IPv6Prefix] 20778/head
Yu Watanabe [Fri, 17 Sep 2021 12:55:32 +0000 (21:55 +0900)] 
test-network: add tests for Token= in [IPv6Prefix]

2 years agotest-network: replace deprecated settings
Yu Watanabe [Fri, 17 Sep 2021 12:55:00 +0000 (21:55 +0900)] 
test-network: replace deprecated settings

2 years agonetwork: make generate_eui64_address() static
Yu Watanabe [Fri, 24 Sep 2021 19:12:53 +0000 (04:12 +0900)] 
network: make generate_eui64_address() static

2 years agonetwork: introduce Token= setting in [IPv6Prefix]
Yu Watanabe [Fri, 24 Sep 2021 19:12:31 +0000 (04:12 +0900)] 
network: introduce Token= setting in [IPv6Prefix]

Closes #20149.

2 years agonetwork: extend Token= setting in [DHCPv6PrefixDelegation]
Yu Watanabe [Fri, 24 Sep 2021 19:10:34 +0000 (04:10 +0900)] 
network: extend Token= setting in [DHCPv6PrefixDelegation]

Now the setting supports the same syntax as the one in the [IPv6AcceptRA]
section.

2 years agonetwork: introduce Token=eui64
Yu Watanabe [Fri, 24 Sep 2021 19:04:09 +0000 (04:04 +0900)] 
network: introduce Token=eui64

So, now user can explicitly request EUI-64 algorithm to generate addresses.

2 years agonetwork: rename IPv6Token= in [Network] -> Token= in [IPv6AcceptRA]
Yu Watanabe [Fri, 24 Sep 2021 19:52:47 +0000 (04:52 +0900)] 
network: rename IPv6Token= in [Network] -> Token= in [IPv6AcceptRA]

The token is only used by received prefixes through RA.

2 years agonetwork: address-genereation: introduce generate_addresses()
Yu Watanabe [Fri, 1 Oct 2021 12:36:32 +0000 (21:36 +0900)] 
network: address-genereation: introduce generate_addresses()

Preparation for later commits. This does not change functionality.

2 years agonetwork: address-generation: use in6_addr_hash_ops_free
Yu Watanabe [Fri, 1 Oct 2021 12:34:59 +0000 (21:34 +0900)] 
network: address-generation: use in6_addr_hash_ops_free

Also, downgrade error level, and caller logs the error.

2 years agonetwork: address-generation: modernize config_parse_address_generation_type()
Yu Watanabe [Fri, 1 Oct 2021 12:23:56 +0000 (21:23 +0900)] 
network: address-generation: modernize config_parse_address_generation_type()

- drop unused _NONE type,
- rename IPv6Token::prefix -> IPv6Token::address,
- clear unused part of IPv6Token::address,
- use Set, instead of OrderedSet.

2 years agonetwork: address-generation: mask prefix with prefixlen for safety
Yu Watanabe [Fri, 1 Oct 2021 12:19:51 +0000 (21:19 +0900)] 
network: address-generation: mask prefix with prefixlen for safety

2 years agonetwork: address-generation: always start DAD counter from zero
Yu Watanabe [Fri, 1 Oct 2021 11:57:59 +0000 (20:57 +0900)] 
network: address-generation: always start DAD counter from zero

The token is stored in Network, and the .network file may be applied to
multiple links.

2 years agonetwork: address-generation: always use the first 64 bits of the prefix
Yu Watanabe [Fri, 1 Oct 2021 12:03:05 +0000 (21:03 +0900)] 
network: address-generation: always use the first 64 bits of the prefix

Hopefully, the prefix length is usually 64.

Previously, if the prefix length is smaller than 64, the result address
was undefined.

2 years agonetwork: ndisc: ignore autonomous prefix with prefix length larger than 64
Yu Watanabe [Fri, 1 Oct 2021 11:37:56 +0000 (20:37 +0900)] 
network: ndisc: ignore autonomous prefix with prefix length larger than 64

2 years agonetwork: radv: ignore Assign= if prefixlen is larger than 64
Yu Watanabe [Fri, 1 Oct 2021 08:59:56 +0000 (17:59 +0900)] 
network: radv: ignore Assign= if prefixlen is larger than 64

2 years agonetwork: make generate_ipv6_eui_64_address() take prefix
Yu Watanabe [Fri, 1 Oct 2021 08:58:38 +0000 (17:58 +0900)] 
network: make generate_ipv6_eui_64_address() take prefix

Also, rename the function.

2 years agonetwork: fix prefixlen for reserved subnet anycast address
Yu Watanabe [Fri, 1 Oct 2021 08:18:30 +0000 (17:18 +0900)] 
network: fix prefixlen for reserved subnet anycast address

Then, the prefixlen is not a multiplier of 8, we need to use
in6_addr_prefix_covers().

This also constify the reserved addresses, and rename macros.

2 years agonetwork: move address generation methods to network-address-generation.[ch]
Yu Watanabe [Fri, 1 Oct 2021 07:44:25 +0000 (16:44 +0900)] 
network: move address generation methods to network-address-generation.[ch]

2 years agoin-addr-util: introduce in{4,6}_addr_prefix_covers()
Yu Watanabe [Fri, 1 Oct 2021 08:42:31 +0000 (17:42 +0900)] 
in-addr-util: introduce in{4,6}_addr_prefix_covers()

2 years agoin-addr-util: do not shift 8 or more for uint8_t
Yu Watanabe [Fri, 1 Oct 2021 08:35:04 +0000 (17:35 +0900)] 
in-addr-util: do not shift 8 or more for uint8_t

See ISO/IEC 9899:TC3 § 6.5.7.3.

2 years agoin-addr-util: introduce in{4,6}_addr_mask()
Yu Watanabe [Fri, 17 Sep 2021 12:38:00 +0000 (21:38 +0900)] 
in-addr-util: introduce in{4,6}_addr_mask()

2 years agoin-addr-util: introduce in6_addr_hash_ops_free
Yu Watanabe [Fri, 17 Sep 2021 12:11:50 +0000 (21:11 +0900)] 
in-addr-util: introduce in6_addr_hash_ops_free

2 years agonetwork: radv: reorder functions
Yu Watanabe [Fri, 17 Sep 2021 11:54:47 +0000 (20:54 +0900)] 
network: radv: reorder functions

In other files, we usually (but not always) place functions in the following order:
- network_adjust_xxx(), which applies default or updates settings
  specified in .network files,
- link_xxx_enabled(), which checks if the functionality is enabled,
- xxx_new() and xxx_free(), allocator and deallocator for sections,
- functions which apply/update/remove configs
- validators of section,
- conf parsers.

This does not change each function, but just changes the order.

2 years agoMerge pull request #18145 from kinvolk/iaguis/lsm-bpf
Lennart Poettering [Wed, 6 Oct 2021 14:23:27 +0000 (16:23 +0200)] 
Merge pull request #18145 from kinvolk/iaguis/lsm-bpf

Add RestrictFileSystems= property using LSM BPF

2 years agouser-record: disable two pbkdf fields that don't apply for pkbdf2
Lennart Poettering [Tue, 5 Oct 2021 16:24:05 +0000 (18:24 +0200)] 
user-record: disable two pbkdf fields that don't apply for pkbdf2

Fixes: #20830
2 years agoethtool-util: make ethtool_set_wol() take password
Yu Watanabe [Wed, 6 Oct 2021 12:49:39 +0000 (21:49 +0900)] 
ethtool-util: make ethtool_set_wol() take password

2 years agoethtool-util: do not try to enable unsupported WoL options
Yu Watanabe [Wed, 6 Oct 2021 12:44:02 +0000 (21:44 +0900)] 
ethtool-util: do not try to enable unsupported WoL options

2 years agoethtool-util: make wol_options_to_string() not return all flag strings
Yu Watanabe [Tue, 5 Oct 2021 05:59:26 +0000 (14:59 +0900)] 
ethtool-util: make wol_options_to_string() not return all flag strings