Merge ~enr0n/ubuntu/+source/systemd:ubuntu-lunar-next into ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-lunar
- Git
- lp:~enr0n/ubuntu/+source/systemd
- ubuntu-lunar-next
- Merge into ubuntu-lunar
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Lukas Märdian | ||||
Approved revision: | e6a635d5dc87ed271d30e6bec1edd03d29525b0c | ||||
Merged at revision: | e6a635d5dc87ed271d30e6bec1edd03d29525b0c | ||||
Proposed branch: | ~enr0n/ubuntu/+source/systemd:ubuntu-lunar-next | ||||
Merge into: | ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-lunar | ||||
Diff against target: |
5254 lines (+1754/-807) 121 files modified
.packit.yml (+5/-0) debian/changelog (+105/-0) debian/control (+4/-15) debian/patches/Deny-list-TEST-74-AUX-UTILS-on-s390x.patch (+16/-0) debian/patches/debian/Downgrade-a-couple-of-warnings-to-debug.patch (+3/-3) debian/patches/debian/Make-run-lock-tmpfs-an-API-fs.patch (+2/-0) debian/patches/debian/Revert-core-one-step-back-again-for-nspawn-we-actual.patch (+1/-1) debian/patches/lp2002445-sd-netlink-add-a-test-for-rtnl_set_link_name.patch (+72/-0) debian/patches/lp2002445-sd-netlink-do-not-swap-old-name-and-alternative-name.patch (+62/-0) debian/patches/lp2002445-sd-netlink-restore-altname-on-error-in-rtnl_set_link_name.patch (+64/-0) debian/patches/lp2002445-test-network-add-a-test-for-renaming-device-to-current-al.patch (+48/-0) debian/patches/lp2002445-udev-attempt-device-rename-even-if-interface-is-up.patch (+63/-0) debian/patches/lp2002445-udev-net-allow-new-link-name-as-an-altname-before-renamin.patch (+34/-0) debian/patches/p11kit-switch-to-dlopen.patch (+3/-3) debian/patches/series (+7/-3) debian/rules (+1/-0) debian/tests/boot-and-services (+2/-2) debian/tests/control (+13/-8) dev/null (+0/-323) man/org.freedesktop.systemd1.xml (+6/-0) man/systemd.mount.xml (+3/-1) man/systemd.scope.xml (+2/-0) man/systemd.service.xml (+9/-11) src/basic/alloc-util.c (+4/-0) src/basic/alloc-util.h (+29/-10) src/basic/cgroup-util.c (+1/-1) src/basic/hashmap.c (+1/-1) src/basic/linux/README (+1/-0) src/basic/linux/btrfs.h (+50/-12) src/basic/linux/btrfs_tree.h (+240/-1) src/basic/linux/genetlink.h (+3/-2) src/basic/linux/if_bridge.h (+21/-0) src/basic/linux/if_ether.h (+2/-0) src/basic/linux/if_link.h (+16/-0) src/basic/linux/if_macsec.h (+2/-0) src/basic/linux/if_tun.h (+5/-1) src/basic/linux/in.h (+9/-14) src/basic/linux/l2tp.h (+0/-2) src/basic/linux/netfilter/nf_tables.h (+29/-0) src/basic/linux/netlink.h (+24/-7) src/basic/linux/nl80211.h (+128/-7) src/basic/linux/pkt_sched.h (+11/-0) src/basic/linux/rtnetlink.h (+1/-1) src/basic/linux/stddef.h (+46/-0) src/basic/linux/update.sh (+1/-1) src/basic/virt.c (+1/-1) src/boot/efi/boot.c (+5/-2) src/boot/efi/console.c (+0/-16) src/boot/efi/cpio.c (+1/-1) src/boot/efi/meson.build (+11/-2) src/boot/efi/missing_efi.h (+0/-19) src/boot/efi/secure-boot.c (+1/-1) src/boot/efi/util.c (+5/-3) src/busctl/busctl.c (+19/-2) src/core/cgroup.c (+1/-1) src/core/cgroup.h (+1/-0) src/core/dbus-scope.c (+6/-0) src/core/execute.c (+17/-0) src/core/execute.h (+1/-0) src/core/import-creds.c (+7/-0) src/core/load-fragment-gperf.gperf.in (+1/-0) src/core/mount.c (+18/-3) src/core/scope.c (+20/-3) src/core/scope.h (+2/-0) src/core/slice.c (+3/-0) src/core/swap.c (+1/-1) src/core/unit.c (+1/-0) src/cryptsetup/cryptsetup-fido2.c (+72/-57) src/cryptsetup/cryptsetup-fido2.h (+24/-16) src/cryptsetup/cryptsetup.c (+27/-42) src/fundamental/macro-fundamental.h (+1/-0) src/gpt-auto-generator/gpt-auto-generator.c (+5/-5) src/import/curl-util.c (+4/-0) src/import/pull-job.c (+5/-5) src/journal-remote/microhttpd-util.h (+2/-2) src/kernel-install/50-depmod.install (+2/-0) src/libsystemd-network/sd-dhcp-client.c (+18/-20) src/libsystemd-network/sd-dhcp-lease.c (+4/-4) src/libsystemd-network/test-ndisc-ra.c (+6/-14) src/libsystemd-network/test-ndisc-rs.c (+8/-13) src/libsystemd/sd-device/test-sd-device.c (+8/-7) src/libsystemd/sd-event/sd-event.c (+6/-1) src/locale/localed.c (+8/-12) src/login/logind-dbus.c (+6/-0) src/network/netdev/l2tp-tunnel.c (+5/-5) src/network/networkd-address.c (+5/-1) src/network/networkd-ndisc.c (+11/-10) src/network/networkd-route.c (+5/-1) src/nspawn/nspawn-patch-uid.c (+3/-1) src/partition/growfs.c (+6/-1) src/resolve/resolvectl.c (+3/-3) src/resolve/resolved-dns-scope.c (+2/-1) src/resolve/resolved-dns-search-domain.c (+1/-1) src/resolve/resolved-dns-server.h (+2/-2) src/resolve/resolved-varlink.c (+2/-2) src/shared/bootspec.c (+5/-3) src/shared/bus-unit-util.c (+3/-0) src/shared/creds-util.c (+16/-20) src/shared/generator.c (+10/-1) src/shared/install.c (+8/-3) src/shared/install.h (+2/-2) src/shared/mount-setup.c (+2/-0) src/shared/sleep-config.c (+15/-17) src/sleep/sleep.c (+6/-2) src/test/test-execute.c (+3/-0) src/test/test-unit-name.c (+3/-1) src/tmpfiles/tmpfiles.c (+5/-2) test/TEST-55-OOMD/test.sh (+6/-0) test/fuzz/fuzz-unit-file/directives.scope (+1/-0) test/test-functions (+16/-0) test/test-network/conf/23-bond199.network (+0/-3) test/test-network/systemd-networkd-tests.py (+19/-3) test/test-shutdown.py (+1/-1) test/units/testsuite-26.sh (+1/-1) test/units/testsuite-55.sh (+3/-0) test/units/testsuite-64.sh (+6/-5) test/units/testsuite-65.sh (+10/-0) test/units/testsuite-73.sh (+14/-3) test/units/testsuite-74.firstboot.sh (+54/-15) test/units/testsuite-75.sh (+22/-13) units/systemd-userdbd.service.in (+1/-1) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lukas Märdian | Approve | ||
Review via email: mp+437150@code.launchpad.net |
Commit message
Description of the change
Merge 252.5-2 from Debian unstable, and cherry-pick udev NIC renaming patches for bug 2002445.
autopkgtest:
systemd 252.5-2ubuntu1~ppa2 (ppc64el) -- Pass: https:/
systemd 252.5-2ubuntu1~ppa2 (s390x) -- Fail: https:/
systemd 252.5-2ubuntu1~ppa2 (amd64) -- Pass: https:/
systemd 252.5-2ubuntu1~ppa2 (arm64) -- Pass: https:/
It looks like armhf wasn't triggered on staging, but the previous PPA build passed for armhf:
systemd 252.5-2ubuntu1~ppa1 (armhf) -- Pass: https:/
I think the s390x failure is flaky. I could not reproduce it in Canonistack, it passed just fine. Also, a previous run on arm64 failed with the same thing, but then passed the next run.
Nick Rosbrook (enr0n) wrote (last edit ): | # |
Lukas Märdian (slyon) wrote : | # |
Thank you for preparing another upload, Nick!
I verified it matches upstream v252.5 and the cherry-picked patches match upstream, too. Kudos for dropping the (unused) systemd-fsckd autopkgtest in Debian!
* d/rules: The "-Dstatus-
* I'm a bit concerned about the TEST-74-AUX-UTILS. It seems to be a real regression, as that one passed in previous build on s390x. It was touched in "252.4-2" and we should check what/why was done there. The test does not run on Debian at all, so they might have missed this regression:
upstream SKIP Test restriction "isolation-machine" requires testbed capability "isolation-machine"
Let's see what you find from your Canonistack investigation. It passes on non-s390x... But I think the very least we should do is open a bug report with Debian and/or upstream about this failure, before skipping it on s390x.
Other than those remarks this LGTM.
Nick Rosbrook (enr0n) wrote : | # |
Lukas and I discussed offline, and decided to skip TEST-74-AUX-UTILS on s390x for now. The test passes just fine on Canonistack s390x, so we think it may be a temporary infrastructure issue.
As for the other comment, I will make sure to mention this change in the Lunar Lobster release notes.
Preview Diff
1 | diff --git a/.packit.yml b/.packit.yml | |||
2 | index 1b49ddf..a226252 100644 | |||
3 | --- a/.packit.yml | |||
4 | +++ b/.packit.yml | |||
5 | @@ -29,6 +29,11 @@ actions: | |||
6 | 29 | # cases (see [0]), we can't use -Dc_args=/-Dcpp_args= here because of the | 29 | # cases (see [0]), we can't use -Dc_args=/-Dcpp_args= here because of the |
7 | 30 | # RPM hardening macros, that use $CFLAGS/$CPPFLAGS (see [1]). | 30 | # RPM hardening macros, that use $CFLAGS/$CPPFLAGS (see [1]). |
8 | 31 | # | 31 | # |
9 | 32 | # Remove ukify/new standalone handling, added in 253 | ||
10 | 33 | - "sed -i '/ukify/d' .packit_rpm/split-files.py" | ||
11 | 34 | - "sed -i '/%files ukify/d' .packit_rpm/systemd.spec" | ||
12 | 35 | - "sed -i '/%files standalone-repart/d' .packit_rpm/systemd.spec" | ||
13 | 36 | - "sed -i '/%files standalone-shutdown/d' .packit_rpm/systemd.spec" | ||
14 | 32 | # [0] https://github.com/mesonbuild/meson/issues/7360 | 37 | # [0] https://github.com/mesonbuild/meson/issues/7360 |
15 | 33 | # [1] https://github.com/systemd/systemd/pull/18908#issuecomment-792250110 | 38 | # [1] https://github.com/systemd/systemd/pull/18908#issuecomment-792250110 |
16 | 34 | - 'sed -i "/^CONFIGURE_OPTS=(/a--werror" .packit_rpm/systemd.spec' | 39 | - 'sed -i "/^CONFIGURE_OPTS=(/a--werror" .packit_rpm/systemd.spec' |
17 | diff --git a/debian/changelog b/debian/changelog | |||
18 | index 8852311..2821604 100644 | |||
19 | --- a/debian/changelog | |||
20 | +++ b/debian/changelog | |||
21 | @@ -1,3 +1,108 @@ | |||
22 | 1 | systemd (252.5-2ubuntu1) lunar; urgency=medium | ||
23 | 2 | |||
24 | 3 | * Merge 252.5-2 from Debian unstable | ||
25 | 4 | - Drop test-handle-Debian-s-etc-default-locale-in-testsuite-74.f.patch. | ||
26 | 5 | Applied upstream: https://github.com/systemd/systemd/commit/9b42646b22 | ||
27 | 6 | File: debian/patches/test-handle-Debian-s-etc-default-locale-in-testsuite-74.f.patch | ||
28 | 7 | https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=1b0789416172ec60d8086fe2b458b5396bb7e857 | ||
29 | 8 | - Drop test-make-sure-mount-point-exists-in-testsuite-64.sh.patch. | ||
30 | 9 | Applied upstream: https://github.com/systemd/systemd/commit/07e4787106 | ||
31 | 10 | File: debian/patches/test-make-sure-mount-point-exists-in-testsuite-64.sh.patch | ||
32 | 11 | https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=f97b2d5ae1a1f35668c4648f1c7fc715a588de50 | ||
33 | 12 | - Drop test-remove-no-longer-needed-quirk-for-set-locale-on-Debi.patch. | ||
34 | 13 | Fixed upstream: https://github.com/systemd/systemd-stable/commit/1c325f6d7f | ||
35 | 14 | File: debian/patches/test-remove-no-longer-needed-quirk-for-set-locale-on-Debi.patch | ||
36 | 15 | https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=5f85226d61393c08d7ea51c2f28db7fd4c79bcc6 | ||
37 | 16 | * udev: avoid NIC renaming race with kernel (LP: #2002445) | ||
38 | 17 | Files: | ||
39 | 18 | - debian/patches/lp2002445-sd-netlink-add-a-test-for-rtnl_set_link_name.patch | ||
40 | 19 | - debian/patches/lp2002445-sd-netlink-do-not-swap-old-name-and-alternative-name.patch | ||
41 | 20 | - debian/patches/lp2002445-sd-netlink-restore-altname-on-error-in-rtnl_set_link_name.patch | ||
42 | 21 | - debian/patches/lp2002445-test-network-add-a-test-for-renaming-device-to-current-al.patch | ||
43 | 22 | - debian/patches/lp2002445-udev-attempt-device-rename-even-if-interface-is-up.patch | ||
44 | 23 | - debian/patches/lp2002445-udev-net-allow-new-link-name-as-an-altname-before-renamin.patch | ||
45 | 24 | https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=58d29c2b376f03c44ed5a719877c95b332018cdc | ||
46 | 25 | * Deny-list TEST-74-AUX-UTILS on s390x. | ||
47 | 26 | Since this currently is only known to fail on the autopkgtest | ||
48 | 27 | infrastructure, we believe this is a temporary issue. | ||
49 | 28 | File: debian/patches/Deny-list-TEST-74-AUX-UTILS-on-s390x.patch | ||
50 | 29 | https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=a3a059d86e2fe3a104419ae2afcab557171f9809 | ||
51 | 30 | |||
52 | 31 | -- Nick Rosbrook <nick.rosbrook@canonical.com> Tue, 14 Feb 2023 11:52:31 -0500 | ||
53 | 32 | |||
54 | 33 | systemd (252.5-2) unstable; urgency=medium | ||
55 | 34 | |||
56 | 35 | * Fix boot-and-services autopkgtest. | ||
57 | 36 | |||
58 | 37 | -- Luca Boccassi <bluca@debian.org> Mon, 30 Jan 2023 01:03:48 +0000 | ||
59 | 38 | |||
60 | 39 | systemd (252.5-1) unstable; urgency=medium | ||
61 | 40 | |||
62 | 41 | [ Nick Rosbrook ] | ||
63 | 42 | * debian/tests: remove systemd-fsckd autopkgtest. This test never runs | ||
64 | 43 | in Debian autopkgtest because of missing machine isolation | ||
65 | 44 | requirements, and it nevers runs in Ubuntu because: SKIP: root file | ||
66 | 45 | system is being checked by initramfs already Since the test is not | ||
67 | 46 | providing any good feedback, and generally has not been maintained, | ||
68 | 47 | let's just remove it. | ||
69 | 48 | |||
70 | 49 | [ Luca Boccassi ] | ||
71 | 50 | * New upstream version 252.5 | ||
72 | 51 | * Drop patches merged in v252.5 | ||
73 | 52 | * Refresh patches | ||
74 | 53 | * Set default status format to 'combined': show both unit name and | ||
75 | 54 | description in logs/boot messages | ||
76 | 55 | |||
77 | 56 | -- Luca Boccassi <bluca@debian.org> Sun, 29 Jan 2023 19:39:28 +0000 | ||
78 | 57 | |||
79 | 58 | systemd (252.4-2) unstable; urgency=medium | ||
80 | 59 | |||
81 | 60 | [ Michael Biebl ] | ||
82 | 61 | * Refresh patches | ||
83 | 62 | * Tweak description of systemd and systemd-sysv package. | ||
84 | 63 | Remove redundancy and de-emphasize sysvinit. | ||
85 | 64 | * autopkgtest: add psmsic to upstream suite. | ||
86 | 65 | Needed for the killall binary. | ||
87 | 66 | See https://github.com/systemd/systemd/pull/24569 | ||
88 | 67 | * autopkgtest: add xkb-data, locales and locales-all to upstream suite. | ||
89 | 68 | Use locales-all so all necessary locales can be installed into the test | ||
90 | 69 | image without having to generate them on-the-fly. | ||
91 | 70 | See https://github.com/systemd/systemd/pull/23709 | ||
92 | 71 | * autopkgtest: prefer knot-dnssecutils over knot-dnsutils for upstream | ||
93 | 72 | suite. | ||
94 | 73 | The kzonecheck utility required by TEST-75-RESOLVED was split out from | ||
95 | 74 | knot-dnsutils into knot-dnssecutils so update the test dependencies | ||
96 | 75 | accordingly. Keep knot-dnsutils as alternative dependency to make | ||
97 | 76 | backports easier. | ||
98 | 77 | * Cherry-pick upstream fixes for TEST-74-AUX-UTILS | ||
99 | 78 | * Cherry-pick upstream fix for TEST-73-LOCALE | ||
100 | 79 | * Skip firstboot --prompt-keymap check in TEST-74-AUX-UTILS. | ||
101 | 80 | This test requires compatible keymaps from kbd which are not available | ||
102 | 81 | in Debian. | ||
103 | 82 | |||
104 | 83 | [ Luca Boccassi ] | ||
105 | 84 | * autopkgtest: add netlabel-tools to networkd-test.py suite. | ||
106 | 85 | The netlabelctl tool is needed to test the NetLabel integration. | ||
107 | 86 | See https://github.com/systemd/systemd/pull/23888 | ||
108 | 87 | * autopkgtest: add bsdutils to upstream suite. | ||
109 | 88 | The logger utility is now used in TEST-04-JOURNAL. | ||
110 | 89 | See https://github.com/systemd/systemd/pull/23086 | ||
111 | 90 | * autopkgtest: add knot, knot-dnsutils, bind9-dnsutils, bind9-host to | ||
112 | 91 | upstream suite. | ||
113 | 92 | Needed by TEST-75-RESOLVED. | ||
114 | 93 | See https://github.com/systemd/systemd/pull/23104 | ||
115 | 94 | * autopkgtest: add jq to upstream suite. | ||
116 | 95 | Needed by TEST-58-REPART. | ||
117 | 96 | See https://github.com/systemd/systemd/pull/24572 | ||
118 | 97 | * autopkgtest: add mtools to upstream suite. | ||
119 | 98 | Needed by TEST-58-REPART. | ||
120 | 99 | See https://github.com/systemd/systemd/pull/24944 | ||
121 | 100 | * autopkgtest: add erofs-utils to upstream suite. | ||
122 | 101 | Needed by TEST-58-REPART. | ||
123 | 102 | See https://github.com/systemd/systemd/pull/25686 | ||
124 | 103 | |||
125 | 104 | -- Michael Biebl <biebl@debian.org> Wed, 25 Jan 2023 09:17:24 +0100 | ||
126 | 105 | |||
127 | 1 | systemd (252.4-1ubuntu1) lunar; urgency=medium | 106 | systemd (252.4-1ubuntu1) lunar; urgency=medium |
128 | 2 | 107 | ||
129 | 3 | * Drop oomd-fix-unreachable-test-case-in-test-oomd-util.patch. | 108 | * Drop oomd-fix-unreachable-test-case-in-test-oomd-util.patch. |
130 | diff --git a/debian/control b/debian/control | |||
131 | index 812a8c5..c84c218 100644 | |||
132 | --- a/debian/control | |||
133 | +++ b/debian/control | |||
134 | @@ -118,9 +118,6 @@ Description: system and service manager | |||
135 | 118 | Linux control groups, maintains mount and automount points and implements an | 118 | Linux control groups, maintains mount and automount points and implements an |
136 | 119 | elaborate transactional dependency-based service control logic. | 119 | elaborate transactional dependency-based service control logic. |
137 | 120 | . | 120 | . |
138 | 121 | systemd is compatible with SysV and LSB init scripts and can work as a | ||
139 | 122 | drop-in replacement for sysvinit. | ||
140 | 123 | . | ||
141 | 124 | Installing the systemd package will not switch your init system unless you | 121 | Installing the systemd package will not switch your init system unless you |
142 | 125 | boot with init=/lib/systemd/systemd or install systemd-sysv in addition. | 122 | boot with init=/lib/systemd/systemd or install systemd-sysv in addition. |
143 | 126 | 123 | ||
144 | @@ -137,19 +134,11 @@ Depends: systemd (= ${binary:Version}), | |||
145 | 137 | ${misc:Depends} | 134 | ${misc:Depends} |
146 | 138 | Recommends: libpam-systemd, | 135 | Recommends: libpam-systemd, |
147 | 139 | libnss-systemd | 136 | libnss-systemd |
157 | 140 | Description: system and service manager - SysV links | 137 | Description: system and service manager - SysV compatibility symlinks |
158 | 141 | systemd is a system and service manager for Linux. It provides aggressive | 138 | This package provides manual pages and compatibility symlinks needed for |
159 | 142 | parallelization capabilities, uses socket and D-Bus activation for starting | 139 | systemd to replace sysvinit. |
151 | 143 | services, offers on-demand starting of daemons, keeps track of processes using | ||
152 | 144 | Linux control groups, maintains mount and automount points and implements an | ||
153 | 145 | elaborate transactional dependency-based service control logic. | ||
154 | 146 | . | ||
155 | 147 | systemd is compatible with SysV and LSB init scripts and can work as a | ||
156 | 148 | drop-in replacement for sysvinit. | ||
160 | 149 | . | 140 | . |
164 | 150 | This package provides the manual pages and links needed for systemd | 141 | Installing systemd-sysv will overwrite /sbin/init with a symlink to systemd. |
162 | 151 | to replace sysvinit. Installing systemd-sysv will overwrite /sbin/init with a | ||
163 | 152 | link to systemd. | ||
165 | 153 | 142 | ||
166 | 154 | Package: systemd-container | 143 | Package: systemd-container |
167 | 155 | Build-Profiles: <!stage1> | 144 | Build-Profiles: <!stage1> |
168 | diff --git a/debian/patches/Deny-list-TEST-74-AUX-UTILS-on-s390x.patch b/debian/patches/Deny-list-TEST-74-AUX-UTILS-on-s390x.patch | |||
169 | 156 | new file mode 100644 | 145 | new file mode 100644 |
170 | index 0000000..f230a88 | |||
171 | --- /dev/null | |||
172 | +++ b/debian/patches/Deny-list-TEST-74-AUX-UTILS-on-s390x.patch | |||
173 | @@ -0,0 +1,16 @@ | |||
174 | 1 | From: Nick Rosbrook <nick.rosbrook@canonical.com> | ||
175 | 2 | Date: Tue, 14 Feb 2023 11:43:42 -0500 | ||
176 | 3 | Subject: Deny-list TEST-74-AUX-UTILS on s390x | ||
177 | 4 | |||
178 | 5 | --- | ||
179 | 6 | test/TEST-74-AUX-UTILS/deny-list-upstream-ci-s390x | 1 + | ||
180 | 7 | 1 file changed, 1 insertion(+) | ||
181 | 8 | create mode 100644 test/TEST-74-AUX-UTILS/deny-list-upstream-ci-s390x | ||
182 | 9 | |||
183 | 10 | diff --git a/test/TEST-74-AUX-UTILS/deny-list-upstream-ci-s390x b/test/TEST-74-AUX-UTILS/deny-list-upstream-ci-s390x | ||
184 | 11 | new file mode 100644 | ||
185 | 12 | index 0000000..b7bd53b | ||
186 | 13 | --- /dev/null | ||
187 | 14 | +++ b/test/TEST-74-AUX-UTILS/deny-list-upstream-ci-s390x | ||
188 | 15 | @@ -0,0 +1 @@ | ||
189 | 16 | +# Currently failing on autopkgtest infra, but appears to be a temporary issue. | ||
190 | diff --git a/debian/patches/debian/Downgrade-a-couple-of-warnings-to-debug.patch b/debian/patches/debian/Downgrade-a-couple-of-warnings-to-debug.patch | |||
191 | index 29b6fa8..7f02cc3 100644 | |||
192 | --- a/debian/patches/debian/Downgrade-a-couple-of-warnings-to-debug.patch | |||
193 | +++ b/debian/patches/debian/Downgrade-a-couple-of-warnings-to-debug.patch | |||
194 | @@ -51,10 +51,10 @@ index 3c5df6c..24eff86 100644 | |||
195 | 51 | "Please update package to include a native systemd unit file, in order to make it more safe and robust.", fpath); | 51 | "Please update package to include a native systemd unit file, in order to make it more safe and robust.", fpath); |
196 | 52 | 52 | ||
197 | 53 | diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c | 53 | diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c |
199 | 54 | index 18bb757..1f60913 100644 | 54 | index 3501ccf..d8423dd 100644 |
200 | 55 | --- a/src/tmpfiles/tmpfiles.c | 55 | --- a/src/tmpfiles/tmpfiles.c |
201 | 56 | +++ b/src/tmpfiles/tmpfiles.c | 56 | +++ b/src/tmpfiles/tmpfiles.c |
203 | 57 | @@ -2987,6 +2987,7 @@ static int specifier_expansion_from_arg(const Specifier *specifier_table, Item * | 57 | @@ -2990,6 +2990,7 @@ static int specifier_expansion_from_arg(const Specifier *specifier_table, Item * |
204 | 58 | static int patch_var_run(const char *fname, unsigned line, char **path) { | 58 | static int patch_var_run(const char *fname, unsigned line, char **path) { |
205 | 59 | const char *k; | 59 | const char *k; |
206 | 60 | char *n; | 60 | char *n; |
207 | @@ -62,7 +62,7 @@ index 18bb757..1f60913 100644 | |||
208 | 62 | 62 | ||
209 | 63 | assert(path); | 63 | assert(path); |
210 | 64 | assert(*path); | 64 | assert(*path); |
212 | 65 | @@ -3012,7 +3013,8 @@ static int patch_var_run(const char *fname, unsigned line, char **path) { | 65 | @@ -3015,7 +3016,8 @@ static int patch_var_run(const char *fname, unsigned line, char **path) { |
213 | 66 | /* Also log about this briefly. We do so at LOG_NOTICE level, as we fixed up the situation automatically, hence | 66 | /* Also log about this briefly. We do so at LOG_NOTICE level, as we fixed up the situation automatically, hence |
214 | 67 | * there's no immediate need for action by the user. However, in the interest of making things less confusing | 67 | * there's no immediate need for action by the user. However, in the interest of making things less confusing |
215 | 68 | * to the user, let's still inform the user that these snippets should really be updated. */ | 68 | * to the user, let's still inform the user that these snippets should really be updated. */ |
216 | diff --git a/debian/patches/debian/Make-run-lock-tmpfs-an-API-fs.patch b/debian/patches/debian/Make-run-lock-tmpfs-an-API-fs.patch | |||
217 | index 6f4d2ac..4ab8117 100644 | |||
218 | --- a/debian/patches/debian/Make-run-lock-tmpfs-an-API-fs.patch | |||
219 | +++ b/debian/patches/debian/Make-run-lock-tmpfs-an-API-fs.patch | |||
220 | @@ -15,6 +15,8 @@ Closes: #751392 | |||
221 | 15 | tmpfiles.d/legacy.conf.in | 1 - | 15 | tmpfiles.d/legacy.conf.in | 1 - |
222 | 16 | 2 files changed, 2 insertions(+), 1 deletion(-) | 16 | 2 files changed, 2 insertions(+), 1 deletion(-) |
223 | 17 | 17 | ||
224 | 18 | diff --git a/src/shared/mount-setup.c b/src/shared/mount-setup.c | ||
225 | 19 | index 6882b62..c54e632 100644 | ||
226 | 18 | --- a/src/shared/mount-setup.c | 20 | --- a/src/shared/mount-setup.c |
227 | 19 | +++ b/src/shared/mount-setup.c | 21 | +++ b/src/shared/mount-setup.c |
228 | 20 | @@ -86,6 +86,8 @@ | 22 | @@ -86,6 +86,8 @@ |
229 | diff --git a/debian/patches/debian/Revert-core-one-step-back-again-for-nspawn-we-actual.patch b/debian/patches/debian/Revert-core-one-step-back-again-for-nspawn-we-actual.patch | |||
230 | index 0410005..deafad8 100644 | |||
231 | --- a/debian/patches/debian/Revert-core-one-step-back-again-for-nspawn-we-actual.patch | |||
232 | +++ b/debian/patches/debian/Revert-core-one-step-back-again-for-nspawn-we-actual.patch | |||
233 | @@ -14,7 +14,7 @@ Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1141137 | |||
234 | 14 | 1 file changed, 1 insertion(+), 10 deletions(-) | 14 | 1 file changed, 1 insertion(+), 10 deletions(-) |
235 | 15 | 15 | ||
236 | 16 | diff --git a/src/core/unit.c b/src/core/unit.c | 16 | diff --git a/src/core/unit.c b/src/core/unit.c |
238 | 17 | index bed5544..48d76f2 100644 | 17 | index 3ac56c1..3b73c7c 100644 |
239 | 18 | --- a/src/core/unit.c | 18 | --- a/src/core/unit.c |
240 | 19 | +++ b/src/core/unit.c | 19 | +++ b/src/core/unit.c |
241 | 20 | @@ -4615,16 +4615,7 @@ int unit_kill_context( | 20 | @@ -4615,16 +4615,7 @@ int unit_kill_context( |
242 | diff --git a/debian/patches/lp2002445-sd-netlink-add-a-test-for-rtnl_set_link_name.patch b/debian/patches/lp2002445-sd-netlink-add-a-test-for-rtnl_set_link_name.patch | |||
243 | 21 | new file mode 100644 | 21 | new file mode 100644 |
244 | index 0000000..8d9f0b3 | |||
245 | --- /dev/null | |||
246 | +++ b/debian/patches/lp2002445-sd-netlink-add-a-test-for-rtnl_set_link_name.patch | |||
247 | @@ -0,0 +1,72 @@ | |||
248 | 1 | From: Nick Rosbrook <nick.rosbrook@canonical.com> | ||
249 | 2 | Date: Tue, 22 Nov 2022 17:01:47 -0500 | ||
250 | 3 | Subject: sd-netlink: add a test for rtnl_set_link_name() | ||
251 | 4 | |||
252 | 5 | Origin: upstream, https://github.com/systemd/systemd/commit/b338a8bb40 | ||
253 | 6 | Bug-Ubuntu: https://launchpad.net/bugs/2002445 | ||
254 | 7 | |||
255 | 8 | Add a test that verifies a deleted alternative name is restored on error | ||
256 | 9 | in rtnl_set_link_name(). | ||
257 | 10 | --- | ||
258 | 11 | src/libsystemd/sd-netlink/test-netlink.c | 27 +++++++++++++++++++++++++++ | ||
259 | 12 | 1 file changed, 27 insertions(+) | ||
260 | 13 | |||
261 | 14 | diff --git a/src/libsystemd/sd-netlink/test-netlink.c b/src/libsystemd/sd-netlink/test-netlink.c | ||
262 | 15 | index 3f74ecc..2d93f9e 100644 | ||
263 | 16 | --- a/src/libsystemd/sd-netlink/test-netlink.c | ||
264 | 17 | +++ b/src/libsystemd/sd-netlink/test-netlink.c | ||
265 | 18 | @@ -8,6 +8,7 @@ | ||
266 | 19 | #include <linux/if_macsec.h> | ||
267 | 20 | #include <linux/l2tp.h> | ||
268 | 21 | #include <linux/nl80211.h> | ||
269 | 22 | +#include <unistd.h> | ||
270 | 23 | |||
271 | 24 | #include "sd-netlink.h" | ||
272 | 25 | |||
273 | 26 | @@ -16,6 +17,7 @@ | ||
274 | 27 | #include "macro.h" | ||
275 | 28 | #include "netlink-genl.h" | ||
276 | 29 | #include "netlink-internal.h" | ||
277 | 30 | +#include "netlink-util.h" | ||
278 | 31 | #include "socket-util.h" | ||
279 | 32 | #include "stdio-util.h" | ||
280 | 33 | #include "string-util.h" | ||
281 | 34 | @@ -667,6 +669,30 @@ static void test_genl(void) { | ||
282 | 35 | } | ||
283 | 36 | } | ||
284 | 37 | |||
285 | 38 | +static void test_rtnl_set_link_name(sd_netlink *rtnl, int ifindex) { | ||
286 | 39 | + _cleanup_strv_free_ char **alternative_names = NULL; | ||
287 | 40 | + int r; | ||
288 | 41 | + | ||
289 | 42 | + log_debug("/* %s */", __func__); | ||
290 | 43 | + | ||
291 | 44 | + if (geteuid() != 0) | ||
292 | 45 | + return (void) log_tests_skipped("not root"); | ||
293 | 46 | + | ||
294 | 47 | + /* Test that the new name (which is currently an alternative name) is | ||
295 | 48 | + * restored as an alternative name on error. Create an error by using | ||
296 | 49 | + * an invalid device name, namely one that exceeds IFNAMSIZ | ||
297 | 50 | + * (alternative names can exceed IFNAMSIZ, but not regular names). */ | ||
298 | 51 | + r = rtnl_set_link_alternative_names(&rtnl, ifindex, STRV_MAKE("testlongalternativename")); | ||
299 | 52 | + if (r == -EPERM) | ||
300 | 53 | + return (void) log_tests_skipped("missing required capabilities"); | ||
301 | 54 | + | ||
302 | 55 | + assert_se(r >= 0); | ||
303 | 56 | + assert_se(rtnl_set_link_name(&rtnl, ifindex, "testlongalternativename") == -EINVAL); | ||
304 | 57 | + assert_se(rtnl_get_link_alternative_names(&rtnl, ifindex, &alternative_names) >= 0); | ||
305 | 58 | + assert_se(strv_contains(alternative_names, "testlongalternativename")); | ||
306 | 59 | + assert_se(rtnl_delete_link_alternative_names(&rtnl, ifindex, STRV_MAKE("testlongalternativename")) >= 0); | ||
307 | 60 | +} | ||
308 | 61 | + | ||
309 | 62 | int main(void) { | ||
310 | 63 | sd_netlink *rtnl; | ||
311 | 64 | sd_netlink_message *m; | ||
312 | 65 | @@ -698,6 +724,7 @@ int main(void) { | ||
313 | 66 | test_pipe(if_loopback); | ||
314 | 67 | test_event_loop(if_loopback); | ||
315 | 68 | test_link_configure(rtnl, if_loopback); | ||
316 | 69 | + test_rtnl_set_link_name(rtnl, if_loopback); | ||
317 | 70 | |||
318 | 71 | test_get_addresses(rtnl); | ||
319 | 72 | test_message_link_bridge(rtnl); | ||
320 | diff --git a/debian/patches/lp2002445-sd-netlink-do-not-swap-old-name-and-alternative-name.patch b/debian/patches/lp2002445-sd-netlink-do-not-swap-old-name-and-alternative-name.patch | |||
321 | 0 | new file mode 100644 | 73 | new file mode 100644 |
322 | index 0000000..2388bf2 | |||
323 | --- /dev/null | |||
324 | +++ b/debian/patches/lp2002445-sd-netlink-do-not-swap-old-name-and-alternative-name.patch | |||
325 | @@ -0,0 +1,62 @@ | |||
326 | 1 | From: Nick Rosbrook <nick.rosbrook@canonical.com> | ||
327 | 2 | Date: Fri, 2 Dec 2022 15:26:18 -0500 | ||
328 | 3 | Subject: sd-netlink: do not swap old name and alternative name | ||
329 | 4 | |||
330 | 5 | Origin: upstream, https://github.com/systemd/systemd/commit/080afbb57c | ||
331 | 6 | Bug-Ubuntu: https://launchpad.net/bugs/2002445 | ||
332 | 7 | |||
333 | 8 | Commit 434a348380 ("netlink: do not fail when new interface name is | ||
334 | 9 | already used as an alternative name") added logic to set the old | ||
335 | 10 | interface name as an alternative name, but only when the new name is | ||
336 | 11 | currently an alternative name. This is not the desired outcome in most | ||
337 | 12 | cases, and the important part of this commit was to delete the new name | ||
338 | 13 | from the list of alternative names if necessary. | ||
339 | 14 | --- | ||
340 | 15 | src/libsystemd/sd-netlink/netlink-util.c | 13 ------------- | ||
341 | 16 | 1 file changed, 13 deletions(-) | ||
342 | 17 | |||
343 | 18 | diff --git a/src/libsystemd/sd-netlink/netlink-util.c b/src/libsystemd/sd-netlink/netlink-util.c | ||
344 | 19 | index 12cdc99..6b4c25f 100644 | ||
345 | 20 | --- a/src/libsystemd/sd-netlink/netlink-util.c | ||
346 | 21 | +++ b/src/libsystemd/sd-netlink/netlink-util.c | ||
347 | 22 | @@ -3,7 +3,6 @@ | ||
348 | 23 | #include "sd-netlink.h" | ||
349 | 24 | |||
350 | 25 | #include "fd-util.h" | ||
351 | 26 | -#include "format-util.h" | ||
352 | 27 | #include "io-util.h" | ||
353 | 28 | #include "memory-util.h" | ||
354 | 29 | #include "netlink-internal.h" | ||
355 | 30 | @@ -15,7 +14,6 @@ | ||
356 | 31 | int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) { | ||
357 | 32 | _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL; | ||
358 | 33 | _cleanup_strv_free_ char **alternative_names = NULL; | ||
359 | 34 | - char old_name[IF_NAMESIZE] = {}; | ||
360 | 35 | int r; | ||
361 | 36 | |||
362 | 37 | assert(rtnl); | ||
363 | 38 | @@ -35,10 +33,6 @@ int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) { | ||
364 | 39 | if (r < 0) | ||
365 | 40 | return log_debug_errno(r, "Failed to remove '%s' from alternative names on network interface %i: %m", | ||
366 | 41 | name, ifindex); | ||
367 | 42 | - | ||
368 | 43 | - r = format_ifname(ifindex, old_name); | ||
369 | 44 | - if (r < 0) | ||
370 | 45 | - return log_debug_errno(r, "Failed to get current name of network interface %i: %m", ifindex); | ||
371 | 46 | } | ||
372 | 47 | |||
373 | 48 | r = sd_rtnl_message_new_link(*rtnl, &message, RTM_SETLINK, ifindex); | ||
374 | 49 | @@ -53,13 +47,6 @@ int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) { | ||
375 | 50 | if (r < 0) | ||
376 | 51 | return r; | ||
377 | 52 | |||
378 | 53 | - if (!isempty(old_name)) { | ||
379 | 54 | - r = rtnl_set_link_alternative_names(rtnl, ifindex, STRV_MAKE(old_name)); | ||
380 | 55 | - if (r < 0) | ||
381 | 56 | - log_debug_errno(r, "Failed to set '%s' as an alternative name on network interface %i, ignoring: %m", | ||
382 | 57 | - old_name, ifindex); | ||
383 | 58 | - } | ||
384 | 59 | - | ||
385 | 60 | return 0; | ||
386 | 61 | } | ||
387 | 62 | |||
388 | diff --git a/debian/patches/lp2002445-sd-netlink-restore-altname-on-error-in-rtnl_set_link_name.patch b/debian/patches/lp2002445-sd-netlink-restore-altname-on-error-in-rtnl_set_link_name.patch | |||
389 | 0 | new file mode 100644 | 63 | new file mode 100644 |
390 | index 0000000..07ca306 | |||
391 | --- /dev/null | |||
392 | +++ b/debian/patches/lp2002445-sd-netlink-restore-altname-on-error-in-rtnl_set_link_name.patch | |||
393 | @@ -0,0 +1,64 @@ | |||
394 | 1 | From: Nick Rosbrook <nick.rosbrook@canonical.com> | ||
395 | 2 | Date: Wed, 2 Nov 2022 05:36:14 -0400 | ||
396 | 3 | Subject: sd-netlink: restore altname on error in rtnl_set_link_name | ||
397 | 4 | |||
398 | 5 | Origin: upstream, https://github.com/systemd/systemd/commit/4d600667f8 | ||
399 | 6 | Bug-Ubuntu: https://launchpad.net/bugs/2002445 | ||
400 | 7 | |||
401 | 8 | If a current alternative name is to be used to rename a network | ||
402 | 9 | interface, the alternative name must be removed first. If interface | ||
403 | 10 | renaming fails, restore the alternative name that was deleted if | ||
404 | 11 | necessary. | ||
405 | 12 | --- | ||
406 | 13 | src/libsystemd/sd-netlink/netlink-util.c | 19 ++++++++++++++++--- | ||
407 | 14 | 1 file changed, 16 insertions(+), 3 deletions(-) | ||
408 | 15 | |||
409 | 16 | diff --git a/src/libsystemd/sd-netlink/netlink-util.c b/src/libsystemd/sd-netlink/netlink-util.c | ||
410 | 17 | index 6b4c25f..cfcf257 100644 | ||
411 | 18 | --- a/src/libsystemd/sd-netlink/netlink-util.c | ||
412 | 19 | +++ b/src/libsystemd/sd-netlink/netlink-util.c | ||
413 | 20 | @@ -14,6 +14,7 @@ | ||
414 | 21 | int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) { | ||
415 | 22 | _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL; | ||
416 | 23 | _cleanup_strv_free_ char **alternative_names = NULL; | ||
417 | 24 | + bool altname_deleted = false; | ||
418 | 25 | int r; | ||
419 | 26 | |||
420 | 27 | assert(rtnl); | ||
421 | 28 | @@ -33,21 +34,33 @@ int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) { | ||
422 | 29 | if (r < 0) | ||
423 | 30 | return log_debug_errno(r, "Failed to remove '%s' from alternative names on network interface %i: %m", | ||
424 | 31 | name, ifindex); | ||
425 | 32 | + | ||
426 | 33 | + altname_deleted = true; | ||
427 | 34 | } | ||
428 | 35 | |||
429 | 36 | r = sd_rtnl_message_new_link(*rtnl, &message, RTM_SETLINK, ifindex); | ||
430 | 37 | if (r < 0) | ||
431 | 38 | - return r; | ||
432 | 39 | + goto fail; | ||
433 | 40 | |||
434 | 41 | r = sd_netlink_message_append_string(message, IFLA_IFNAME, name); | ||
435 | 42 | if (r < 0) | ||
436 | 43 | - return r; | ||
437 | 44 | + goto fail; | ||
438 | 45 | |||
439 | 46 | r = sd_netlink_call(*rtnl, message, 0, NULL); | ||
440 | 47 | if (r < 0) | ||
441 | 48 | - return r; | ||
442 | 49 | + goto fail; | ||
443 | 50 | |||
444 | 51 | return 0; | ||
445 | 52 | + | ||
446 | 53 | +fail: | ||
447 | 54 | + if (altname_deleted) { | ||
448 | 55 | + int q = rtnl_set_link_alternative_names(rtnl, ifindex, STRV_MAKE(name)); | ||
449 | 56 | + if (q < 0) | ||
450 | 57 | + log_debug_errno(q, "Failed to restore '%s' as an alternative name on network interface %i, ignoring: %m", | ||
451 | 58 | + name, ifindex); | ||
452 | 59 | + } | ||
453 | 60 | + | ||
454 | 61 | + return r; | ||
455 | 62 | } | ||
456 | 63 | |||
457 | 64 | int rtnl_set_link_properties( | ||
458 | diff --git a/debian/patches/lp2002445-test-network-add-a-test-for-renaming-device-to-current-al.patch b/debian/patches/lp2002445-test-network-add-a-test-for-renaming-device-to-current-al.patch | |||
459 | 0 | new file mode 100644 | 65 | new file mode 100644 |
460 | index 0000000..bea8407 | |||
461 | --- /dev/null | |||
462 | +++ b/debian/patches/lp2002445-test-network-add-a-test-for-renaming-device-to-current-al.patch | |||
463 | @@ -0,0 +1,48 @@ | |||
464 | 1 | From: Nick Rosbrook <nick.rosbrook@canonical.com> | ||
465 | 2 | Date: Wed, 7 Dec 2022 12:28:28 -0500 | ||
466 | 3 | Subject: test-network: add a test for renaming device to current altname | ||
467 | 4 | |||
468 | 5 | Origin: upstream, https://github.com/systemd/systemd/commit/f68f644a16 | ||
469 | 6 | Bug-Ubuntu: https://launchpad.net/bugs/2002445 | ||
470 | 7 | |||
471 | 8 | --- | ||
472 | 9 | test/test-network/conf/12-dummy-rename-to-altname.link | 7 +++++++ | ||
473 | 10 | test/test-network/systemd-networkd-tests.py | 11 +++++++++++ | ||
474 | 11 | 2 files changed, 18 insertions(+) | ||
475 | 12 | create mode 100644 test/test-network/conf/12-dummy-rename-to-altname.link | ||
476 | 13 | |||
477 | 14 | diff --git a/test/test-network/conf/12-dummy-rename-to-altname.link b/test/test-network/conf/12-dummy-rename-to-altname.link | ||
478 | 15 | new file mode 100644 | ||
479 | 16 | index 0000000..bef4bf3 | ||
480 | 17 | --- /dev/null | ||
481 | 18 | +++ b/test/test-network/conf/12-dummy-rename-to-altname.link | ||
482 | 19 | @@ -0,0 +1,7 @@ | ||
483 | 20 | +# SPDX-License-Identifier: LGPL-2.1-or-later | ||
484 | 21 | +[Match] | ||
485 | 22 | +OriginalName=dummy98 | ||
486 | 23 | + | ||
487 | 24 | +[Link] | ||
488 | 25 | +Name=dummyalt | ||
489 | 26 | +AlternativeName=dummyalt hogehogehogehogehogehoge | ||
490 | 27 | diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py | ||
491 | 28 | index 5a731f5..a04f302 100755 | ||
492 | 29 | --- a/test/test-network/systemd-networkd-tests.py | ||
493 | 30 | +++ b/test/test-network/systemd-networkd-tests.py | ||
494 | 31 | @@ -936,6 +936,17 @@ class NetworkctlTests(unittest.TestCase, Utilities): | ||
495 | 32 | output = check_output(*networkctl_cmd, '-n', '0', 'status', 'dummy98', env=env) | ||
496 | 33 | self.assertRegex(output, 'hogehogehogehogehogehoge') | ||
497 | 34 | |||
498 | 35 | + @expectedFailureIfAlternativeNameIsNotAvailable() | ||
499 | 36 | + def test_rename_to_altname(self): | ||
500 | 37 | + copy_network_unit('26-netdev-link-local-addressing-yes.network', | ||
501 | 38 | + '12-dummy.netdev', '12-dummy-rename-to-altname.link') | ||
502 | 39 | + start_networkd() | ||
503 | 40 | + self.wait_online(['dummyalt:degraded']) | ||
504 | 41 | + | ||
505 | 42 | + output = check_output(*networkctl_cmd, '-n', '0', 'status', 'dummyalt', env=env) | ||
506 | 43 | + self.assertIn('hogehogehogehogehogehoge', output) | ||
507 | 44 | + self.assertNotIn('dummy98', output) | ||
508 | 45 | + | ||
509 | 46 | def test_reconfigure(self): | ||
510 | 47 | copy_network_unit('25-address-static.network', '12-dummy.netdev') | ||
511 | 48 | start_networkd() | ||
512 | diff --git a/debian/patches/lp2002445-udev-attempt-device-rename-even-if-interface-is-up.patch b/debian/patches/lp2002445-udev-attempt-device-rename-even-if-interface-is-up.patch | |||
513 | 0 | new file mode 100644 | 49 | new file mode 100644 |
514 | index 0000000..4e0240e | |||
515 | --- /dev/null | |||
516 | +++ b/debian/patches/lp2002445-udev-attempt-device-rename-even-if-interface-is-up.patch | |||
517 | @@ -0,0 +1,63 @@ | |||
518 | 1 | From: Nick Rosbrook <nick.rosbrook@canonical.com> | ||
519 | 2 | Date: Fri, 2 Dec 2022 15:35:25 -0500 | ||
520 | 3 | Subject: udev: attempt device rename even if interface is up | ||
521 | 4 | |||
522 | 5 | Origin: upstream, https://github.com/systemd/systemd/commit/53584e7b61 | ||
523 | 6 | Bug-Ubuntu: https://launchpad.net/bugs/2002445 | ||
524 | 7 | |||
525 | 8 | Currently rename_netif() will not attempt to rename a device if it is | ||
526 | 9 | already up, because the kernel will return -EBUSY unless live renaming | ||
527 | 10 | is allowed on the device. This restriction will be removed in a future | ||
528 | 11 | kernel version [1]. | ||
529 | 12 | |||
530 | 13 | To cover both cases, always attempt to rename the interface and return 0 | ||
531 | 14 | if we get -EBUSY. | ||
532 | 15 | |||
533 | 16 | [1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=bd039b5ea2a9 | ||
534 | 17 | --- | ||
535 | 18 | src/udev/udev-event.c | 18 ++++++------------ | ||
536 | 19 | 1 file changed, 6 insertions(+), 12 deletions(-) | ||
537 | 20 | |||
538 | 21 | diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c | ||
539 | 22 | index b3d92d5..08d69cf 100644 | ||
540 | 23 | --- a/src/udev/udev-event.c | ||
541 | 24 | +++ b/src/udev/udev-event.c | ||
542 | 25 | @@ -862,7 +862,6 @@ int udev_event_spawn( | ||
543 | 26 | static int rename_netif(UdevEvent *event) { | ||
544 | 27 | const char *oldname; | ||
545 | 28 | sd_device *dev; | ||
546 | 29 | - unsigned flags; | ||
547 | 30 | int ifindex, r; | ||
548 | 31 | |||
549 | 32 | assert(event); | ||
550 | 33 | @@ -896,17 +895,7 @@ static int rename_netif(UdevEvent *event) { | ||
551 | 34 | return 0; | ||
552 | 35 | } | ||
553 | 36 | |||
554 | 37 | - r = rtnl_get_link_info(&event->rtnl, ifindex, NULL, &flags, NULL, NULL, NULL); | ||
555 | 38 | - if (r < 0) | ||
556 | 39 | - return log_device_warning_errno(dev, r, "Failed to get link flags: %m"); | ||
557 | 40 | - | ||
558 | 41 | - if (FLAGS_SET(flags, IFF_UP)) { | ||
559 | 42 | - log_device_info(dev, "Network interface '%s' is already up, refusing to rename to '%s'.", | ||
560 | 43 | - oldname, event->name); | ||
561 | 44 | - return 0; | ||
562 | 45 | - } | ||
563 | 46 | - | ||
564 | 47 | - /* Set ID_RENAMING boolean property here, and drop it in the corresponding move uevent later. */ | ||
565 | 48 | + /* Set ID_RENAMING boolean property here. It will be dropped when the corresponding move uevent is processed. */ | ||
566 | 49 | r = device_add_property(dev, "ID_RENAMING", "1"); | ||
567 | 50 | if (r < 0) | ||
568 | 51 | return log_device_warning_errno(dev, r, "Failed to add 'ID_RENAMING' property: %m"); | ||
569 | 52 | @@ -927,6 +916,11 @@ static int rename_netif(UdevEvent *event) { | ||
570 | 53 | return log_device_debug_errno(event->dev_db_clone, r, "Failed to update database under /run/udev/data/: %m"); | ||
571 | 54 | |||
572 | 55 | r = rtnl_set_link_name(&event->rtnl, ifindex, event->name); | ||
573 | 56 | + if (r == -EBUSY) { | ||
574 | 57 | + log_device_info(dev, "Network interface '%s' is already up, cannot rename to '%s'.", | ||
575 | 58 | + oldname, event->name); | ||
576 | 59 | + return 0; | ||
577 | 60 | + } | ||
578 | 61 | if (r < 0) | ||
579 | 62 | return log_device_error_errno(dev, r, "Failed to rename network interface %i from '%s' to '%s': %m", | ||
580 | 63 | ifindex, oldname, event->name); | ||
581 | diff --git a/debian/patches/lp2002445-udev-net-allow-new-link-name-as-an-altname-before-renamin.patch b/debian/patches/lp2002445-udev-net-allow-new-link-name-as-an-altname-before-renamin.patch | |||
582 | 0 | new file mode 100644 | 64 | new file mode 100644 |
583 | index 0000000..0b78d7f | |||
584 | --- /dev/null | |||
585 | +++ b/debian/patches/lp2002445-udev-net-allow-new-link-name-as-an-altname-before-renamin.patch | |||
586 | @@ -0,0 +1,34 @@ | |||
587 | 1 | From: Nick Rosbrook <nick.rosbrook@canonical.com> | ||
588 | 2 | Date: Wed, 2 Nov 2022 11:05:01 -0400 | ||
589 | 3 | Subject: udev/net: allow new link name as an altname before renaming happens | ||
590 | 4 | |||
591 | 5 | Origin: upstream, https://github.com/systemd/systemd/commit/d0b31efc1a | ||
592 | 6 | Bug-Ubuntu: https://launchpad.net/bugs/2002445 | ||
593 | 7 | |||
594 | 8 | When configuring a link's alternative names, the link's new name to-be | ||
595 | 9 | is not allowed to be included because interface renaming will fail if | ||
596 | 10 | the new name is already present as an alternative name. However, | ||
597 | 11 | rtnl_set_link_name will delete the conflicting alternative name before | ||
598 | 12 | renaming the device, if necessary. | ||
599 | 13 | |||
600 | 14 | Allow the new link name to be set as an alternative name before the | ||
601 | 15 | device is renamed. This means that if the rename is later skipped (i.e. | ||
602 | 16 | because the link is already up), then the name can at least still be | ||
603 | 17 | present as an alternative name. | ||
604 | 18 | --- | ||
605 | 19 | src/udev/net/link-config.c | 2 -- | ||
606 | 20 | 1 file changed, 2 deletions(-) | ||
607 | 21 | |||
608 | 22 | diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c | ||
609 | 23 | index e408725..5d28526 100644 | ||
610 | 24 | --- a/src/udev/net/link-config.c | ||
611 | 25 | +++ b/src/udev/net/link-config.c | ||
612 | 26 | @@ -841,8 +841,6 @@ static int link_apply_alternative_names(Link *link, sd_netlink **rtnl) { | ||
613 | 27 | } | ||
614 | 28 | } | ||
615 | 29 | |||
616 | 30 | - if (link->new_name) | ||
617 | 31 | - strv_remove(altnames, link->new_name); | ||
618 | 32 | strv_remove(altnames, link->ifname); | ||
619 | 33 | |||
620 | 34 | r = rtnl_get_link_alternative_names(rtnl, link->ifindex, ¤t_altnames); | ||
621 | diff --git a/debian/patches/p11kit-switch-to-dlopen.patch b/debian/patches/p11kit-switch-to-dlopen.patch | |||
622 | index 0cdb8c3..d9fd919 100644 | |||
623 | --- a/debian/patches/p11kit-switch-to-dlopen.patch | |||
624 | +++ b/debian/patches/p11kit-switch-to-dlopen.patch | |||
625 | @@ -718,10 +718,10 @@ index 85dbb81..55728c2 100644 | |||
626 | 718 | } | 718 | } |
627 | 719 | 719 | ||
628 | 720 | diff --git a/test/test-functions b/test/test-functions | 720 | diff --git a/test/test-functions b/test/test-functions |
630 | 721 | index 5613215..7f0ab56 100644 | 721 | index ae0a993..be3b686 100644 |
631 | 722 | --- a/test/test-functions | 722 | --- a/test/test-functions |
632 | 723 | +++ b/test/test-functions | 723 | +++ b/test/test-functions |
634 | 724 | @@ -1275,7 +1275,7 @@ install_missing_libraries() { | 724 | @@ -1276,7 +1276,7 @@ install_missing_libraries() { |
635 | 725 | local lib path | 725 | local lib path |
636 | 726 | # A number of dependencies is now optional via dlopen, so the install | 726 | # A number of dependencies is now optional via dlopen, so the install |
637 | 727 | # script will not pick them up, since it looks at linkage. | 727 | # script will not pick them up, since it looks at linkage. |
638 | @@ -730,7 +730,7 @@ index 5613215..7f0ab56 100644 | |||
639 | 730 | ddebug "Searching for $lib via pkg-config" | 730 | ddebug "Searching for $lib via pkg-config" |
640 | 731 | if pkg-config --exists "$lib"; then | 731 | if pkg-config --exists "$lib"; then |
641 | 732 | path="$(pkg-config --variable=libdir "$lib")" | 732 | path="$(pkg-config --variable=libdir "$lib")" |
643 | 733 | @@ -1287,6 +1287,10 @@ install_missing_libraries() { | 733 | @@ -1288,6 +1288,10 @@ install_missing_libraries() { |
644 | 734 | if ! [[ ${lib} =~ ^lib ]]; then | 734 | if ! [[ ${lib} =~ ^lib ]]; then |
645 | 735 | lib="lib${lib}" | 735 | lib="lib${lib}" |
646 | 736 | fi | 736 | fi |
647 | diff --git a/debian/patches/series b/debian/patches/series | |||
648 | index 663fefb..654d909 100644 | |||
649 | --- a/debian/patches/series | |||
650 | +++ b/debian/patches/series | |||
651 | @@ -37,9 +37,6 @@ debian/UBUNTU-Don-t-override-Ubuntu-s-default-sysctl-values-LP-1962038.patch | |||
652 | 37 | test-increase-QEMU_MEM-for-some-tests.patch | 37 | test-increase-QEMU_MEM-for-some-tests.patch |
653 | 38 | lp1981042-core-firstboot-workaround-timezone-issues-caused-by-Ubunt.patch | 38 | lp1981042-core-firstboot-workaround-timezone-issues-caused-by-Ubunt.patch |
654 | 39 | test-denylist-TEST-29-PORTABLE-again.patch | 39 | test-denylist-TEST-29-PORTABLE-again.patch |
655 | 40 | test-remove-no-longer-needed-quirk-for-set-locale-on-Debi.patch | ||
656 | 41 | test-make-sure-mount-point-exists-in-testsuite-64.sh.patch | ||
657 | 42 | test-handle-Debian-s-etc-default-locale-in-testsuite-74.f.patch | ||
658 | 43 | test-skip-some-tests-when-machine-id-is-not-initialized.patch | 40 | test-skip-some-tests-when-machine-id-is-not-initialized.patch |
659 | 44 | lp1999275-stat-util-introduce-fd_is_read_only_fs.patch | 41 | lp1999275-stat-util-introduce-fd_is_read_only_fs.patch |
660 | 45 | lp1999275-binfmt-util-split-out-binfmt_mounted.patch | 42 | lp1999275-binfmt-util-split-out-binfmt_mounted.patch |
661 | @@ -47,3 +44,10 @@ lp1999275-binfmt-util-also-check-if-binfmt-is-mounted-in-read-write.patch | |||
662 | 47 | lp1999275-binfmt-check-if-binfmt-is-mounted-before-applying-rules.patch | 44 | lp1999275-binfmt-check-if-binfmt-is-mounted-before-applying-rules.patch |
663 | 48 | lp1999275-unit-check-more-specific-path-to-be-written-by-systemd-bi.patch | 45 | lp1999275-unit-check-more-specific-path-to-be-written-by-systemd-bi.patch |
664 | 49 | debian/Skip-flaky-test_resolved_domain_restricted_dns-in-network.patch | 46 | debian/Skip-flaky-test_resolved_domain_restricted_dns-in-network.patch |
665 | 47 | lp2002445-udev-net-allow-new-link-name-as-an-altname-before-renamin.patch | ||
666 | 48 | lp2002445-sd-netlink-do-not-swap-old-name-and-alternative-name.patch | ||
667 | 49 | lp2002445-sd-netlink-restore-altname-on-error-in-rtnl_set_link_name.patch | ||
668 | 50 | lp2002445-udev-attempt-device-rename-even-if-interface-is-up.patch | ||
669 | 51 | lp2002445-sd-netlink-add-a-test-for-rtnl_set_link_name.patch | ||
670 | 52 | lp2002445-test-network-add-a-test-for-renaming-device-to-current-al.patch | ||
671 | 53 | Deny-list-TEST-74-AUX-UTILS-on-s390x.patch | ||
672 | diff --git a/debian/patches/test-handle-Debian-s-etc-default-locale-in-testsuite-74.f.patch b/debian/patches/test-handle-Debian-s-etc-default-locale-in-testsuite-74.f.patch | |||
673 | 50 | deleted file mode 100644 | 54 | deleted file mode 100644 |
674 | index e192136..0000000 | |||
675 | --- a/debian/patches/test-handle-Debian-s-etc-default-locale-in-testsuite-74.f.patch | |||
676 | +++ /dev/null | |||
677 | @@ -1,107 +0,0 @@ | |||
678 | 1 | From: Nick Rosbrook <nick.rosbrook@canonical.com> | ||
679 | 2 | Date: Tue, 22 Nov 2022 12:50:33 -0500 | ||
680 | 3 | Subject: test: handle Debian's /etc/default/locale in | ||
681 | 4 | testsuite-74.firstboot.sh | ||
682 | 5 | |||
683 | 6 | Origin: upstream, https://github.com/systemd/systemd/commit/bb59fdc1e3a7119f3680d309147020fce9bf67b5 | ||
684 | 7 | |||
685 | 8 | This handles a Debian-specific quirk where /etc/default/locale is used | ||
686 | 9 | instead of /etc/locale.conf. There is currently special handling for | ||
687 | 10 | this in testsuite-73.sh, so the quirk should be handled here too for | ||
688 | 11 | consistency. | ||
689 | 12 | |||
690 | 13 | This patch was modified to apply to v251.1. | ||
691 | 14 | --- | ||
692 | 15 | test/units/testsuite-74.firstboot.sh | 40 ++++++++++++++++-------------------- | ||
693 | 16 | 1 file changed, 18 insertions(+), 22 deletions(-) | ||
694 | 17 | |||
695 | 18 | diff --git a/test/units/testsuite-74.firstboot.sh b/test/units/testsuite-74.firstboot.sh | ||
696 | 19 | index 02f9f5c..1bcc3da 100755 | ||
697 | 20 | --- a/test/units/testsuite-74.firstboot.sh | ||
698 | 21 | +++ b/test/units/testsuite-74.firstboot.sh | ||
699 | 22 | @@ -24,6 +24,12 @@ ROOT_HASHED_PASSWORD1='$6$foobarsalt$YbwdaATX6IsFxvWbY3QcZj2gB31R/LFRFrjlFrJtTTq | ||
700 | 23 | # shellcheck disable=SC2016 | ||
701 | 24 | ROOT_HASHED_PASSWORD2='$6$foobarsalt$q.P2932zYMLbKnjFwIxPI8y3iuxeuJ2BgE372LcZMMnj3Gcg/9mJg2LPKUl.ha0TG/.fRNNnRQcLfzM0SNot3.' | ||
702 | 25 | |||
703 | 26 | +# Debian and Ubuntu use /etc/default/locale instead of /etc/locale.conf. Make | ||
704 | 27 | +# sure we use the appropriate path for locale configuration. | ||
705 | 28 | +LOCALE_PATH="/etc/locale.conf" | ||
706 | 29 | +[ -e "$LOCALE_PATH" ] || LOCALE_PATH="/etc/default/locale" | ||
707 | 30 | +[ -e "$LOCALE_PATH" ] || systemd-firstboot --locale=C.UTF-8 | ||
708 | 31 | + | ||
709 | 32 | # Create a minimal root so we don't modify the testbed | ||
710 | 33 | ROOT=test-root | ||
711 | 34 | mkdir -p "$ROOT/bin" | ||
712 | 35 | @@ -31,15 +37,15 @@ mkdir -p "$ROOT/bin" | ||
713 | 36 | touch "$ROOT/bin/fooshell" "$ROOT/bin/barshell" | ||
714 | 37 | |||
715 | 38 | systemd-firstboot --root="$ROOT" --locale=foo | ||
716 | 39 | -grep -q "LANG=foo" "$ROOT/etc/locale.conf" | ||
717 | 40 | -rm -fv "$ROOT/etc/locale.conf" | ||
718 | 41 | +grep -q "LANG=foo" "$ROOT$LOCALE_PATH" | ||
719 | 42 | +rm -fv "$ROOT$LOCALE_PATH" | ||
720 | 43 | # FIXME: https://github.com/systemd/systemd/issues/25249 | ||
721 | 44 | #systemd-firstboot --root="$ROOT" --locale-messages=foo | ||
722 | 45 | -#grep -q "LC_MESSAGES=foo" "$ROOT/etc/locale.conf" | ||
723 | 46 | -#rm -fv "$ROOT/etc/locale.conf" | ||
724 | 47 | +#grep -q "LC_MESSAGES=foo" "$ROOT$LOCALE_PATH" | ||
725 | 48 | +#rm -fv "$ROOT$LOCALE_PATH" | ||
726 | 49 | systemd-firstboot --root="$ROOT" --locale=foo --locale-messages=bar | ||
727 | 50 | -grep -q "LANG=foo" "$ROOT/etc/locale.conf" | ||
728 | 51 | -grep -q "LC_MESSAGES=bar" "$ROOT/etc/locale.conf" | ||
729 | 52 | +grep -q "LANG=foo" "$ROOT$LOCALE_PATH" | ||
730 | 53 | +grep -q "LC_MESSAGES=bar" "$ROOT$LOCALE_PATH" | ||
731 | 54 | |||
732 | 55 | systemd-firstboot --root="$ROOT" --keymap=foo | ||
733 | 56 | grep -q "KEYMAP=foo" "$ROOT/etc/vconsole.conf" | ||
734 | 57 | @@ -83,8 +89,8 @@ systemd-firstboot --root="$ROOT" \ | ||
735 | 58 | --root-password-hashed="$ROOT_HASHED_PASSWORD2" \ | ||
736 | 59 | --root-shell=/bin/barshell \ | ||
737 | 60 | --kernel-command-line="hello.world=0" | ||
738 | 61 | -grep -q "LANG=foo" "$ROOT/etc/locale.conf" | ||
739 | 62 | -grep -q "LC_MESSAGES=bar" "$ROOT/etc/locale.conf" | ||
740 | 63 | +grep -q "LANG=foo" "$ROOT$LOCALE_PATH" | ||
741 | 64 | +grep -q "LC_MESSAGES=bar" "$ROOT$LOCALE_PATH" | ||
742 | 65 | grep -q "KEYMAP=foo" "$ROOT/etc/vconsole.conf" | ||
743 | 66 | readlink "$ROOT/etc/localtime" | grep -q "Europe/Berlin$" | ||
744 | 67 | grep -q "foobar" "$ROOT/etc/hostname" | ||
745 | 68 | @@ -104,8 +110,8 @@ systemd-firstboot --root="$ROOT" --force \ | ||
746 | 69 | --root-password-hashed="$ROOT_HASHED_PASSWORD2" \ | ||
747 | 70 | --root-shell=/bin/barshell \ | ||
748 | 71 | --kernel-command-line="hello.world=0" | ||
749 | 72 | -grep -q "LANG=locale-overwrite" "$ROOT/etc/locale.conf" | ||
750 | 73 | -grep -q "LC_MESSAGES=messages-overwrite" "$ROOT/etc/locale.conf" | ||
751 | 74 | +grep -q "LANG=locale-overwrite" "$ROOT$LOCALE_PATH" | ||
752 | 75 | +grep -q "LC_MESSAGES=messages-overwrite" "$ROOT$LOCALE_PATH" | ||
753 | 76 | grep -q "KEYMAP=keymap-overwrite" "$ROOT/etc/vconsole.conf" | ||
754 | 77 | readlink "$ROOT/etc/localtime" | grep -q "/CET$" | ||
755 | 78 | grep -q "hostname-overwrite" "$ROOT/etc/hostname" | ||
756 | 79 | @@ -119,7 +125,7 @@ rm -fr "$ROOT" | ||
757 | 80 | mkdir "$ROOT" | ||
758 | 81 | # Copy everything at once (--copy) | ||
759 | 82 | systemd-firstboot --root="$ROOT" --copy | ||
760 | 83 | -diff /etc/locale.conf "$ROOT/etc/locale.conf" | ||
761 | 84 | +diff $LOCALE_PATH "$ROOT$LOCALE_PATH" | ||
762 | 85 | diff <(awk -F: '/^root/ { print $7; }' /etc/passwd) <(awk -F: '/^root/ { print $7; }' "$ROOT/etc/passwd") | ||
763 | 86 | diff <(awk -F: '/^root/ { print $2; }' /etc/shadow) <(awk -F: '/^root/ { print $2; }' "$ROOT/etc/shadow") | ||
764 | 87 | [[ -e /etc/vconsole.conf ]] && diff /etc/vconsole.conf "$ROOT/etc/vconsole.conf" | ||
765 | 88 | @@ -128,18 +134,8 @@ rm -fr "$ROOT" | ||
766 | 89 | mkdir "$ROOT" | ||
767 | 90 | # Copy everything at once, but now by using separate switches | ||
768 | 91 | systemd-firstboot --root="$ROOT" --copy-locale --copy-keymap --copy-timezone --copy-root-password --copy-root-shell | ||
769 | 92 | -diff /etc/locale.conf "$ROOT/etc/locale.conf" | ||
770 | 93 | +diff $LOCALE_PATH "$ROOT$LOCALE_PATH" | ||
771 | 94 | diff <(awk -F: '/^root/ { print $7; }' /etc/passwd) <(awk -F: '/^root/ { print $7; }' "$ROOT/etc/passwd") | ||
772 | 95 | diff <(awk -F: '/^root/ { print $2; }' /etc/shadow) <(awk -F: '/^root/ { print $2; }' "$ROOT/etc/shadow") | ||
773 | 96 | [[ -e /etc/vconsole.conf ]] && diff /etc/vconsole.conf "$ROOT/etc/vconsole.conf" | ||
774 | 97 | [[ -e /etc/localtime ]] && diff <(readlink /etc/localtime) <(readlink "$ROOT/etc/localtime") | ||
775 | 98 | - | ||
776 | 99 | -# Assorted tests | ||
777 | 100 | -rm -fr "$ROOT" | ||
778 | 101 | -mkdir "$ROOT" | ||
779 | 102 | - | ||
780 | 103 | -systemd-firstboot --root="$ROOT" --setup-machine-id | ||
781 | 104 | -grep -E "[a-z0-9]{32}" "$ROOT/etc/machine-id" | ||
782 | 105 | - | ||
783 | 106 | -systemd-firstboot --root="$ROOT" --delete-root-password | ||
784 | 107 | -diff <(echo) <(awk -F: '/^root/ { print $2; }' "$ROOT/etc/shadow") | ||
785 | diff --git a/debian/patches/test-make-sure-mount-point-exists-in-testsuite-64.sh.patch b/debian/patches/test-make-sure-mount-point-exists-in-testsuite-64.sh.patch | |||
786 | 108 | deleted file mode 100644 | 0 | deleted file mode 100644 |
787 | index ab71bce..0000000 | |||
788 | --- a/debian/patches/test-make-sure-mount-point-exists-in-testsuite-64.sh.patch | |||
789 | +++ /dev/null | |||
790 | @@ -1,22 +0,0 @@ | |||
791 | 1 | From: Nick Rosbrook <nick.rosbrook@canonical.com> | ||
792 | 2 | Date: Tue, 22 Nov 2022 12:43:51 -0500 | ||
793 | 3 | Subject: test: make sure mount point exists in testsuite-64.sh | ||
794 | 4 | |||
795 | 5 | Origin: upstream, https://github.com/systemd/systemd/commit/84e5b9225d12f8a1a7d414ef01f97fcd6881c14f | ||
796 | 6 | |||
797 | 7 | --- | ||
798 | 8 | test/units/testsuite-64.sh | 1 + | ||
799 | 9 | 1 file changed, 1 insertion(+) | ||
800 | 10 | |||
801 | 11 | diff --git a/test/units/testsuite-64.sh b/test/units/testsuite-64.sh | ||
802 | 12 | index 7673036..8e46533 100755 | ||
803 | 13 | --- a/test/units/testsuite-64.sh | ||
804 | 14 | +++ b/test/units/testsuite-64.sh | ||
805 | 15 | @@ -243,6 +243,7 @@ EOF | ||
806 | 16 | echo "${FUNCNAME[0]}: test failover" | ||
807 | 17 | local device expected link mpoint part | ||
808 | 18 | local -a devices | ||
809 | 19 | + mkdir -p /mnt | ||
810 | 20 | mpoint="$(mktemp -d /mnt/mpathXXX)" | ||
811 | 21 | wwid="deaddeadbeef0000" | ||
812 | 22 | path="/dev/disk/by-id/wwn-0x$wwid" | ||
813 | diff --git a/debian/patches/test-remove-no-longer-needed-quirk-for-set-locale-on-Debi.patch b/debian/patches/test-remove-no-longer-needed-quirk-for-set-locale-on-Debi.patch | |||
814 | 23 | deleted file mode 100644 | 0 | deleted file mode 100644 |
815 | index 0adbd1f..0000000 | |||
816 | --- a/debian/patches/test-remove-no-longer-needed-quirk-for-set-locale-on-Debi.patch | |||
817 | +++ /dev/null | |||
818 | @@ -1,23 +0,0 @@ | |||
819 | 1 | From: Nick Rosbrook <nick.rosbrook@canonical.com> | ||
820 | 2 | Date: Thu, 17 Nov 2022 11:29:03 -0500 | ||
821 | 3 | Subject: test: remove no-longer-needed quirk for set-locale on Debian/Ubuntu | ||
822 | 4 | |||
823 | 5 | --- | ||
824 | 6 | test/units/testsuite-73.sh | 4 +--- | ||
825 | 7 | 1 file changed, 1 insertion(+), 3 deletions(-) | ||
826 | 8 | |||
827 | 9 | diff --git a/test/units/testsuite-73.sh b/test/units/testsuite-73.sh | ||
828 | 10 | index f9e2dce..1e493c0 100755 | ||
829 | 11 | --- a/test/units/testsuite-73.sh | ||
830 | 12 | +++ b/test/units/testsuite-73.sh | ||
831 | 13 | @@ -118,9 +118,7 @@ LC_CTYPE=$i" | ||
832 | 14 | |||
833 | 15 | assert_rc 0 localectl set-locale "$i" | ||
834 | 16 | if [[ -f /etc/default/locale ]]; then | ||
835 | 17 | - # Debian/Ubuntu patch is buggy, and LC_CTYPE= still exists. | ||
836 | 18 | - assert_eq "$(cat /etc/default/locale)" "LANG=$i | ||
837 | 19 | -LC_CTYPE=$i" | ||
838 | 20 | + assert_eq "$(cat /etc/default/locale)" "LANG=$i" | ||
839 | 21 | else | ||
840 | 22 | assert_eq "$(cat /etc/locale.conf)" "LANG=$i" | ||
841 | 23 | fi | ||
842 | diff --git a/debian/rules b/debian/rules | |||
843 | index 73ef33f..ce2c49f 100755 | |||
844 | --- a/debian/rules | |||
845 | +++ b/debian/rules | |||
846 | @@ -100,6 +100,7 @@ CONFFLAGS = \ | |||
847 | 100 | -Dnss-resolve=true \ | 100 | -Dnss-resolve=true \ |
848 | 101 | -Dnss-systemd=true \ | 101 | -Dnss-systemd=true \ |
849 | 102 | -Dresolve=true \ | 102 | -Dresolve=true \ |
850 | 103 | -Dstatus-unit-format-default=combined \ | ||
851 | 103 | -Dstandalone-binaries=true | 104 | -Dstandalone-binaries=true |
852 | 104 | 105 | ||
853 | 105 | ifeq (, $(filter stage1, $(DEB_BUILD_PROFILES))) | 106 | ifeq (, $(filter stage1, $(DEB_BUILD_PROFILES))) |
854 | diff --git a/debian/tests/boot-and-services b/debian/tests/boot-and-services | |||
855 | index 4c2d7a8..fc0eb9b 100755 | |||
856 | --- a/debian/tests/boot-and-services | |||
857 | +++ b/debian/tests/boot-and-services | |||
858 | @@ -119,7 +119,7 @@ class ServicesTest(unittest.TestCase): | |||
859 | 119 | # has kernel messages | 119 | # has kernel messages |
860 | 120 | self.assertRegex(log, 'kernel:.*') | 120 | self.assertRegex(log, 'kernel:.*') |
861 | 121 | # has init messages | 121 | # has init messages |
863 | 122 | self.assertRegex(log, 'systemd.*Reached target Graphical Interface') | 122 | self.assertRegex(log, 'systemd.*Reached target(?: graphical.target -)? Graphical Interface') |
864 | 123 | # has other services | 123 | # has other services |
865 | 124 | self.assertRegex(log, 'NetworkManager.*:') | 124 | self.assertRegex(log, 'NetworkManager.*:') |
866 | 125 | 125 | ||
867 | @@ -199,7 +199,7 @@ class JournalTest(unittest.TestCase): | |||
868 | 199 | # has kernel messages | 199 | # has kernel messages |
869 | 200 | self.assertRegex(out, b'kernel:.*') | 200 | self.assertRegex(out, b'kernel:.*') |
870 | 201 | # has init messages | 201 | # has init messages |
872 | 202 | self.assertRegex(out, b'systemd.*Reached target Graphical Interface') | 202 | self.assertRegex(out, b'systemd.*Reached target(?: graphical.target -)? Graphical Interface') |
873 | 203 | # has other services | 203 | # has other services |
874 | 204 | self.assertRegex(out, b'NetworkManager.*:.*starting') | 204 | self.assertRegex(out, b'NetworkManager.*:.*starting') |
875 | 205 | 205 | ||
876 | diff --git a/debian/tests/control b/debian/tests/control | |||
877 | index 34a3a05..0e0a97c 100644 | |||
878 | --- a/debian/tests/control | |||
879 | +++ b/debian/tests/control | |||
880 | @@ -48,6 +48,7 @@ Depends: systemd, | |||
881 | 48 | cryptsetup-bin, | 48 | cryptsetup-bin, |
882 | 49 | systemd-sysv, | 49 | systemd-sysv, |
883 | 50 | polkitd | policykit-1, | 50 | polkitd | policykit-1, |
884 | 51 | netlabel-tools, | ||
885 | 51 | dnsmasq-base | 52 | dnsmasq-base |
886 | 52 | Restrictions: needs-root, isolation-container, breaks-testbed | 53 | Restrictions: needs-root, isolation-container, breaks-testbed |
887 | 53 | 54 | ||
888 | @@ -182,6 +183,8 @@ Depends: systemd-tests, | |||
889 | 182 | squashfs-tools, | 183 | squashfs-tools, |
890 | 183 | vim-tiny, | 184 | vim-tiny, |
891 | 184 | dosfstools, | 185 | dosfstools, |
892 | 186 | mtools, | ||
893 | 187 | erofs-utils, | ||
894 | 185 | libdw-dev, | 188 | libdw-dev, |
895 | 186 | libelf-dev, | 189 | libelf-dev, |
896 | 187 | dbus-user-session, | 190 | dbus-user-session, |
897 | @@ -195,6 +198,16 @@ Depends: systemd-tests, | |||
898 | 195 | tpm2-tools, | 198 | tpm2-tools, |
899 | 196 | libgcc-s1, | 199 | libgcc-s1, |
900 | 197 | openssl, | 200 | openssl, |
901 | 201 | bsdutils, | ||
902 | 202 | knot, | ||
903 | 203 | knot-dnssecutils | knot-dnsutils, | ||
904 | 204 | bind9-dnsutils, | ||
905 | 205 | bind9-host, | ||
906 | 206 | jq, | ||
907 | 207 | psmisc, | ||
908 | 208 | xkb-data, | ||
909 | 209 | locales, | ||
910 | 210 | locales-all, | ||
911 | 198 | Restrictions: needs-root, allow-stderr, isolation-machine | 211 | Restrictions: needs-root, allow-stderr, isolation-machine |
912 | 199 | 212 | ||
913 | 200 | Tests: boot-smoke | 213 | Tests: boot-smoke |
914 | @@ -205,11 +218,3 @@ Depends: systemd-sysv, | |||
915 | 205 | systemd, | 218 | systemd, |
916 | 206 | udev, | 219 | udev, |
917 | 207 | Restrictions: needs-root, isolation-container, allow-stderr, breaks-testbed | 220 | Restrictions: needs-root, isolation-container, allow-stderr, breaks-testbed |
918 | 208 | |||
919 | 209 | # NOUPSTREAM: Do not run these tests for upstream builds | ||
920 | 210 | |||
921 | 211 | Tests: systemd-fsckd | ||
922 | 212 | Depends: systemd-sysv, | ||
923 | 213 | python3, | ||
924 | 214 | plymouth | ||
925 | 215 | Restrictions: needs-root, isolation-machine, breaks-testbed, skippable, flaky | ||
926 | diff --git a/debian/tests/fsck b/debian/tests/fsck | |||
927 | 216 | deleted file mode 100755 | 221 | deleted file mode 100755 |
928 | index 77b50d7..0000000 | |||
929 | --- a/debian/tests/fsck | |||
930 | +++ /dev/null | |||
931 | @@ -1,27 +0,0 @@ | |||
932 | 1 | #!/bin/bash | ||
933 | 2 | fd=0 | ||
934 | 3 | |||
935 | 4 | OPTIND=1 | ||
936 | 5 | while getopts "C:aTlM" opt; do | ||
937 | 6 | case "$opt" in | ||
938 | 7 | C) | ||
939 | 8 | fd=$OPTARG | ||
940 | 9 | ;; | ||
941 | 10 | \?);; | ||
942 | 11 | esac | ||
943 | 12 | done | ||
944 | 13 | |||
945 | 14 | shift "$((OPTIND-1))" | ||
946 | 15 | device=$1 | ||
947 | 16 | |||
948 | 17 | echo "Running fake fsck on $device" | ||
949 | 18 | |||
950 | 19 | declare -a maxpass=(30 5 2 30 60) | ||
951 | 20 | |||
952 | 21 | for pass in {1..5}; do | ||
953 | 22 | maxprogress=${maxpass[$((pass-1))]} | ||
954 | 23 | for (( current=0; current<=${maxprogress}; current++)); do | ||
955 | 24 | echo "$pass $current $maxprogress $device">&$fd | ||
956 | 25 | sleep 0.1 | ||
957 | 26 | done | ||
958 | 27 | done | ||
959 | diff --git a/debian/tests/systemd-fsckd b/debian/tests/systemd-fsckd | |||
960 | 28 | deleted file mode 100755 | 0 | deleted file mode 100755 |
961 | index 7f5e535..0000000 | |||
962 | --- a/debian/tests/systemd-fsckd | |||
963 | +++ /dev/null | |||
964 | @@ -1,323 +0,0 @@ | |||
965 | 1 | #!/usr/bin/python3 | ||
966 | 2 | # autopkgtest check: Ensure that systemd-fsckd can report progress and cancel | ||
967 | 3 | # (C) 2015 Canonical Ltd. | ||
968 | 4 | # Author: Didier Roche <didrocks@ubuntu.com> | ||
969 | 5 | |||
970 | 6 | import fileinput | ||
971 | 7 | import inspect | ||
972 | 8 | import os | ||
973 | 9 | import platform | ||
974 | 10 | import re | ||
975 | 11 | import shutil | ||
976 | 12 | import stat | ||
977 | 13 | import subprocess | ||
978 | 14 | import sys | ||
979 | 15 | import time | ||
980 | 16 | import unittest | ||
981 | 17 | |||
982 | 18 | from contextlib import suppress | ||
983 | 19 | from pathlib import Path | ||
984 | 20 | |||
985 | 21 | SYSTEMD_FSCK_ROOT_DROPIN_PATH = '/etc/systemd/system/systemd-fsck-root.service.d/autopkgtest.conf' | ||
986 | 22 | SYSTEMD_FSCK_ROOT_DROPIN_CONTENT = ''' | ||
987 | 23 | [Unit] | ||
988 | 24 | ConditionPathIsReadWrite= | ||
989 | 25 | ConditionPathExists= | ||
990 | 26 | |||
991 | 27 | [Install] | ||
992 | 28 | WantedBy=local-fs.target | ||
993 | 29 | ''' | ||
994 | 30 | |||
995 | 31 | KILL_SERVICE_PATH = '/etc/systemd/system/kill@.service' | ||
996 | 32 | KILL_SERVICE_CONTENT = ''' | ||
997 | 33 | [Unit] | ||
998 | 34 | DefaultDependencies=no | ||
999 | 35 | StartLimitInterval=0 | ||
1000 | 36 | Before=systemd-fsckd.service | ||
1001 | 37 | |||
1002 | 38 | [Service] | ||
1003 | 39 | RestartSec=1 | ||
1004 | 40 | Restart=on-failure | ||
1005 | 41 | ExecStart=/bin/sh -c "/bin/sleep 5; /usr/bin/pkill -x %i" | ||
1006 | 42 | |||
1007 | 43 | [Install] | ||
1008 | 44 | WantedBy=systemd-fsckd.service | ||
1009 | 45 | ''' | ||
1010 | 46 | |||
1011 | 47 | DEFAULT_SYSTEM_RUNNING_TIMEOUT = 600 | ||
1012 | 48 | DEFAULT_SYSTEMD_FSCKD_TIMEOUT = 600 | ||
1013 | 49 | |||
1014 | 50 | FSCK_PATH = '/sbin/fsck' | ||
1015 | 51 | FSCK_BACKUP_PATH = '/sbin/fsck.backup' | ||
1016 | 52 | |||
1017 | 53 | RE_SPLASH_QUIET = r'\b\s*(splash|quiet)\b' | ||
1018 | 54 | |||
1019 | 55 | |||
1020 | 56 | def tests_setup(): | ||
1021 | 57 | # enable persistent journal | ||
1022 | 58 | Path('/var/log/journal').mkdir(parents=True, exist_ok=True) | ||
1023 | 59 | subprocess.run('systemctl -q restart systemd-journald'.split()) | ||
1024 | 60 | Path(SYSTEMD_FSCK_ROOT_DROPIN_PATH).parent.mkdir(parents=True, exist_ok=True) | ||
1025 | 61 | Path(SYSTEMD_FSCK_ROOT_DROPIN_PATH).write_text(SYSTEMD_FSCK_ROOT_DROPIN_CONTENT) | ||
1026 | 62 | Path(KILL_SERVICE_PATH).parent.mkdir(parents=True, exist_ok=True) | ||
1027 | 63 | Path(KILL_SERVICE_PATH).write_text(KILL_SERVICE_CONTENT) | ||
1028 | 64 | subprocess.run('systemctl -q daemon-reload'.split()) | ||
1029 | 65 | subprocess.run('systemctl -q enable systemd-fsck-root'.split()) | ||
1030 | 66 | Path(FSCK_PATH).rename(FSCK_BACKUP_PATH) | ||
1031 | 67 | Path(FSCK_PATH).write_text(Path(__file__).with_name('fsck').read_text()) | ||
1032 | 68 | Path(FSCK_PATH).chmod(0o755) | ||
1033 | 69 | |||
1034 | 70 | def tests_teardown(): | ||
1035 | 71 | Path('/etc/systemd/system/local-fs.target.wants/systemd-fsck-root.service').unlink() | ||
1036 | 72 | subprocess.run('systemctl -q disable systemd-fsck-root'.split()) | ||
1037 | 73 | Path(SYSTEMD_FSCK_ROOT_DROPIN_PATH).unlink() | ||
1038 | 74 | Path(KILL_SERVICE_PATH).unlink() | ||
1039 | 75 | subprocess.run('systemctl -q daemon-reload'.split()) | ||
1040 | 76 | Path(FSCK_BACKUP_PATH).replace(FSCK_PATH) | ||
1041 | 77 | |||
1042 | 78 | def is_system_running(): | ||
1043 | 79 | running = subprocess.run('systemctl is-system-running'.split(), | ||
1044 | 80 | encoding='utf-8', | ||
1045 | 81 | stdout=subprocess.PIPE).stdout.strip() | ||
1046 | 82 | return running in ['running', 'degraded'] | ||
1047 | 83 | |||
1048 | 84 | def is_unit_active(unit): | ||
1049 | 85 | return subprocess.run(f'systemctl -q is-active {unit}'.split()).returncode == 0 | ||
1050 | 86 | |||
1051 | 87 | def has_unit_failed(unit): | ||
1052 | 88 | '''check if this unit failed at least once, this boot''' | ||
1053 | 89 | journal = subprocess.run(f'journalctl -b -u {unit}'.split(), | ||
1054 | 90 | encoding='utf-8', | ||
1055 | 91 | stdout=subprocess.PIPE).stdout.strip() | ||
1056 | 92 | return f'{unit}.service: Failed' in journal | ||
1057 | 93 | |||
1058 | 94 | def has_unit_started(unit): | ||
1059 | 95 | return subprocess.run(f'systemctl show --value -p ExecMainStartTimestampMonotonic {unit}'.split(), | ||
1060 | 96 | encoding='utf-8', | ||
1061 | 97 | stdout=subprocess.PIPE).stdout.strip() != '0' | ||
1062 | 98 | |||
1063 | 99 | def get_unit_exec_status(unit): | ||
1064 | 100 | return subprocess.run(f'systemctl show --value -p ExecMainStatus {unit}'.split(), | ||
1065 | 101 | encoding='utf-8', | ||
1066 | 102 | stdout=subprocess.PIPE).stdout.strip() | ||
1067 | 103 | |||
1068 | 104 | class FsckdTest(unittest.TestCase): | ||
1069 | 105 | '''Check that we run, report and can cancel fsck''' | ||
1070 | 106 | def __init__(self, test_name, after_reboot): | ||
1071 | 107 | super().__init__(test_name) | ||
1072 | 108 | self._test_name = test_name | ||
1073 | 109 | self._after_reboot = after_reboot | ||
1074 | 110 | |||
1075 | 111 | def setUp(self): | ||
1076 | 112 | super().setUp() | ||
1077 | 113 | if self._after_reboot: | ||
1078 | 114 | self.wait_system_running() | ||
1079 | 115 | self.wait_systemd_fsckd() | ||
1080 | 116 | else: | ||
1081 | 117 | configure_plymouth() | ||
1082 | 118 | |||
1083 | 119 | def tearDown(self): | ||
1084 | 120 | super().tearDown() | ||
1085 | 121 | |||
1086 | 122 | def enable_kill_service(self, proc): | ||
1087 | 123 | subprocess.run(f'systemctl -q enable kill@{proc}'.split()) | ||
1088 | 124 | |||
1089 | 125 | def disable_kill_service(self, proc): | ||
1090 | 126 | subprocess.run(f'systemctl -q disable kill@{proc}'.split()) | ||
1091 | 127 | |||
1092 | 128 | def wait_system_running(self, timeout=DEFAULT_SYSTEM_RUNNING_TIMEOUT): | ||
1093 | 129 | end = time.monotonic() + timeout | ||
1094 | 130 | while time.monotonic() <= end: | ||
1095 | 131 | if is_system_running(): | ||
1096 | 132 | return | ||
1097 | 133 | time.sleep(1) | ||
1098 | 134 | self.fail('timeout waiting for system running') | ||
1099 | 135 | |||
1100 | 136 | def wait_systemd_fsckd(self, timeout=DEFAULT_SYSTEMD_FSCKD_TIMEOUT): | ||
1101 | 137 | end = time.monotonic() + timeout | ||
1102 | 138 | while time.monotonic() <= end: | ||
1103 | 139 | if not is_unit_active('systemd-fsckd'): | ||
1104 | 140 | return | ||
1105 | 141 | time.sleep(1) | ||
1106 | 142 | self.fail('timeout waiting for systemd-fsckd to finish') | ||
1107 | 143 | |||
1108 | 144 | def check_systemd_fsckd(self): | ||
1109 | 145 | unit = 'systemd-fsckd' | ||
1110 | 146 | self.assertUnitStarted(unit) | ||
1111 | 147 | self.assertUnitNotActive(unit) | ||
1112 | 148 | self.assertSystemdFsckdNotFailed() | ||
1113 | 149 | |||
1114 | 150 | def check_systemd_fsck_root(self): | ||
1115 | 151 | unit = 'systemd-fsck-root' | ||
1116 | 152 | self.assertUnitStarted(unit) | ||
1117 | 153 | self.assertUnitActive(unit) | ||
1118 | 154 | self.assertUnitNotFailed(unit) | ||
1119 | 155 | |||
1120 | 156 | def check_plymouth_start(self): | ||
1121 | 157 | unit = 'plymouth-start' | ||
1122 | 158 | self.assertUnitStarted(unit) | ||
1123 | 159 | # stays active in 20.10 and later | ||
1124 | 160 | self.assertUnitActive(unit) | ||
1125 | 161 | self.assertUnitNotFailed(unit) | ||
1126 | 162 | |||
1127 | 163 | def test_systemd_fsckd_run(self): | ||
1128 | 164 | '''Ensure we can boot after a fsck was processed''' | ||
1129 | 165 | if not self._after_reboot: | ||
1130 | 166 | self.reboot() | ||
1131 | 167 | else: | ||
1132 | 168 | self.check_systemd_fsckd() | ||
1133 | 169 | self.check_systemd_fsck_root() | ||
1134 | 170 | self.check_plymouth_start() | ||
1135 | 171 | |||
1136 | 172 | def test_systemd_fsckd_run_without_plymouth(self): | ||
1137 | 173 | '''Ensure we can boot without plymouth after a fsck was processed''' | ||
1138 | 174 | if not self._after_reboot: | ||
1139 | 175 | configure_plymouth(enable=False) | ||
1140 | 176 | self.reboot() | ||
1141 | 177 | else: | ||
1142 | 178 | self.check_systemd_fsckd() | ||
1143 | 179 | self.check_systemd_fsck_root() | ||
1144 | 180 | self.assertUnitNeverStarted('plymouth-start') | ||
1145 | 181 | |||
1146 | 182 | def test_fsck_failure(self): | ||
1147 | 183 | '''Ensure that a failing fsck doesn't prevent fsckd to stop''' | ||
1148 | 184 | if not self._after_reboot: | ||
1149 | 185 | self.enable_kill_service('fsck') | ||
1150 | 186 | self.reboot() | ||
1151 | 187 | else: | ||
1152 | 188 | self.check_systemd_fsckd() | ||
1153 | 189 | self.assertUnitFailed('systemd-fsck-root') | ||
1154 | 190 | self.check_plymouth_start() | ||
1155 | 191 | self.disable_kill_service('fsck') | ||
1156 | 192 | |||
1157 | 193 | def test_systemd_fsck_failure(self): | ||
1158 | 194 | '''Ensure that a failing systemd-fsck doesn't prevent fsckd to stop''' | ||
1159 | 195 | if not self._after_reboot: | ||
1160 | 196 | self.enable_kill_service('systemd-fsck') | ||
1161 | 197 | self.reboot() | ||
1162 | 198 | else: | ||
1163 | 199 | self.check_systemd_fsckd() | ||
1164 | 200 | self.assertUnitFailed('systemd-fsck-root') | ||
1165 | 201 | self.check_plymouth_start() | ||
1166 | 202 | self.disable_kill_service('systemd-fsck') | ||
1167 | 203 | |||
1168 | 204 | def test_systemd_fsckd_failure(self): | ||
1169 | 205 | '''Ensure that a failing systemd-fsckd doesn't prevent system to boot''' | ||
1170 | 206 | if not self._after_reboot: | ||
1171 | 207 | self.enable_kill_service('systemd-fsckd') | ||
1172 | 208 | self.reboot() | ||
1173 | 209 | else: | ||
1174 | 210 | self.assertSystemdFsckdFailed() | ||
1175 | 211 | self.assertUnitFailed('systemd-fsck-root') | ||
1176 | 212 | self.check_plymouth_start() | ||
1177 | 213 | self.disable_kill_service('systemd-fsckd') | ||
1178 | 214 | |||
1179 | 215 | def assertUnitActive(self, unit): | ||
1180 | 216 | self.assertTrue(is_unit_active(unit)) | ||
1181 | 217 | |||
1182 | 218 | def assertUnitNotActive(self, unit): | ||
1183 | 219 | self.assertFalse(is_unit_active(unit)) | ||
1184 | 220 | |||
1185 | 221 | def assertUnitFailed(self, unit): | ||
1186 | 222 | self.assertTrue(has_unit_failed(unit)) | ||
1187 | 223 | |||
1188 | 224 | def assertUnitNotFailed(self, unit): | ||
1189 | 225 | self.assertFalse(has_unit_failed(unit)) | ||
1190 | 226 | |||
1191 | 227 | def assertUnitStarted(self, unit): | ||
1192 | 228 | self.assertTrue(has_unit_started(unit)) | ||
1193 | 229 | |||
1194 | 230 | def assertUnitNeverStarted(self, unit): | ||
1195 | 231 | self.assertFalse(has_unit_started(unit)) | ||
1196 | 232 | |||
1197 | 233 | def assertSystemdFsckdFailed(self): | ||
1198 | 234 | self.assertNotEqual(get_unit_exec_status('systemd-fsckd'), '0') | ||
1199 | 235 | |||
1200 | 236 | def assertSystemdFsckdNotFailed(self): | ||
1201 | 237 | self.assertEqual(get_unit_exec_status('systemd-fsckd'), '0') | ||
1202 | 238 | |||
1203 | 239 | def reboot(self): | ||
1204 | 240 | '''Reboot the system with the current test marker''' | ||
1205 | 241 | subprocess.run(f'/tmp/autopkgtest-reboot {self._test_name}'.split()) | ||
1206 | 242 | |||
1207 | 243 | |||
1208 | 244 | def configure_plymouth_grub(enable=True): | ||
1209 | 245 | grubcfg = Path('/etc/default/grub') | ||
1210 | 246 | grubcfgdir = Path('/etc/default/grub.d') | ||
1211 | 247 | grubcfgdir.mkdir(parents=True, exist_ok=True) | ||
1212 | 248 | mygrubcfg = grubcfgdir.joinpath('99-autopkgtest.cfg') | ||
1213 | 249 | if enable: | ||
1214 | 250 | content = 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT splash quiet"' | ||
1215 | 251 | mygrubcfg.write_text(content) | ||
1216 | 252 | else: | ||
1217 | 253 | mygrubcfg.unlink() | ||
1218 | 254 | for f in [grubcfg] + list(grubcfgdir.glob('*.cfg')): | ||
1219 | 255 | content = f.read_text() | ||
1220 | 256 | if re.search(RE_SPLASH_QUIET, content): | ||
1221 | 257 | f.write_text(re.sub(RE_SPLASH_QUIET, ' ', content)) | ||
1222 | 258 | subprocess.run(['update-grub'], stderr=subprocess.DEVNULL, check=True) | ||
1223 | 259 | |||
1224 | 260 | def configure_plymouth_zipl(enable=True): | ||
1225 | 261 | ziplcfg = Path('/etc/zipl.conf') | ||
1226 | 262 | content = re.sub(RE_SPLASH_QUIET, ' ', ziplcfg.read_text()) | ||
1227 | 263 | if enable: | ||
1228 | 264 | content = re.sub(r'(?m)^(parameters.*[^\'"])(\s*[\'"]?)$', r'\1 splash quiet\2', content) | ||
1229 | 265 | ziplcfg.write_text(content) | ||
1230 | 266 | subprocess.run(['zipl'], stderr=subprocess.DEVNULL, check=True) | ||
1231 | 267 | |||
1232 | 268 | def configure_plymouth(enable=True): | ||
1233 | 269 | if platform.processor() == 's390x': | ||
1234 | 270 | configure_plymouth_zipl(enable) | ||
1235 | 271 | else: | ||
1236 | 272 | configure_plymouth_grub(enable) | ||
1237 | 273 | |||
1238 | 274 | def getAllTests(unitTestClass): | ||
1239 | 275 | '''get all test names in predictable sorted order from unitTestClass''' | ||
1240 | 276 | return sorted([test[0] for test in inspect.getmembers(unitTestClass, predicate=inspect.isfunction) | ||
1241 | 277 | if test[0].startswith('test_')]) | ||
1242 | 278 | |||
1243 | 279 | |||
1244 | 280 | # AUTOPKGTEST_REBOOT_MARK contains the test name to pursue after reboot | ||
1245 | 281 | # (to check results and states after reboot, mostly). | ||
1246 | 282 | # we append the previous global return code (0 or 1) to it. | ||
1247 | 283 | # Example: AUTOPKGTEST_REBOOT_MARK=test_foo:0 | ||
1248 | 284 | if __name__ == '__main__': | ||
1249 | 285 | if os.path.exists('/run/initramfs/fsck-root'): | ||
1250 | 286 | print('SKIP: root file system is being checked by initramfs already') | ||
1251 | 287 | sys.exit(77) | ||
1252 | 288 | |||
1253 | 289 | if platform.processor() == 'aarch64': | ||
1254 | 290 | print('SKIP: cannot reboot properly on arm64, see https://bugs.launchpad.net/ubuntu/+source/nova/+bug/1748280') | ||
1255 | 291 | sys.exit(77) | ||
1256 | 292 | |||
1257 | 293 | all_tests = getAllTests(FsckdTest) | ||
1258 | 294 | current_test = os.getenv('AUTOPKGTEST_REBOOT_MARK') | ||
1259 | 295 | |||
1260 | 296 | if not current_test: | ||
1261 | 297 | tests_setup() | ||
1262 | 298 | after_reboot = False | ||
1263 | 299 | current_test = all_tests[0] | ||
1264 | 300 | else: | ||
1265 | 301 | after_reboot = True | ||
1266 | 302 | |||
1267 | 303 | # loop on remaining tests to run | ||
1268 | 304 | try: | ||
1269 | 305 | remaining_tests = all_tests[all_tests.index(current_test):] | ||
1270 | 306 | except ValueError: | ||
1271 | 307 | print(f'Invalid value for AUTOPKGTEST_REBOOT_MARK, {current_test} is not a valid test name') | ||
1272 | 308 | sys.exit(2) | ||
1273 | 309 | |||
1274 | 310 | # run all remaining tests | ||
1275 | 311 | for test_name in remaining_tests: | ||
1276 | 312 | suite = unittest.TestSuite() | ||
1277 | 313 | suite.addTest(FsckdTest(test_name, after_reboot)) | ||
1278 | 314 | result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(suite) | ||
1279 | 315 | if len(result.failures) != 0 or len(result.errors) != 0: | ||
1280 | 316 | j = os.path.join(os.getenv('AUTOPKGTEST_ARTIFACTS'), 'systemd-fsckd-journal.txt') | ||
1281 | 317 | with open(j, 'w') as f: | ||
1282 | 318 | subprocess.run('journalctl -a --no-pager'.split(), encoding='utf-8', stdout=f) | ||
1283 | 319 | sys.exit(1) | ||
1284 | 320 | after_reboot = False | ||
1285 | 321 | |||
1286 | 322 | tests_teardown() | ||
1287 | 323 | sys.exit(0) | ||
1288 | diff --git a/man/org.freedesktop.systemd1.xml b/man/org.freedesktop.systemd1.xml | |||
1289 | index 5e08b35..7dbf98d 100644 | |||
1290 | --- a/man/org.freedesktop.systemd1.xml | |||
1291 | +++ b/man/org.freedesktop.systemd1.xml | |||
1292 | @@ -10139,6 +10139,8 @@ node /org/freedesktop/systemd1/unit/session_2d1_2escope { | |||
1293 | 10139 | readonly t RuntimeMaxUSec = ...; | 10139 | readonly t RuntimeMaxUSec = ...; |
1294 | 10140 | @org.freedesktop.DBus.Property.EmitsChangedSignal("const") | 10140 | @org.freedesktop.DBus.Property.EmitsChangedSignal("const") |
1295 | 10141 | readonly t RuntimeRandomizedExtraUSec = ...; | 10141 | readonly t RuntimeRandomizedExtraUSec = ...; |
1296 | 10142 | @org.freedesktop.DBus.Property.EmitsChangedSignal("const") | ||
1297 | 10143 | readonly s OOMPolicy = '...'; | ||
1298 | 10142 | @org.freedesktop.DBus.Property.EmitsChangedSignal("false") | 10144 | @org.freedesktop.DBus.Property.EmitsChangedSignal("false") |
1299 | 10143 | readonly s Slice = '...'; | 10145 | readonly s Slice = '...'; |
1300 | 10144 | @org.freedesktop.DBus.Property.EmitsChangedSignal("false") | 10146 | @org.freedesktop.DBus.Property.EmitsChangedSignal("false") |
1301 | @@ -10313,6 +10315,8 @@ node /org/freedesktop/systemd1/unit/session_2d1_2escope { | |||
1302 | 10313 | 10315 | ||
1303 | 10314 | <!--property RuntimeRandomizedExtraUSec is not documented!--> | 10316 | <!--property RuntimeRandomizedExtraUSec is not documented!--> |
1304 | 10315 | 10317 | ||
1305 | 10318 | <!--property OOMPolicy is not documented!--> | ||
1306 | 10319 | |||
1307 | 10316 | <!--property Slice is not documented!--> | 10320 | <!--property Slice is not documented!--> |
1308 | 10317 | 10321 | ||
1309 | 10318 | <!--property ControlGroupId is not documented!--> | 10322 | <!--property ControlGroupId is not documented!--> |
1310 | @@ -10495,6 +10499,8 @@ node /org/freedesktop/systemd1/unit/session_2d1_2escope { | |||
1311 | 10495 | 10499 | ||
1312 | 10496 | <variablelist class="dbus-property" generated="True" extra-ref="RuntimeRandomizedExtraUSec"/> | 10500 | <variablelist class="dbus-property" generated="True" extra-ref="RuntimeRandomizedExtraUSec"/> |
1313 | 10497 | 10501 | ||
1314 | 10502 | <variablelist class="dbus-property" generated="True" extra-ref="OOMPolicy"/> | ||
1315 | 10503 | |||
1316 | 10498 | <variablelist class="dbus-property" generated="True" extra-ref="Slice"/> | 10504 | <variablelist class="dbus-property" generated="True" extra-ref="Slice"/> |
1317 | 10499 | 10505 | ||
1318 | 10500 | <variablelist class="dbus-property" generated="True" extra-ref="ControlGroup"/> | 10506 | <variablelist class="dbus-property" generated="True" extra-ref="ControlGroup"/> |
1319 | diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml | |||
1320 | index 773ca04..da6ade8 100644 | |||
1321 | --- a/man/systemd.mount.xml | |||
1322 | +++ b/man/systemd.mount.xml | |||
1323 | @@ -476,7 +476,9 @@ | |||
1324 | 476 | <term><varname>Where=</varname></term> | 476 | <term><varname>Where=</varname></term> |
1325 | 477 | <listitem><para>Takes an absolute path of a file or directory for the mount point; in particular, the | 477 | <listitem><para>Takes an absolute path of a file or directory for the mount point; in particular, the |
1326 | 478 | destination cannot be a symbolic link. If the mount point does not exist at the time of mounting, it | 478 | destination cannot be a symbolic link. If the mount point does not exist at the time of mounting, it |
1328 | 479 | is created as directory. This string must be reflected in the unit filename. (See above.) This option | 479 | is created as either a directory or a file. The former is the usual case; the latter is done only if this mount |
1329 | 480 | is a bind mount and the source (<varname>What=</varname>) is not a directory. | ||
1330 | 481 | This string must be reflected in the unit filename. (See above.) This option | ||
1331 | 480 | is mandatory.</para></listitem> | 482 | is mandatory.</para></listitem> |
1332 | 481 | </varlistentry> | 483 | </varlistentry> |
1333 | 482 | 484 | ||
1334 | diff --git a/man/systemd.scope.xml b/man/systemd.scope.xml | |||
1335 | index 17d2700..95969bf 100644 | |||
1336 | --- a/man/systemd.scope.xml | |||
1337 | +++ b/man/systemd.scope.xml | |||
1338 | @@ -105,6 +105,8 @@ | |||
1339 | 105 | of scope units are the following:</para> | 105 | of scope units are the following:</para> |
1340 | 106 | 106 | ||
1341 | 107 | <variablelist class='unit-directives'> | 107 | <variablelist class='unit-directives'> |
1342 | 108 | <xi:include href="systemd.service.xml" xpointer="oom-policy" /> | ||
1343 | 109 | |||
1344 | 108 | <varlistentry> | 110 | <varlistentry> |
1345 | 109 | <term><varname>RuntimeMaxSec=</varname></term> | 111 | <term><varname>RuntimeMaxSec=</varname></term> |
1346 | 110 | 112 | ||
1347 | diff --git a/man/systemd.service.xml b/man/systemd.service.xml | |||
1348 | index 8d8dd77..6d3537b 100644 | |||
1349 | --- a/man/systemd.service.xml | |||
1350 | +++ b/man/systemd.service.xml | |||
1351 | @@ -1120,7 +1120,7 @@ | |||
1352 | 1120 | above.</para></listitem> | 1120 | above.</para></listitem> |
1353 | 1121 | </varlistentry> | 1121 | </varlistentry> |
1354 | 1122 | 1122 | ||
1356 | 1123 | <varlistentry> | 1123 | <varlistentry id='oom-policy'> |
1357 | 1124 | <term><varname>OOMPolicy=</varname></term> | 1124 | <term><varname>OOMPolicy=</varname></term> |
1358 | 1125 | 1125 | ||
1359 | 1126 | <listitem><para>Configure the out-of-memory (OOM) kernel killer policy. Note that the userspace OOM | 1126 | <listitem><para>Configure the out-of-memory (OOM) kernel killer policy. Note that the userspace OOM |
1360 | @@ -1133,17 +1133,16 @@ | |||
1361 | 1133 | for itself, it might decide to kill a running process in order to free up memory and reduce memory | 1133 | for itself, it might decide to kill a running process in order to free up memory and reduce memory |
1362 | 1134 | pressure. This setting takes one of <constant>continue</constant>, <constant>stop</constant> or | 1134 | pressure. This setting takes one of <constant>continue</constant>, <constant>stop</constant> or |
1363 | 1135 | <constant>kill</constant>. If set to <constant>continue</constant> and a process of the service is | 1135 | <constant>kill</constant>. If set to <constant>continue</constant> and a process of the service is |
1368 | 1136 | killed by the kernel's OOM killer this is logged but the service continues running. If set to | 1136 | killed by the OOM killer, this is logged but the unit continues running. If set to |
1369 | 1137 | <constant>stop</constant> the event is logged but the service is terminated cleanly by the service | 1137 | <constant>stop</constant> the event is logged but the unit is terminated cleanly by the service |
1370 | 1138 | manager. If set to <constant>kill</constant> and one of the service's processes is killed by the OOM | 1138 | manager. If set to <constant>kill</constant> and one of the unit's processes is killed by the OOM |
1371 | 1139 | killer the kernel is instructed to kill all remaining processes of the service too, by setting the | 1139 | killer the kernel is instructed to kill all remaining processes of the unit too, by setting the |
1372 | 1140 | <filename>memory.oom.group</filename> attribute to <constant>1</constant>; also see <ulink | 1140 | <filename>memory.oom.group</filename> attribute to <constant>1</constant>; also see <ulink |
1375 | 1141 | url="https://docs.kernel.org/admin-guide/cgroup-v2.html">kernel documentation</ulink>. | 1141 | url="https://docs.kernel.org/admin-guide/cgroup-v2.html">kernel documentation</ulink>.</para> |
1374 | 1142 | </para> | ||
1376 | 1143 | 1142 | ||
1377 | 1144 | <para>Defaults to the setting <varname>DefaultOOMPolicy=</varname> in | 1143 | <para>Defaults to the setting <varname>DefaultOOMPolicy=</varname> in |
1378 | 1145 | <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> | 1144 | <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
1380 | 1146 | is set to, except for services where <varname>Delegate=</varname> is turned on, where it defaults to | 1145 | is set to, except for units where <varname>Delegate=</varname> is turned on, where it defaults to |
1381 | 1147 | <constant>continue</constant>.</para> | 1146 | <constant>continue</constant>.</para> |
1382 | 1148 | 1147 | ||
1383 | 1149 | <para>Use the <varname>OOMScoreAdjust=</varname> setting to configure whether processes of the unit | 1148 | <para>Use the <varname>OOMScoreAdjust=</varname> setting to configure whether processes of the unit |
1384 | @@ -1153,10 +1152,9 @@ | |||
1385 | 1153 | details.</para> | 1152 | details.</para> |
1386 | 1154 | 1153 | ||
1387 | 1155 | <para>This setting also applies to <command>systemd-oomd</command>. Similarly to the kernel OOM | 1154 | <para>This setting also applies to <command>systemd-oomd</command>. Similarly to the kernel OOM |
1390 | 1156 | kills, this setting determines the state of the service after <command>systemd-oomd</command> kills a | 1155 | kills, this setting determines the state of the unit after <command>systemd-oomd</command> kills a |
1391 | 1157 | cgroup associated with the service.</para></listitem> | 1156 | cgroup associated with it.</para></listitem> |
1392 | 1158 | </varlistentry> | 1157 | </varlistentry> |
1393 | 1159 | |||
1394 | 1160 | </variablelist> | 1158 | </variablelist> |
1395 | 1161 | 1159 | ||
1396 | 1162 | <para id='shared-unit-options'>Check | 1160 | <para id='shared-unit-options'>Check |
1397 | diff --git a/src/basic/alloc-util.c b/src/basic/alloc-util.c | |||
1398 | index b030f45..6063943 100644 | |||
1399 | --- a/src/basic/alloc-util.c | |||
1400 | +++ b/src/basic/alloc-util.c | |||
1401 | @@ -102,3 +102,7 @@ void* greedy_realloc0( | |||
1402 | 102 | 102 | ||
1403 | 103 | return q; | 103 | return q; |
1404 | 104 | } | 104 | } |
1405 | 105 | |||
1406 | 106 | void *expand_to_usable(void *ptr, size_t newsize _unused_) { | ||
1407 | 107 | return ptr; | ||
1408 | 108 | } | ||
1409 | diff --git a/src/basic/alloc-util.h b/src/basic/alloc-util.h | |||
1410 | index b38db7d..bf783b1 100644 | |||
1411 | --- a/src/basic/alloc-util.h | |||
1412 | +++ b/src/basic/alloc-util.h | |||
1413 | @@ -2,6 +2,7 @@ | |||
1414 | 2 | #pragma once | 2 | #pragma once |
1415 | 3 | 3 | ||
1416 | 4 | #include <alloca.h> | 4 | #include <alloca.h> |
1417 | 5 | #include <malloc.h> | ||
1418 | 5 | #include <stddef.h> | 6 | #include <stddef.h> |
1419 | 6 | #include <stdlib.h> | 7 | #include <stdlib.h> |
1420 | 7 | #include <string.h> | 8 | #include <string.h> |
1421 | @@ -184,17 +185,35 @@ void* greedy_realloc0(void **p, size_t need, size_t size); | |||
1422 | 184 | # define msan_unpoison(r, s) | 185 | # define msan_unpoison(r, s) |
1423 | 185 | #endif | 186 | #endif |
1424 | 186 | 187 | ||
1434 | 187 | /* This returns the number of usable bytes in a malloc()ed region as per malloc_usable_size(), in a way that | 188 | /* Dummy allocator to tell the compiler that the new size of p is newsize. The implementation returns the |
1435 | 188 | * is compatible with _FORTIFY_SOURCES. If _FORTIFY_SOURCES is used many memory operations will take the | 189 | * pointer as is; the only reason for its existence is as a conduit for the _alloc_ attribute. This must not |
1436 | 189 | * object size as returned by __builtin_object_size() into account. Hence, let's return the smaller size of | 190 | * be inlined (hence a non-static function with _noinline_ because LTO otherwise tries to inline it) because |
1437 | 190 | * malloc_usable_size() and __builtin_object_size() here, so that we definitely operate in safe territory by | 191 | * gcc then loses the attributes on the function. |
1438 | 191 | * both the compiler's and libc's standards. Note that __builtin_object_size() evaluates to SIZE_MAX if the | 192 | * See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96503 */ |
1439 | 192 | * size cannot be determined, hence the MIN() expression should be safe with dynamically sized memory, | 193 | void *expand_to_usable(void *p, size_t newsize) _alloc_(2) _returns_nonnull_ _noinline_; |
1440 | 193 | * too. Moreover, when NULL is passed malloc_usable_size() is documented to return zero, and | 194 | |
1441 | 194 | * __builtin_object_size() returns SIZE_MAX too, hence we also return a sensible value of 0 in this corner | 195 | static inline size_t malloc_sizeof_safe(void **xp) { |
1442 | 195 | * case. */ | 196 | if (_unlikely_(!xp || !*xp)) |
1443 | 197 | return 0; | ||
1444 | 198 | |||
1445 | 199 | size_t sz = malloc_usable_size(*xp); | ||
1446 | 200 | *xp = expand_to_usable(*xp, sz); | ||
1447 | 201 | /* GCC doesn't see the _returns_nonnull_ when built with ubsan, so yet another hint to make it doubly | ||
1448 | 202 | * clear that expand_to_usable won't return NULL. | ||
1449 | 203 | * See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79265 */ | ||
1450 | 204 | if (!*xp) | ||
1451 | 205 | assert_not_reached(); | ||
1452 | 206 | return sz; | ||
1453 | 207 | } | ||
1454 | 208 | |||
1455 | 209 | /* This returns the number of usable bytes in a malloc()ed region as per malloc_usable_size(), which may | ||
1456 | 210 | * return a value larger than the size that was actually allocated. Access to that additional memory is | ||
1457 | 211 | * discouraged because it violates the C standard; a compiler cannot see that this as valid. To help the | ||
1458 | 212 | * compiler out, the MALLOC_SIZEOF_SAFE macro 'allocates' the usable size using a dummy allocator function | ||
1459 | 213 | * expand_to_usable. There is a possibility of malloc_usable_size() returning different values during the | ||
1460 | 214 | * lifetime of an object, which may cause problems, but the glibc allocator does not do that at the moment. */ | ||
1461 | 196 | #define MALLOC_SIZEOF_SAFE(x) \ | 215 | #define MALLOC_SIZEOF_SAFE(x) \ |
1463 | 197 | MIN(malloc_usable_size(x), __builtin_object_size(x, 0)) | 216 | malloc_sizeof_safe((void**) &__builtin_choose_expr(__builtin_constant_p(x), (void*) { NULL }, (x))) |
1464 | 198 | 217 | ||
1465 | 199 | /* Inspired by ELEMENTSOF() but operates on malloc()'ed memory areas: typesafely returns the number of items | 218 | /* Inspired by ELEMENTSOF() but operates on malloc()'ed memory areas: typesafely returns the number of items |
1466 | 200 | * that fit into the specified memory block */ | 219 | * that fit into the specified memory block */ |
1467 | diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c | |||
1468 | index b03cc70..17c0170 100644 | |||
1469 | --- a/src/basic/cgroup-util.c | |||
1470 | +++ b/src/basic/cgroup-util.c | |||
1471 | @@ -1238,7 +1238,7 @@ static const char *skip_session(const char *p) { | |||
1472 | 1238 | * here. */ | 1238 | * here. */ |
1473 | 1239 | 1239 | ||
1474 | 1240 | if (!session_id_valid(buf)) | 1240 | if (!session_id_valid(buf)) |
1476 | 1241 | return false; | 1241 | return NULL; |
1477 | 1242 | 1242 | ||
1478 | 1243 | p += n; | 1243 | p += n; |
1479 | 1244 | p += strspn(p, "/"); | 1244 | p += strspn(p, "/"); |
1480 | diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c | |||
1481 | index f68cd36..6a14ea9 100644 | |||
1482 | --- a/src/basic/hashmap.c | |||
1483 | +++ b/src/basic/hashmap.c | |||
1484 | @@ -1751,7 +1751,7 @@ HashmapBase* _hashmap_copy(HashmapBase *h HASHMAP_DEBUG_PARAMS) { | |||
1485 | 1751 | } | 1751 | } |
1486 | 1752 | 1752 | ||
1487 | 1753 | if (r < 0) | 1753 | if (r < 0) |
1489 | 1754 | return _hashmap_free(copy, false, false); | 1754 | return _hashmap_free(copy, NULL, NULL); |
1490 | 1755 | 1755 | ||
1491 | 1756 | return copy; | 1756 | return copy; |
1492 | 1757 | } | 1757 | } |
1493 | diff --git a/src/basic/linux/README b/src/basic/linux/README | |||
1494 | index 2bb70fd..1abc945 100644 | |||
1495 | --- a/src/basic/linux/README | |||
1496 | +++ b/src/basic/linux/README | |||
1497 | @@ -4,3 +4,4 @@ The files in this directory are copied from current kernel master | |||
1498 | 4 | modifications are applied: | 4 | modifications are applied: |
1499 | 5 | - btrfs.h: drop '__user' attributes | 5 | - btrfs.h: drop '__user' attributes |
1500 | 6 | - if.h: drop '#include <linux/compiler.h>' and '__user' attributes | 6 | - if.h: drop '#include <linux/compiler.h>' and '__user' attributes |
1501 | 7 | - stddef.h: drop '#include <linux/compiler_types.h>' | ||
1502 | diff --git a/src/basic/linux/btrfs.h b/src/basic/linux/btrfs.h | |||
1503 | index 6a0442b..0a53bdc 100644 | |||
1504 | --- a/src/basic/linux/btrfs.h | |||
1505 | +++ b/src/basic/linux/btrfs.h | |||
1506 | @@ -19,8 +19,14 @@ | |||
1507 | 19 | 19 | ||
1508 | 20 | #ifndef _UAPI_LINUX_BTRFS_H | 20 | #ifndef _UAPI_LINUX_BTRFS_H |
1509 | 21 | #define _UAPI_LINUX_BTRFS_H | 21 | #define _UAPI_LINUX_BTRFS_H |
1510 | 22 | |||
1511 | 23 | #ifdef __cplusplus | ||
1512 | 24 | extern "C" { | ||
1513 | 25 | #endif | ||
1514 | 26 | |||
1515 | 22 | #include <linux/types.h> | 27 | #include <linux/types.h> |
1516 | 23 | #include <linux/ioctl.h> | 28 | #include <linux/ioctl.h> |
1517 | 29 | #include <linux/fs.h> | ||
1518 | 24 | 30 | ||
1519 | 25 | #define BTRFS_IOCTL_MAGIC 0x94 | 31 | #define BTRFS_IOCTL_MAGIC 0x94 |
1520 | 26 | #define BTRFS_VOL_NAME_MAX 255 | 32 | #define BTRFS_VOL_NAME_MAX 255 |
1521 | @@ -93,7 +99,7 @@ struct btrfs_qgroup_inherit { | |||
1522 | 93 | __u64 num_ref_copies; | 99 | __u64 num_ref_copies; |
1523 | 94 | __u64 num_excl_copies; | 100 | __u64 num_excl_copies; |
1524 | 95 | struct btrfs_qgroup_limit lim; | 101 | struct btrfs_qgroup_limit lim; |
1526 | 96 | __u64 qgroups[0]; | 102 | __u64 qgroups[]; |
1527 | 97 | }; | 103 | }; |
1528 | 98 | 104 | ||
1529 | 99 | struct btrfs_ioctl_qgroup_limit_args { | 105 | struct btrfs_ioctl_qgroup_limit_args { |
1530 | @@ -290,6 +296,12 @@ struct btrfs_ioctl_fs_info_args { | |||
1531 | 290 | #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID (1ULL << 1) | 296 | #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID (1ULL << 1) |
1532 | 291 | #define BTRFS_FEATURE_COMPAT_RO_VERITY (1ULL << 2) | 297 | #define BTRFS_FEATURE_COMPAT_RO_VERITY (1ULL << 2) |
1533 | 292 | 298 | ||
1534 | 299 | /* | ||
1535 | 300 | * Put all block group items into a dedicated block group tree, greatly | ||
1536 | 301 | * reducing mount time for large filesystem due to better locality. | ||
1537 | 302 | */ | ||
1538 | 303 | #define BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE (1ULL << 3) | ||
1539 | 304 | |||
1540 | 293 | #define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0) | 305 | #define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0) |
1541 | 294 | #define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1) | 306 | #define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1) |
1542 | 295 | #define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2) | 307 | #define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2) |
1543 | @@ -327,6 +339,12 @@ struct btrfs_ioctl_feature_flags { | |||
1544 | 327 | */ | 339 | */ |
1545 | 328 | struct btrfs_balance_args { | 340 | struct btrfs_balance_args { |
1546 | 329 | __u64 profiles; | 341 | __u64 profiles; |
1547 | 342 | |||
1548 | 343 | /* | ||
1549 | 344 | * usage filter | ||
1550 | 345 | * BTRFS_BALANCE_ARGS_USAGE with a single value means '0..N' | ||
1551 | 346 | * BTRFS_BALANCE_ARGS_USAGE_RANGE - range syntax, min..max | ||
1552 | 347 | */ | ||
1553 | 330 | union { | 348 | union { |
1554 | 331 | __u64 usage; | 349 | __u64 usage; |
1555 | 332 | struct { | 350 | struct { |
1556 | @@ -543,7 +561,7 @@ struct btrfs_ioctl_search_header { | |||
1557 | 543 | __u64 offset; | 561 | __u64 offset; |
1558 | 544 | __u32 type; | 562 | __u32 type; |
1559 | 545 | __u32 len; | 563 | __u32 len; |
1561 | 546 | }; | 564 | } __attribute__ ((__may_alias__)); |
1562 | 547 | 565 | ||
1563 | 548 | #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key)) | 566 | #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key)) |
1564 | 549 | /* | 567 | /* |
1565 | @@ -556,18 +574,23 @@ struct btrfs_ioctl_search_args { | |||
1566 | 556 | char buf[BTRFS_SEARCH_ARGS_BUFSIZE]; | 574 | char buf[BTRFS_SEARCH_ARGS_BUFSIZE]; |
1567 | 557 | }; | 575 | }; |
1568 | 558 | 576 | ||
1569 | 577 | /* | ||
1570 | 578 | * Extended version of TREE_SEARCH ioctl that can return more than 4k of bytes. | ||
1571 | 579 | * The allocated size of the buffer is set in buf_size. | ||
1572 | 580 | */ | ||
1573 | 559 | struct btrfs_ioctl_search_args_v2 { | 581 | struct btrfs_ioctl_search_args_v2 { |
1574 | 560 | struct btrfs_ioctl_search_key key; /* in/out - search parameters */ | 582 | struct btrfs_ioctl_search_key key; /* in/out - search parameters */ |
1575 | 561 | __u64 buf_size; /* in - size of buffer | 583 | __u64 buf_size; /* in - size of buffer |
1576 | 562 | * out - on EOVERFLOW: needed size | 584 | * out - on EOVERFLOW: needed size |
1577 | 563 | * to store item */ | 585 | * to store item */ |
1579 | 564 | __u64 buf[0]; /* out - found items */ | 586 | __u64 buf[]; /* out - found items */ |
1580 | 565 | }; | 587 | }; |
1581 | 566 | 588 | ||
1582 | 589 | /* With a @src_length of zero, the range from @src_offset->EOF is cloned! */ | ||
1583 | 567 | struct btrfs_ioctl_clone_range_args { | 590 | struct btrfs_ioctl_clone_range_args { |
1587 | 568 | __s64 src_fd; | 591 | __s64 src_fd; |
1588 | 569 | __u64 src_offset, src_length; | 592 | __u64 src_offset, src_length; |
1589 | 570 | __u64 dest_offset; | 593 | __u64 dest_offset; |
1590 | 571 | }; | 594 | }; |
1591 | 572 | 595 | ||
1592 | 573 | /* | 596 | /* |
1593 | @@ -632,7 +655,7 @@ struct btrfs_ioctl_same_args { | |||
1594 | 632 | __u16 dest_count; /* in - total elements in info array */ | 655 | __u16 dest_count; /* in - total elements in info array */ |
1595 | 633 | __u16 reserved1; | 656 | __u16 reserved1; |
1596 | 634 | __u32 reserved2; | 657 | __u32 reserved2; |
1598 | 635 | struct btrfs_ioctl_same_extent_info info[0]; | 658 | struct btrfs_ioctl_same_extent_info info[]; |
1599 | 636 | }; | 659 | }; |
1600 | 637 | 660 | ||
1601 | 638 | struct btrfs_ioctl_space_info { | 661 | struct btrfs_ioctl_space_info { |
1602 | @@ -644,7 +667,7 @@ struct btrfs_ioctl_space_info { | |||
1603 | 644 | struct btrfs_ioctl_space_args { | 667 | struct btrfs_ioctl_space_args { |
1604 | 645 | __u64 space_slots; | 668 | __u64 space_slots; |
1605 | 646 | __u64 total_spaces; | 669 | __u64 total_spaces; |
1607 | 647 | struct btrfs_ioctl_space_info spaces[0]; | 670 | struct btrfs_ioctl_space_info spaces[]; |
1608 | 648 | }; | 671 | }; |
1609 | 649 | 672 | ||
1610 | 650 | struct btrfs_data_container { | 673 | struct btrfs_data_container { |
1611 | @@ -652,7 +675,7 @@ struct btrfs_data_container { | |||
1612 | 652 | __u32 bytes_missing; /* out -- additional bytes needed for result */ | 675 | __u32 bytes_missing; /* out -- additional bytes needed for result */ |
1613 | 653 | __u32 elem_cnt; /* out */ | 676 | __u32 elem_cnt; /* out */ |
1614 | 654 | __u32 elem_missed; /* out */ | 677 | __u32 elem_missed; /* out */ |
1616 | 655 | __u64 val[0]; /* out */ | 678 | __u64 val[]; /* out */ |
1617 | 656 | }; | 679 | }; |
1618 | 657 | 680 | ||
1619 | 658 | struct btrfs_ioctl_ino_path_args { | 681 | struct btrfs_ioctl_ino_path_args { |
1620 | @@ -671,8 +694,11 @@ struct btrfs_ioctl_logical_ino_args { | |||
1621 | 671 | /* struct btrfs_data_container *inodes; out */ | 694 | /* struct btrfs_data_container *inodes; out */ |
1622 | 672 | __u64 inodes; | 695 | __u64 inodes; |
1623 | 673 | }; | 696 | }; |
1626 | 674 | /* Return every ref to the extent, not just those containing logical block. | 697 | |
1627 | 675 | * Requires logical == extent bytenr. */ | 698 | /* |
1628 | 699 | * Return every ref to the extent, not just those containing logical block. | ||
1629 | 700 | * Requires logical == extent bytenr. | ||
1630 | 701 | */ | ||
1631 | 676 | #define BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET (1ULL << 0) | 702 | #define BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET (1ULL << 0) |
1632 | 677 | 703 | ||
1633 | 678 | enum btrfs_dev_stat_values { | 704 | enum btrfs_dev_stat_values { |
1634 | @@ -777,11 +803,19 @@ struct btrfs_ioctl_received_subvol_args { | |||
1635 | 777 | */ | 803 | */ |
1636 | 778 | #define BTRFS_SEND_FLAG_VERSION 0x8 | 804 | #define BTRFS_SEND_FLAG_VERSION 0x8 |
1637 | 779 | 805 | ||
1638 | 806 | /* | ||
1639 | 807 | * Send compressed data using the ENCODED_WRITE command instead of decompressing | ||
1640 | 808 | * the data and sending it with the WRITE command. This requires protocol | ||
1641 | 809 | * version >= 2. | ||
1642 | 810 | */ | ||
1643 | 811 | #define BTRFS_SEND_FLAG_COMPRESSED 0x10 | ||
1644 | 812 | |||
1645 | 780 | #define BTRFS_SEND_FLAG_MASK \ | 813 | #define BTRFS_SEND_FLAG_MASK \ |
1646 | 781 | (BTRFS_SEND_FLAG_NO_FILE_DATA | \ | 814 | (BTRFS_SEND_FLAG_NO_FILE_DATA | \ |
1647 | 782 | BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \ | 815 | BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \ |
1648 | 783 | BTRFS_SEND_FLAG_OMIT_END_CMD | \ | 816 | BTRFS_SEND_FLAG_OMIT_END_CMD | \ |
1650 | 784 | BTRFS_SEND_FLAG_VERSION) | 817 | BTRFS_SEND_FLAG_VERSION | \ |
1651 | 818 | BTRFS_SEND_FLAG_COMPRESSED) | ||
1652 | 785 | 819 | ||
1653 | 786 | struct btrfs_ioctl_send_args { | 820 | struct btrfs_ioctl_send_args { |
1654 | 787 | __s64 send_fd; /* in */ | 821 | __s64 send_fd; /* in */ |
1655 | @@ -1130,4 +1164,8 @@ enum btrfs_err_code { | |||
1656 | 1130 | #define BTRFS_IOC_ENCODED_WRITE _IOW(BTRFS_IOCTL_MAGIC, 64, \ | 1164 | #define BTRFS_IOC_ENCODED_WRITE _IOW(BTRFS_IOCTL_MAGIC, 64, \ |
1657 | 1131 | struct btrfs_ioctl_encoded_io_args) | 1165 | struct btrfs_ioctl_encoded_io_args) |
1658 | 1132 | 1166 | ||
1659 | 1167 | #ifdef __cplusplus | ||
1660 | 1168 | } | ||
1661 | 1169 | #endif | ||
1662 | 1170 | |||
1663 | 1133 | #endif /* _UAPI_LINUX_BTRFS_H */ | 1171 | #endif /* _UAPI_LINUX_BTRFS_H */ |
1664 | diff --git a/src/basic/linux/btrfs_tree.h b/src/basic/linux/btrfs_tree.h | |||
1665 | index d411715..ab38d0f 100644 | |||
1666 | --- a/src/basic/linux/btrfs_tree.h | |||
1667 | +++ b/src/basic/linux/btrfs_tree.h | |||
1668 | @@ -10,6 +10,23 @@ | |||
1669 | 10 | #include <stddef.h> | 10 | #include <stddef.h> |
1670 | 11 | #endif | 11 | #endif |
1671 | 12 | 12 | ||
1672 | 13 | /* ASCII for _BHRfS_M, no terminating nul */ | ||
1673 | 14 | #define BTRFS_MAGIC 0x4D5F53665248425FULL | ||
1674 | 15 | |||
1675 | 16 | #define BTRFS_MAX_LEVEL 8 | ||
1676 | 17 | |||
1677 | 18 | /* | ||
1678 | 19 | * We can actually store much bigger names, but lets not confuse the rest of | ||
1679 | 20 | * linux. | ||
1680 | 21 | */ | ||
1681 | 22 | #define BTRFS_NAME_LEN 255 | ||
1682 | 23 | |||
1683 | 24 | /* | ||
1684 | 25 | * Theoretical limit is larger, but we keep this down to a sane value. That | ||
1685 | 26 | * should limit greatly the possibility of collisions on inode ref items. | ||
1686 | 27 | */ | ||
1687 | 28 | #define BTRFS_LINK_MAX 65535U | ||
1688 | 29 | |||
1689 | 13 | /* | 30 | /* |
1690 | 14 | * This header contains the structure definitions and constants used | 31 | * This header contains the structure definitions and constants used |
1691 | 15 | * by file system objects that can be retrieved using | 32 | * by file system objects that can be retrieved using |
1692 | @@ -359,6 +376,50 @@ enum btrfs_csum_type { | |||
1693 | 359 | #define BTRFS_FT_SYMLINK 7 | 376 | #define BTRFS_FT_SYMLINK 7 |
1694 | 360 | #define BTRFS_FT_XATTR 8 | 377 | #define BTRFS_FT_XATTR 8 |
1695 | 361 | #define BTRFS_FT_MAX 9 | 378 | #define BTRFS_FT_MAX 9 |
1696 | 379 | /* Directory contains encrypted data */ | ||
1697 | 380 | #define BTRFS_FT_ENCRYPTED 0x80 | ||
1698 | 381 | |||
1699 | 382 | static inline __u8 btrfs_dir_flags_to_ftype(__u8 flags) | ||
1700 | 383 | { | ||
1701 | 384 | return flags & ~BTRFS_FT_ENCRYPTED; | ||
1702 | 385 | } | ||
1703 | 386 | |||
1704 | 387 | /* | ||
1705 | 388 | * Inode flags | ||
1706 | 389 | */ | ||
1707 | 390 | #define BTRFS_INODE_NODATASUM (1U << 0) | ||
1708 | 391 | #define BTRFS_INODE_NODATACOW (1U << 1) | ||
1709 | 392 | #define BTRFS_INODE_READONLY (1U << 2) | ||
1710 | 393 | #define BTRFS_INODE_NOCOMPRESS (1U << 3) | ||
1711 | 394 | #define BTRFS_INODE_PREALLOC (1U << 4) | ||
1712 | 395 | #define BTRFS_INODE_SYNC (1U << 5) | ||
1713 | 396 | #define BTRFS_INODE_IMMUTABLE (1U << 6) | ||
1714 | 397 | #define BTRFS_INODE_APPEND (1U << 7) | ||
1715 | 398 | #define BTRFS_INODE_NODUMP (1U << 8) | ||
1716 | 399 | #define BTRFS_INODE_NOATIME (1U << 9) | ||
1717 | 400 | #define BTRFS_INODE_DIRSYNC (1U << 10) | ||
1718 | 401 | #define BTRFS_INODE_COMPRESS (1U << 11) | ||
1719 | 402 | |||
1720 | 403 | #define BTRFS_INODE_ROOT_ITEM_INIT (1U << 31) | ||
1721 | 404 | |||
1722 | 405 | #define BTRFS_INODE_FLAG_MASK \ | ||
1723 | 406 | (BTRFS_INODE_NODATASUM | \ | ||
1724 | 407 | BTRFS_INODE_NODATACOW | \ | ||
1725 | 408 | BTRFS_INODE_READONLY | \ | ||
1726 | 409 | BTRFS_INODE_NOCOMPRESS | \ | ||
1727 | 410 | BTRFS_INODE_PREALLOC | \ | ||
1728 | 411 | BTRFS_INODE_SYNC | \ | ||
1729 | 412 | BTRFS_INODE_IMMUTABLE | \ | ||
1730 | 413 | BTRFS_INODE_APPEND | \ | ||
1731 | 414 | BTRFS_INODE_NODUMP | \ | ||
1732 | 415 | BTRFS_INODE_NOATIME | \ | ||
1733 | 416 | BTRFS_INODE_DIRSYNC | \ | ||
1734 | 417 | BTRFS_INODE_COMPRESS | \ | ||
1735 | 418 | BTRFS_INODE_ROOT_ITEM_INIT) | ||
1736 | 419 | |||
1737 | 420 | #define BTRFS_INODE_RO_VERITY (1U << 0) | ||
1738 | 421 | |||
1739 | 422 | #define BTRFS_INODE_RO_FLAG_MASK (BTRFS_INODE_RO_VERITY) | ||
1740 | 362 | 423 | ||
1741 | 363 | /* | 424 | /* |
1742 | 364 | * The key defines the order in the tree, and so it also defines (optimal) | 425 | * The key defines the order in the tree, and so it also defines (optimal) |
1743 | @@ -389,6 +450,109 @@ struct btrfs_key { | |||
1744 | 389 | __u64 offset; | 450 | __u64 offset; |
1745 | 390 | } __attribute__ ((__packed__)); | 451 | } __attribute__ ((__packed__)); |
1746 | 391 | 452 | ||
1747 | 453 | /* | ||
1748 | 454 | * Every tree block (leaf or node) starts with this header. | ||
1749 | 455 | */ | ||
1750 | 456 | struct btrfs_header { | ||
1751 | 457 | /* These first four must match the super block */ | ||
1752 | 458 | __u8 csum[BTRFS_CSUM_SIZE]; | ||
1753 | 459 | /* FS specific uuid */ | ||
1754 | 460 | __u8 fsid[BTRFS_FSID_SIZE]; | ||
1755 | 461 | /* Which block this node is supposed to live in */ | ||
1756 | 462 | __le64 bytenr; | ||
1757 | 463 | __le64 flags; | ||
1758 | 464 | |||
1759 | 465 | /* Allowed to be different from the super from here on down */ | ||
1760 | 466 | __u8 chunk_tree_uuid[BTRFS_UUID_SIZE]; | ||
1761 | 467 | __le64 generation; | ||
1762 | 468 | __le64 owner; | ||
1763 | 469 | __le32 nritems; | ||
1764 | 470 | __u8 level; | ||
1765 | 471 | } __attribute__ ((__packed__)); | ||
1766 | 472 | |||
1767 | 473 | /* | ||
1768 | 474 | * This is a very generous portion of the super block, giving us room to | ||
1769 | 475 | * translate 14 chunks with 3 stripes each. | ||
1770 | 476 | */ | ||
1771 | 477 | #define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048 | ||
1772 | 478 | |||
1773 | 479 | /* | ||
1774 | 480 | * Just in case we somehow lose the roots and are not able to mount, we store | ||
1775 | 481 | * an array of the roots from previous transactions in the super. | ||
1776 | 482 | */ | ||
1777 | 483 | #define BTRFS_NUM_BACKUP_ROOTS 4 | ||
1778 | 484 | struct btrfs_root_backup { | ||
1779 | 485 | __le64 tree_root; | ||
1780 | 486 | __le64 tree_root_gen; | ||
1781 | 487 | |||
1782 | 488 | __le64 chunk_root; | ||
1783 | 489 | __le64 chunk_root_gen; | ||
1784 | 490 | |||
1785 | 491 | __le64 extent_root; | ||
1786 | 492 | __le64 extent_root_gen; | ||
1787 | 493 | |||
1788 | 494 | __le64 fs_root; | ||
1789 | 495 | __le64 fs_root_gen; | ||
1790 | 496 | |||
1791 | 497 | __le64 dev_root; | ||
1792 | 498 | __le64 dev_root_gen; | ||
1793 | 499 | |||
1794 | 500 | __le64 csum_root; | ||
1795 | 501 | __le64 csum_root_gen; | ||
1796 | 502 | |||
1797 | 503 | __le64 total_bytes; | ||
1798 | 504 | __le64 bytes_used; | ||
1799 | 505 | __le64 num_devices; | ||
1800 | 506 | /* future */ | ||
1801 | 507 | __le64 unused_64[4]; | ||
1802 | 508 | |||
1803 | 509 | __u8 tree_root_level; | ||
1804 | 510 | __u8 chunk_root_level; | ||
1805 | 511 | __u8 extent_root_level; | ||
1806 | 512 | __u8 fs_root_level; | ||
1807 | 513 | __u8 dev_root_level; | ||
1808 | 514 | __u8 csum_root_level; | ||
1809 | 515 | /* future and to align */ | ||
1810 | 516 | __u8 unused_8[10]; | ||
1811 | 517 | } __attribute__ ((__packed__)); | ||
1812 | 518 | |||
1813 | 519 | /* | ||
1814 | 520 | * A leaf is full of items. offset and size tell us where to find the item in | ||
1815 | 521 | * the leaf (relative to the start of the data area) | ||
1816 | 522 | */ | ||
1817 | 523 | struct btrfs_item { | ||
1818 | 524 | struct btrfs_disk_key key; | ||
1819 | 525 | __le32 offset; | ||
1820 | 526 | __le32 size; | ||
1821 | 527 | } __attribute__ ((__packed__)); | ||
1822 | 528 | |||
1823 | 529 | /* | ||
1824 | 530 | * Leaves have an item area and a data area: | ||
1825 | 531 | * [item0, item1....itemN] [free space] [dataN...data1, data0] | ||
1826 | 532 | * | ||
1827 | 533 | * The data is separate from the items to get the keys closer together during | ||
1828 | 534 | * searches. | ||
1829 | 535 | */ | ||
1830 | 536 | struct btrfs_leaf { | ||
1831 | 537 | struct btrfs_header header; | ||
1832 | 538 | struct btrfs_item items[]; | ||
1833 | 539 | } __attribute__ ((__packed__)); | ||
1834 | 540 | |||
1835 | 541 | /* | ||
1836 | 542 | * All non-leaf blocks are nodes, they hold only keys and pointers to other | ||
1837 | 543 | * blocks. | ||
1838 | 544 | */ | ||
1839 | 545 | struct btrfs_key_ptr { | ||
1840 | 546 | struct btrfs_disk_key key; | ||
1841 | 547 | __le64 blockptr; | ||
1842 | 548 | __le64 generation; | ||
1843 | 549 | } __attribute__ ((__packed__)); | ||
1844 | 550 | |||
1845 | 551 | struct btrfs_node { | ||
1846 | 552 | struct btrfs_header header; | ||
1847 | 553 | struct btrfs_key_ptr ptrs[]; | ||
1848 | 554 | } __attribute__ ((__packed__)); | ||
1849 | 555 | |||
1850 | 392 | struct btrfs_dev_item { | 556 | struct btrfs_dev_item { |
1851 | 393 | /* the internal btrfs device id */ | 557 | /* the internal btrfs device id */ |
1852 | 394 | __le64 devid; | 558 | __le64 devid; |
1853 | @@ -472,6 +636,69 @@ struct btrfs_chunk { | |||
1854 | 472 | /* additional stripes go here */ | 636 | /* additional stripes go here */ |
1855 | 473 | } __attribute__ ((__packed__)); | 637 | } __attribute__ ((__packed__)); |
1856 | 474 | 638 | ||
1857 | 639 | /* | ||
1858 | 640 | * The super block basically lists the main trees of the FS. | ||
1859 | 641 | */ | ||
1860 | 642 | struct btrfs_super_block { | ||
1861 | 643 | /* The first 4 fields must match struct btrfs_header */ | ||
1862 | 644 | __u8 csum[BTRFS_CSUM_SIZE]; | ||
1863 | 645 | /* FS specific UUID, visible to user */ | ||
1864 | 646 | __u8 fsid[BTRFS_FSID_SIZE]; | ||
1865 | 647 | /* This block number */ | ||
1866 | 648 | __le64 bytenr; | ||
1867 | 649 | __le64 flags; | ||
1868 | 650 | |||
1869 | 651 | /* Allowed to be different from the btrfs_header from here own down */ | ||
1870 | 652 | __le64 magic; | ||
1871 | 653 | __le64 generation; | ||
1872 | 654 | __le64 root; | ||
1873 | 655 | __le64 chunk_root; | ||
1874 | 656 | __le64 log_root; | ||
1875 | 657 | |||
1876 | 658 | /* | ||
1877 | 659 | * This member has never been utilized since the very beginning, thus | ||
1878 | 660 | * it's always 0 regardless of kernel version. We always use | ||
1879 | 661 | * generation + 1 to read log tree root. So here we mark it deprecated. | ||
1880 | 662 | */ | ||
1881 | 663 | __le64 __unused_log_root_transid; | ||
1882 | 664 | __le64 total_bytes; | ||
1883 | 665 | __le64 bytes_used; | ||
1884 | 666 | __le64 root_dir_objectid; | ||
1885 | 667 | __le64 num_devices; | ||
1886 | 668 | __le32 sectorsize; | ||
1887 | 669 | __le32 nodesize; | ||
1888 | 670 | __le32 __unused_leafsize; | ||
1889 | 671 | __le32 stripesize; | ||
1890 | 672 | __le32 sys_chunk_array_size; | ||
1891 | 673 | __le64 chunk_root_generation; | ||
1892 | 674 | __le64 compat_flags; | ||
1893 | 675 | __le64 compat_ro_flags; | ||
1894 | 676 | __le64 incompat_flags; | ||
1895 | 677 | __le16 csum_type; | ||
1896 | 678 | __u8 root_level; | ||
1897 | 679 | __u8 chunk_root_level; | ||
1898 | 680 | __u8 log_root_level; | ||
1899 | 681 | struct btrfs_dev_item dev_item; | ||
1900 | 682 | |||
1901 | 683 | char label[BTRFS_LABEL_SIZE]; | ||
1902 | 684 | |||
1903 | 685 | __le64 cache_generation; | ||
1904 | 686 | __le64 uuid_tree_generation; | ||
1905 | 687 | |||
1906 | 688 | /* The UUID written into btree blocks */ | ||
1907 | 689 | __u8 metadata_uuid[BTRFS_FSID_SIZE]; | ||
1908 | 690 | |||
1909 | 691 | __u64 nr_global_roots; | ||
1910 | 692 | |||
1911 | 693 | /* Future expansion */ | ||
1912 | 694 | __le64 reserved[27]; | ||
1913 | 695 | __u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE]; | ||
1914 | 696 | struct btrfs_root_backup super_roots[BTRFS_NUM_BACKUP_ROOTS]; | ||
1915 | 697 | |||
1916 | 698 | /* Padded to 4096 bytes */ | ||
1917 | 699 | __u8 padding[565]; | ||
1918 | 700 | } __attribute__ ((__packed__)); | ||
1919 | 701 | |||
1920 | 475 | #define BTRFS_FREE_SPACE_EXTENT 1 | 702 | #define BTRFS_FREE_SPACE_EXTENT 1 |
1921 | 476 | #define BTRFS_FREE_SPACE_BITMAP 2 | 703 | #define BTRFS_FREE_SPACE_BITMAP 2 |
1922 | 477 | 704 | ||
1923 | @@ -526,6 +753,14 @@ struct btrfs_extent_item_v0 { | |||
1924 | 526 | /* use full backrefs for extent pointers in the block */ | 753 | /* use full backrefs for extent pointers in the block */ |
1925 | 527 | #define BTRFS_BLOCK_FLAG_FULL_BACKREF (1ULL << 8) | 754 | #define BTRFS_BLOCK_FLAG_FULL_BACKREF (1ULL << 8) |
1926 | 528 | 755 | ||
1927 | 756 | #define BTRFS_BACKREF_REV_MAX 256 | ||
1928 | 757 | #define BTRFS_BACKREF_REV_SHIFT 56 | ||
1929 | 758 | #define BTRFS_BACKREF_REV_MASK (((u64)BTRFS_BACKREF_REV_MAX - 1) << \ | ||
1930 | 759 | BTRFS_BACKREF_REV_SHIFT) | ||
1931 | 760 | |||
1932 | 761 | #define BTRFS_OLD_BACKREF_REV 0 | ||
1933 | 762 | #define BTRFS_MIXED_BACKREF_REV 1 | ||
1934 | 763 | |||
1935 | 529 | /* | 764 | /* |
1936 | 530 | * this flag is only used internally by scrub and may be changed at any time | 765 | * this flag is only used internally by scrub and may be changed at any time |
1937 | 531 | * it is only declared here to avoid collisions | 766 | * it is only declared here to avoid collisions |
1938 | @@ -575,7 +810,7 @@ struct btrfs_inode_extref { | |||
1939 | 575 | __le64 parent_objectid; | 810 | __le64 parent_objectid; |
1940 | 576 | __le64 index; | 811 | __le64 index; |
1941 | 577 | __le16 name_len; | 812 | __le16 name_len; |
1943 | 578 | __u8 name[0]; | 813 | __u8 name[]; |
1944 | 579 | /* name goes here */ | 814 | /* name goes here */ |
1945 | 580 | } __attribute__ ((__packed__)); | 815 | } __attribute__ ((__packed__)); |
1946 | 581 | 816 | ||
1947 | @@ -965,6 +1200,10 @@ static inline __u16 btrfs_qgroup_level(__u64 qgroupid) | |||
1948 | 965 | */ | 1200 | */ |
1949 | 966 | #define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2) | 1201 | #define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2) |
1950 | 967 | 1202 | ||
1951 | 1203 | #define BTRFS_QGROUP_STATUS_FLAGS_MASK (BTRFS_QGROUP_STATUS_FLAG_ON | \ | ||
1952 | 1204 | BTRFS_QGROUP_STATUS_FLAG_RESCAN | \ | ||
1953 | 1205 | BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT) | ||
1954 | 1206 | |||
1955 | 968 | #define BTRFS_QGROUP_STATUS_VERSION 1 | 1207 | #define BTRFS_QGROUP_STATUS_VERSION 1 |
1956 | 969 | 1208 | ||
1957 | 970 | struct btrfs_qgroup_status_item { | 1209 | struct btrfs_qgroup_status_item { |
1958 | diff --git a/src/basic/linux/genetlink.h b/src/basic/linux/genetlink.h | |||
1959 | index d83f214..ddba3ca 100644 | |||
1960 | --- a/src/basic/linux/genetlink.h | |||
1961 | +++ b/src/basic/linux/genetlink.h | |||
1962 | @@ -87,6 +87,8 @@ enum { | |||
1963 | 87 | __CTRL_ATTR_MCAST_GRP_MAX, | 87 | __CTRL_ATTR_MCAST_GRP_MAX, |
1964 | 88 | }; | 88 | }; |
1965 | 89 | 89 | ||
1966 | 90 | #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) | ||
1967 | 91 | |||
1968 | 90 | enum { | 92 | enum { |
1969 | 91 | CTRL_ATTR_POLICY_UNSPEC, | 93 | CTRL_ATTR_POLICY_UNSPEC, |
1970 | 92 | CTRL_ATTR_POLICY_DO, | 94 | CTRL_ATTR_POLICY_DO, |
1971 | @@ -96,7 +98,6 @@ enum { | |||
1972 | 96 | CTRL_ATTR_POLICY_DUMP_MAX = __CTRL_ATTR_POLICY_DUMP_MAX - 1 | 98 | CTRL_ATTR_POLICY_DUMP_MAX = __CTRL_ATTR_POLICY_DUMP_MAX - 1 |
1973 | 97 | }; | 99 | }; |
1974 | 98 | 100 | ||
1977 | 99 | #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) | 101 | #define CTRL_ATTR_POLICY_MAX (__CTRL_ATTR_POLICY_DUMP_MAX - 1) |
1976 | 100 | |||
1978 | 101 | 102 | ||
1979 | 102 | #endif /* _UAPI__LINUX_GENERIC_NETLINK_H */ | 103 | #endif /* _UAPI__LINUX_GENERIC_NETLINK_H */ |
1980 | diff --git a/src/basic/linux/if_bridge.h b/src/basic/linux/if_bridge.h | |||
1981 | index a86a7e7..d9de241 100644 | |||
1982 | --- a/src/basic/linux/if_bridge.h | |||
1983 | +++ b/src/basic/linux/if_bridge.h | |||
1984 | @@ -723,10 +723,31 @@ enum { | |||
1985 | 723 | enum { | 723 | enum { |
1986 | 724 | MDBE_ATTR_UNSPEC, | 724 | MDBE_ATTR_UNSPEC, |
1987 | 725 | MDBE_ATTR_SOURCE, | 725 | MDBE_ATTR_SOURCE, |
1988 | 726 | MDBE_ATTR_SRC_LIST, | ||
1989 | 727 | MDBE_ATTR_GROUP_MODE, | ||
1990 | 728 | MDBE_ATTR_RTPROT, | ||
1991 | 726 | __MDBE_ATTR_MAX, | 729 | __MDBE_ATTR_MAX, |
1992 | 727 | }; | 730 | }; |
1993 | 728 | #define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1) | 731 | #define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1) |
1994 | 729 | 732 | ||
1995 | 733 | /* per mdb entry source */ | ||
1996 | 734 | enum { | ||
1997 | 735 | MDBE_SRC_LIST_UNSPEC, | ||
1998 | 736 | MDBE_SRC_LIST_ENTRY, | ||
1999 | 737 | __MDBE_SRC_LIST_MAX, | ||
2000 | 738 | }; | ||
2001 | 739 | #define MDBE_SRC_LIST_MAX (__MDBE_SRC_LIST_MAX - 1) | ||
2002 | 740 | |||
2003 | 741 | /* per mdb entry per source attributes | ||
2004 | 742 | * these are embedded in MDBE_SRC_LIST_ENTRY | ||
2005 | 743 | */ | ||
2006 | 744 | enum { | ||
2007 | 745 | MDBE_SRCATTR_UNSPEC, | ||
2008 | 746 | MDBE_SRCATTR_ADDRESS, | ||
2009 | 747 | __MDBE_SRCATTR_MAX, | ||
2010 | 748 | }; | ||
2011 | 749 | #define MDBE_SRCATTR_MAX (__MDBE_SRCATTR_MAX - 1) | ||
2012 | 750 | |||
2013 | 730 | /* Embedded inside LINK_XSTATS_TYPE_BRIDGE */ | 751 | /* Embedded inside LINK_XSTATS_TYPE_BRIDGE */ |
2014 | 731 | enum { | 752 | enum { |
2015 | 732 | BRIDGE_XSTATS_UNSPEC, | 753 | BRIDGE_XSTATS_UNSPEC, |
2016 | diff --git a/src/basic/linux/if_ether.h b/src/basic/linux/if_ether.h | |||
2017 | index 1d0bccc..69e0457 100644 | |||
2018 | --- a/src/basic/linux/if_ether.h | |||
2019 | +++ b/src/basic/linux/if_ether.h | |||
2020 | @@ -116,6 +116,7 @@ | |||
2021 | 116 | #define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ | 116 | #define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ |
2022 | 117 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ | 117 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ |
2023 | 118 | #define ETH_P_DSA_8021Q 0xDADB /* Fake VLAN Header for DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ | 118 | #define ETH_P_DSA_8021Q 0xDADB /* Fake VLAN Header for DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ |
2024 | 119 | #define ETH_P_DSA_A5PSW 0xE001 /* A5PSW Tag Value [ NOT AN OFFICIALLY REGISTERED ID ] */ | ||
2025 | 119 | #define ETH_P_IFE 0xED3E /* ForCES inter-FE LFB type */ | 120 | #define ETH_P_IFE 0xED3E /* ForCES inter-FE LFB type */ |
2026 | 120 | #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ | 121 | #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ |
2027 | 121 | 122 | ||
2028 | @@ -137,6 +138,7 @@ | |||
2029 | 137 | #define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ | 138 | #define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ |
2030 | 138 | #define ETH_P_CAN 0x000C /* CAN: Controller Area Network */ | 139 | #define ETH_P_CAN 0x000C /* CAN: Controller Area Network */ |
2031 | 139 | #define ETH_P_CANFD 0x000D /* CANFD: CAN flexible data rate*/ | 140 | #define ETH_P_CANFD 0x000D /* CANFD: CAN flexible data rate*/ |
2032 | 141 | #define ETH_P_CANXL 0x000E /* CANXL: eXtended frame Length */ | ||
2033 | 140 | #define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ | 142 | #define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ |
2034 | 141 | #define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ | 143 | #define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ |
2035 | 142 | #define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ | 144 | #define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ |
2036 | diff --git a/src/basic/linux/if_link.h b/src/basic/linux/if_link.h | |||
2037 | index 5f58dcf..1021a7e 100644 | |||
2038 | --- a/src/basic/linux/if_link.h | |||
2039 | +++ b/src/basic/linux/if_link.h | |||
2040 | @@ -370,6 +370,9 @@ enum { | |||
2041 | 370 | IFLA_GRO_MAX_SIZE, | 370 | IFLA_GRO_MAX_SIZE, |
2042 | 371 | IFLA_TSO_MAX_SIZE, | 371 | IFLA_TSO_MAX_SIZE, |
2043 | 372 | IFLA_TSO_MAX_SEGS, | 372 | IFLA_TSO_MAX_SEGS, |
2044 | 373 | IFLA_ALLMULTI, /* Allmulti count: > 0 means acts ALLMULTI */ | ||
2045 | 374 | |||
2046 | 375 | IFLA_DEVLINK_PORT, | ||
2047 | 373 | 376 | ||
2048 | 374 | __IFLA_MAX | 377 | __IFLA_MAX |
2049 | 375 | }; | 378 | }; |
2050 | @@ -560,6 +563,7 @@ enum { | |||
2051 | 560 | IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT, | 563 | IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT, |
2052 | 561 | IFLA_BRPORT_MCAST_EHT_HOSTS_CNT, | 564 | IFLA_BRPORT_MCAST_EHT_HOSTS_CNT, |
2053 | 562 | IFLA_BRPORT_LOCKED, | 565 | IFLA_BRPORT_LOCKED, |
2054 | 566 | IFLA_BRPORT_MAB, | ||
2055 | 563 | __IFLA_BRPORT_MAX | 567 | __IFLA_BRPORT_MAX |
2056 | 564 | }; | 568 | }; |
2057 | 565 | #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) | 569 | #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) |
2058 | @@ -694,6 +698,7 @@ enum { | |||
2059 | 694 | IFLA_XFRM_UNSPEC, | 698 | IFLA_XFRM_UNSPEC, |
2060 | 695 | IFLA_XFRM_LINK, | 699 | IFLA_XFRM_LINK, |
2061 | 696 | IFLA_XFRM_IF_ID, | 700 | IFLA_XFRM_IF_ID, |
2062 | 701 | IFLA_XFRM_COLLECT_METADATA, | ||
2063 | 697 | __IFLA_XFRM_MAX | 702 | __IFLA_XFRM_MAX |
2064 | 698 | }; | 703 | }; |
2065 | 699 | 704 | ||
2066 | @@ -963,6 +968,7 @@ enum { | |||
2067 | 963 | IFLA_BOND_SLAVE_AD_AGGREGATOR_ID, | 968 | IFLA_BOND_SLAVE_AD_AGGREGATOR_ID, |
2068 | 964 | IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE, | 969 | IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE, |
2069 | 965 | IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE, | 970 | IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE, |
2070 | 971 | IFLA_BOND_SLAVE_PRIO, | ||
2071 | 966 | __IFLA_BOND_SLAVE_MAX, | 972 | __IFLA_BOND_SLAVE_MAX, |
2072 | 967 | }; | 973 | }; |
2073 | 968 | 974 | ||
2074 | @@ -1373,4 +1379,14 @@ enum { | |||
2075 | 1373 | 1379 | ||
2076 | 1374 | #define IFLA_MCTP_MAX (__IFLA_MCTP_MAX - 1) | 1380 | #define IFLA_MCTP_MAX (__IFLA_MCTP_MAX - 1) |
2077 | 1375 | 1381 | ||
2078 | 1382 | /* DSA section */ | ||
2079 | 1383 | |||
2080 | 1384 | enum { | ||
2081 | 1385 | IFLA_DSA_UNSPEC, | ||
2082 | 1386 | IFLA_DSA_MASTER, | ||
2083 | 1387 | __IFLA_DSA_MAX, | ||
2084 | 1388 | }; | ||
2085 | 1389 | |||
2086 | 1390 | #define IFLA_DSA_MAX (__IFLA_DSA_MAX - 1) | ||
2087 | 1391 | |||
2088 | 1376 | #endif /* _UAPI_LINUX_IF_LINK_H */ | 1392 | #endif /* _UAPI_LINUX_IF_LINK_H */ |
2089 | diff --git a/src/basic/linux/if_macsec.h b/src/basic/linux/if_macsec.h | |||
2090 | index 3af2aa0..d5b6d1f 100644 | |||
2091 | --- a/src/basic/linux/if_macsec.h | |||
2092 | +++ b/src/basic/linux/if_macsec.h | |||
2093 | @@ -22,6 +22,8 @@ | |||
2094 | 22 | 22 | ||
2095 | 23 | #define MACSEC_KEYID_LEN 16 | 23 | #define MACSEC_KEYID_LEN 16 |
2096 | 24 | 24 | ||
2097 | 25 | #define MACSEC_SALT_LEN 12 | ||
2098 | 26 | |||
2099 | 25 | /* cipher IDs as per IEEE802.1AE-2018 (Table 14-1) */ | 27 | /* cipher IDs as per IEEE802.1AE-2018 (Table 14-1) */ |
2100 | 26 | #define MACSEC_CIPHER_ID_GCM_AES_128 0x0080C20001000001ULL | 28 | #define MACSEC_CIPHER_ID_GCM_AES_128 0x0080C20001000001ULL |
2101 | 27 | #define MACSEC_CIPHER_ID_GCM_AES_256 0x0080C20001000002ULL | 29 | #define MACSEC_CIPHER_ID_GCM_AES_256 0x0080C20001000002ULL |
2102 | diff --git a/src/basic/linux/if_tun.h b/src/basic/linux/if_tun.h | |||
2103 | index 454ae31..287cdc8 100644 | |||
2104 | --- a/src/basic/linux/if_tun.h | |||
2105 | +++ b/src/basic/linux/if_tun.h | |||
2106 | @@ -67,6 +67,8 @@ | |||
2107 | 67 | #define IFF_TAP 0x0002 | 67 | #define IFF_TAP 0x0002 |
2108 | 68 | #define IFF_NAPI 0x0010 | 68 | #define IFF_NAPI 0x0010 |
2109 | 69 | #define IFF_NAPI_FRAGS 0x0020 | 69 | #define IFF_NAPI_FRAGS 0x0020 |
2110 | 70 | /* Used in TUNSETIFF to bring up tun/tap without carrier */ | ||
2111 | 71 | #define IFF_NO_CARRIER 0x0040 | ||
2112 | 70 | #define IFF_NO_PI 0x1000 | 72 | #define IFF_NO_PI 0x1000 |
2113 | 71 | /* This flag has no real effect */ | 73 | /* This flag has no real effect */ |
2114 | 72 | #define IFF_ONE_QUEUE 0x2000 | 74 | #define IFF_ONE_QUEUE 0x2000 |
2115 | @@ -88,6 +90,8 @@ | |||
2116 | 88 | #define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ | 90 | #define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ |
2117 | 89 | #define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ | 91 | #define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ |
2118 | 90 | #define TUN_F_UFO 0x10 /* I can handle UFO packets */ | 92 | #define TUN_F_UFO 0x10 /* I can handle UFO packets */ |
2119 | 93 | #define TUN_F_USO4 0x20 /* I can handle USO for IPv4 packets */ | ||
2120 | 94 | #define TUN_F_USO6 0x40 /* I can handle USO for IPv6 packets */ | ||
2121 | 91 | 95 | ||
2122 | 92 | /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ | 96 | /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ |
2123 | 93 | #define TUN_PKT_STRIP 0x0001 | 97 | #define TUN_PKT_STRIP 0x0001 |
2124 | @@ -108,7 +112,7 @@ struct tun_pi { | |||
2125 | 108 | struct tun_filter { | 112 | struct tun_filter { |
2126 | 109 | __u16 flags; /* TUN_FLT_ flags see above */ | 113 | __u16 flags; /* TUN_FLT_ flags see above */ |
2127 | 110 | __u16 count; /* Number of addresses */ | 114 | __u16 count; /* Number of addresses */ |
2129 | 111 | __u8 addr[0][ETH_ALEN]; | 115 | __u8 addr[][ETH_ALEN]; |
2130 | 112 | }; | 116 | }; |
2131 | 113 | 117 | ||
2132 | 114 | #endif /* _UAPI__IF_TUN_H */ | 118 | #endif /* _UAPI__IF_TUN_H */ |
2133 | diff --git a/src/basic/linux/in.h b/src/basic/linux/in.h | |||
2134 | index 1416822..07a4cb1 100644 | |||
2135 | --- a/src/basic/linux/in.h | |||
2136 | +++ b/src/basic/linux/in.h | |||
2137 | @@ -20,6 +20,7 @@ | |||
2138 | 20 | #define _UAPI_LINUX_IN_H | 20 | #define _UAPI_LINUX_IN_H |
2139 | 21 | 21 | ||
2140 | 22 | #include <linux/types.h> | 22 | #include <linux/types.h> |
2141 | 23 | #include <linux/stddef.h> | ||
2142 | 23 | #include <linux/libc-compat.h> | 24 | #include <linux/libc-compat.h> |
2143 | 24 | #include <linux/socket.h> | 25 | #include <linux/socket.h> |
2144 | 25 | 26 | ||
2145 | @@ -68,6 +69,8 @@ enum { | |||
2146 | 68 | #define IPPROTO_PIM IPPROTO_PIM | 69 | #define IPPROTO_PIM IPPROTO_PIM |
2147 | 69 | IPPROTO_COMP = 108, /* Compression Header Protocol */ | 70 | IPPROTO_COMP = 108, /* Compression Header Protocol */ |
2148 | 70 | #define IPPROTO_COMP IPPROTO_COMP | 71 | #define IPPROTO_COMP IPPROTO_COMP |
2149 | 72 | IPPROTO_L2TP = 115, /* Layer 2 Tunnelling Protocol */ | ||
2150 | 73 | #define IPPROTO_L2TP IPPROTO_L2TP | ||
2151 | 71 | IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */ | 74 | IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */ |
2152 | 72 | #define IPPROTO_SCTP IPPROTO_SCTP | 75 | #define IPPROTO_SCTP IPPROTO_SCTP |
2153 | 73 | IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */ | 76 | IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */ |
2154 | @@ -188,21 +191,13 @@ struct ip_mreq_source { | |||
2155 | 188 | }; | 191 | }; |
2156 | 189 | 192 | ||
2157 | 190 | struct ip_msfilter { | 193 | struct ip_msfilter { |
2158 | 194 | __be32 imsf_multiaddr; | ||
2159 | 195 | __be32 imsf_interface; | ||
2160 | 196 | __u32 imsf_fmode; | ||
2161 | 197 | __u32 imsf_numsrc; | ||
2162 | 191 | union { | 198 | union { |
2177 | 192 | struct { | 199 | __be32 imsf_slist[1]; |
2178 | 193 | __be32 imsf_multiaddr_aux; | 200 | __DECLARE_FLEX_ARRAY(__be32, imsf_slist_flex); |
2165 | 194 | __be32 imsf_interface_aux; | ||
2166 | 195 | __u32 imsf_fmode_aux; | ||
2167 | 196 | __u32 imsf_numsrc_aux; | ||
2168 | 197 | __be32 imsf_slist[1]; | ||
2169 | 198 | }; | ||
2170 | 199 | struct { | ||
2171 | 200 | __be32 imsf_multiaddr; | ||
2172 | 201 | __be32 imsf_interface; | ||
2173 | 202 | __u32 imsf_fmode; | ||
2174 | 203 | __u32 imsf_numsrc; | ||
2175 | 204 | __be32 imsf_slist_flex[]; | ||
2176 | 205 | }; | ||
2179 | 206 | }; | 201 | }; |
2180 | 207 | }; | 202 | }; |
2181 | 208 | 203 | ||
2182 | diff --git a/src/basic/linux/l2tp.h b/src/basic/linux/l2tp.h | |||
2183 | index bab8c97..7d81c3e 100644 | |||
2184 | --- a/src/basic/linux/l2tp.h | |||
2185 | +++ b/src/basic/linux/l2tp.h | |||
2186 | @@ -13,8 +13,6 @@ | |||
2187 | 13 | #include <linux/in.h> | 13 | #include <linux/in.h> |
2188 | 14 | #include <linux/in6.h> | 14 | #include <linux/in6.h> |
2189 | 15 | 15 | ||
2190 | 16 | #define IPPROTO_L2TP 115 | ||
2191 | 17 | |||
2192 | 18 | /** | 16 | /** |
2193 | 19 | * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets | 17 | * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets |
2194 | 20 | * @l2tp_family: address family number AF_L2TPIP. | 18 | * @l2tp_family: address family number AF_L2TPIP. |
2195 | diff --git a/src/basic/linux/netfilter/nf_tables.h b/src/basic/linux/netfilter/nf_tables.h | |||
2196 | index 466fd3f..cfa844d 100644 | |||
2197 | --- a/src/basic/linux/netfilter/nf_tables.h | |||
2198 | +++ b/src/basic/linux/netfilter/nf_tables.h | |||
2199 | @@ -97,6 +97,7 @@ enum nft_verdicts { | |||
2200 | 97 | * @NFT_MSG_NEWFLOWTABLE: add new flow table (enum nft_flowtable_attributes) | 97 | * @NFT_MSG_NEWFLOWTABLE: add new flow table (enum nft_flowtable_attributes) |
2201 | 98 | * @NFT_MSG_GETFLOWTABLE: get flow table (enum nft_flowtable_attributes) | 98 | * @NFT_MSG_GETFLOWTABLE: get flow table (enum nft_flowtable_attributes) |
2202 | 99 | * @NFT_MSG_DELFLOWTABLE: delete flow table (enum nft_flowtable_attributes) | 99 | * @NFT_MSG_DELFLOWTABLE: delete flow table (enum nft_flowtable_attributes) |
2203 | 100 | * @NFT_MSG_GETRULE_RESET: get rules and reset stateful expressions (enum nft_obj_attributes) | ||
2204 | 100 | */ | 101 | */ |
2205 | 101 | enum nf_tables_msg_types { | 102 | enum nf_tables_msg_types { |
2206 | 102 | NFT_MSG_NEWTABLE, | 103 | NFT_MSG_NEWTABLE, |
2207 | @@ -124,6 +125,7 @@ enum nf_tables_msg_types { | |||
2208 | 124 | NFT_MSG_NEWFLOWTABLE, | 125 | NFT_MSG_NEWFLOWTABLE, |
2209 | 125 | NFT_MSG_GETFLOWTABLE, | 126 | NFT_MSG_GETFLOWTABLE, |
2210 | 126 | NFT_MSG_DELFLOWTABLE, | 127 | NFT_MSG_DELFLOWTABLE, |
2211 | 128 | NFT_MSG_GETRULE_RESET, | ||
2212 | 127 | NFT_MSG_MAX, | 129 | NFT_MSG_MAX, |
2213 | 128 | }; | 130 | }; |
2214 | 129 | 131 | ||
2215 | @@ -760,6 +762,7 @@ enum nft_payload_bases { | |||
2216 | 760 | NFT_PAYLOAD_NETWORK_HEADER, | 762 | NFT_PAYLOAD_NETWORK_HEADER, |
2217 | 761 | NFT_PAYLOAD_TRANSPORT_HEADER, | 763 | NFT_PAYLOAD_TRANSPORT_HEADER, |
2218 | 762 | NFT_PAYLOAD_INNER_HEADER, | 764 | NFT_PAYLOAD_INNER_HEADER, |
2219 | 765 | NFT_PAYLOAD_TUN_HEADER, | ||
2220 | 763 | }; | 766 | }; |
2221 | 764 | 767 | ||
2222 | 765 | /** | 768 | /** |
2223 | @@ -779,6 +782,32 @@ enum nft_payload_csum_flags { | |||
2224 | 779 | NFT_PAYLOAD_L4CSUM_PSEUDOHDR = (1 << 0), | 782 | NFT_PAYLOAD_L4CSUM_PSEUDOHDR = (1 << 0), |
2225 | 780 | }; | 783 | }; |
2226 | 781 | 784 | ||
2227 | 785 | enum nft_inner_type { | ||
2228 | 786 | NFT_INNER_UNSPEC = 0, | ||
2229 | 787 | NFT_INNER_VXLAN, | ||
2230 | 788 | NFT_INNER_GENEVE, | ||
2231 | 789 | }; | ||
2232 | 790 | |||
2233 | 791 | enum nft_inner_flags { | ||
2234 | 792 | NFT_INNER_HDRSIZE = (1 << 0), | ||
2235 | 793 | NFT_INNER_LL = (1 << 1), | ||
2236 | 794 | NFT_INNER_NH = (1 << 2), | ||
2237 | 795 | NFT_INNER_TH = (1 << 3), | ||
2238 | 796 | }; | ||
2239 | 797 | #define NFT_INNER_MASK (NFT_INNER_HDRSIZE | NFT_INNER_LL | \ | ||
2240 | 798 | NFT_INNER_NH | NFT_INNER_TH) | ||
2241 | 799 | |||
2242 | 800 | enum nft_inner_attributes { | ||
2243 | 801 | NFTA_INNER_UNSPEC, | ||
2244 | 802 | NFTA_INNER_NUM, | ||
2245 | 803 | NFTA_INNER_TYPE, | ||
2246 | 804 | NFTA_INNER_FLAGS, | ||
2247 | 805 | NFTA_INNER_HDRSIZE, | ||
2248 | 806 | NFTA_INNER_EXPR, | ||
2249 | 807 | __NFTA_INNER_MAX | ||
2250 | 808 | }; | ||
2251 | 809 | #define NFTA_INNER_MAX (__NFTA_INNER_MAX - 1) | ||
2252 | 810 | |||
2253 | 782 | /** | 811 | /** |
2254 | 783 | * enum nft_payload_attributes - nf_tables payload expression netlink attributes | 812 | * enum nft_payload_attributes - nf_tables payload expression netlink attributes |
2255 | 784 | * | 813 | * |
2256 | diff --git a/src/basic/linux/netlink.h b/src/basic/linux/netlink.h | |||
2257 | index 855dffb..e2ae82e 100644 | |||
2258 | --- a/src/basic/linux/netlink.h | |||
2259 | +++ b/src/basic/linux/netlink.h | |||
2260 | @@ -20,7 +20,7 @@ | |||
2261 | 20 | #define NETLINK_CONNECTOR 11 | 20 | #define NETLINK_CONNECTOR 11 |
2262 | 21 | #define NETLINK_NETFILTER 12 /* netfilter subsystem */ | 21 | #define NETLINK_NETFILTER 12 /* netfilter subsystem */ |
2263 | 22 | #define NETLINK_IP6_FW 13 | 22 | #define NETLINK_IP6_FW 13 |
2265 | 23 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ | 23 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages (obsolete) */ |
2266 | 24 | #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ | 24 | #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ |
2267 | 25 | #define NETLINK_GENERIC 16 | 25 | #define NETLINK_GENERIC 16 |
2268 | 26 | /* leave room for NETLINK_DM (DM Events) */ | 26 | /* leave room for NETLINK_DM (DM Events) */ |
2269 | @@ -41,12 +41,20 @@ struct sockaddr_nl { | |||
2270 | 41 | __u32 nl_groups; /* multicast groups mask */ | 41 | __u32 nl_groups; /* multicast groups mask */ |
2271 | 42 | }; | 42 | }; |
2272 | 43 | 43 | ||
2273 | 44 | /** | ||
2274 | 45 | * struct nlmsghdr - fixed format metadata header of Netlink messages | ||
2275 | 46 | * @nlmsg_len: Length of message including header | ||
2276 | 47 | * @nlmsg_type: Message content type | ||
2277 | 48 | * @nlmsg_flags: Additional flags | ||
2278 | 49 | * @nlmsg_seq: Sequence number | ||
2279 | 50 | * @nlmsg_pid: Sending process port ID | ||
2280 | 51 | */ | ||
2281 | 44 | struct nlmsghdr { | 52 | struct nlmsghdr { |
2287 | 45 | __u32 nlmsg_len; /* Length of message including header */ | 53 | __u32 nlmsg_len; |
2288 | 46 | __u16 nlmsg_type; /* Message content */ | 54 | __u16 nlmsg_type; |
2289 | 47 | __u16 nlmsg_flags; /* Additional flags */ | 55 | __u16 nlmsg_flags; |
2290 | 48 | __u32 nlmsg_seq; /* Sequence number */ | 56 | __u32 nlmsg_seq; |
2291 | 49 | __u32 nlmsg_pid; /* Sending process port ID */ | 57 | __u32 nlmsg_pid; |
2292 | 50 | }; | 58 | }; |
2293 | 51 | 59 | ||
2294 | 52 | /* Flags values */ | 60 | /* Flags values */ |
2295 | @@ -54,7 +62,7 @@ struct nlmsghdr { | |||
2296 | 54 | #define NLM_F_REQUEST 0x01 /* It is request message. */ | 62 | #define NLM_F_REQUEST 0x01 /* It is request message. */ |
2297 | 55 | #define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */ | 63 | #define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */ |
2298 | 56 | #define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */ | 64 | #define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */ |
2300 | 57 | #define NLM_F_ECHO 0x08 /* Echo this request */ | 65 | #define NLM_F_ECHO 0x08 /* Receive resulting notifications */ |
2301 | 58 | #define NLM_F_DUMP_INTR 0x10 /* Dump was inconsistent due to sequence change */ | 66 | #define NLM_F_DUMP_INTR 0x10 /* Dump was inconsistent due to sequence change */ |
2302 | 59 | #define NLM_F_DUMP_FILTERED 0x20 /* Dump was filtered as requested */ | 67 | #define NLM_F_DUMP_FILTERED 0x20 /* Dump was filtered as requested */ |
2303 | 60 | 68 | ||
2304 | @@ -132,6 +140,10 @@ struct nlmsgerr { | |||
2305 | 132 | * be used - in the success case - to identify a created | 140 | * be used - in the success case - to identify a created |
2306 | 133 | * object or operation or similar (binary) | 141 | * object or operation or similar (binary) |
2307 | 134 | * @NLMSGERR_ATTR_POLICY: policy for a rejected attribute | 142 | * @NLMSGERR_ATTR_POLICY: policy for a rejected attribute |
2308 | 143 | * @NLMSGERR_ATTR_MISS_TYPE: type of a missing required attribute, | ||
2309 | 144 | * %NLMSGERR_ATTR_MISS_NEST will not be present if the attribute was | ||
2310 | 145 | * missing at the message level | ||
2311 | 146 | * @NLMSGERR_ATTR_MISS_NEST: offset of the nest where attribute was missing | ||
2312 | 135 | * @__NLMSGERR_ATTR_MAX: number of attributes | 147 | * @__NLMSGERR_ATTR_MAX: number of attributes |
2313 | 136 | * @NLMSGERR_ATTR_MAX: highest attribute number | 148 | * @NLMSGERR_ATTR_MAX: highest attribute number |
2314 | 137 | */ | 149 | */ |
2315 | @@ -141,6 +153,8 @@ enum nlmsgerr_attrs { | |||
2316 | 141 | NLMSGERR_ATTR_OFFS, | 153 | NLMSGERR_ATTR_OFFS, |
2317 | 142 | NLMSGERR_ATTR_COOKIE, | 154 | NLMSGERR_ATTR_COOKIE, |
2318 | 143 | NLMSGERR_ATTR_POLICY, | 155 | NLMSGERR_ATTR_POLICY, |
2319 | 156 | NLMSGERR_ATTR_MISS_TYPE, | ||
2320 | 157 | NLMSGERR_ATTR_MISS_NEST, | ||
2321 | 144 | 158 | ||
2322 | 145 | __NLMSGERR_ATTR_MAX, | 159 | __NLMSGERR_ATTR_MAX, |
2323 | 146 | NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1 | 160 | NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1 |
2324 | @@ -337,6 +351,9 @@ enum netlink_attribute_type { | |||
2325 | 337 | * bitfield32 type (U32) | 351 | * bitfield32 type (U32) |
2326 | 338 | * @NL_POLICY_TYPE_ATTR_MASK: mask of valid bits for unsigned integers (U64) | 352 | * @NL_POLICY_TYPE_ATTR_MASK: mask of valid bits for unsigned integers (U64) |
2327 | 339 | * @NL_POLICY_TYPE_ATTR_PAD: pad attribute for 64-bit alignment | 353 | * @NL_POLICY_TYPE_ATTR_PAD: pad attribute for 64-bit alignment |
2328 | 354 | * | ||
2329 | 355 | * @__NL_POLICY_TYPE_ATTR_MAX: number of attributes | ||
2330 | 356 | * @NL_POLICY_TYPE_ATTR_MAX: highest attribute number | ||
2331 | 340 | */ | 357 | */ |
2332 | 341 | enum netlink_policy_type_attr { | 358 | enum netlink_policy_type_attr { |
2333 | 342 | NL_POLICY_TYPE_ATTR_UNSPEC, | 359 | NL_POLICY_TYPE_ATTR_UNSPEC, |
2334 | diff --git a/src/basic/linux/nl80211.h b/src/basic/linux/nl80211.h | |||
2335 | index d9490e3..c14a91b 100644 | |||
2336 | --- a/src/basic/linux/nl80211.h | |||
2337 | +++ b/src/basic/linux/nl80211.h | |||
2338 | @@ -324,6 +324,17 @@ | |||
2339 | 324 | */ | 324 | */ |
2340 | 325 | 325 | ||
2341 | 326 | /** | 326 | /** |
2342 | 327 | * DOC: Multi-Link Operation | ||
2343 | 328 | * | ||
2344 | 329 | * In Multi-Link Operation, a connection between to MLDs utilizes multiple | ||
2345 | 330 | * links. To use this in nl80211, various commands and responses now need | ||
2346 | 331 | * to or will include the new %NL80211_ATTR_MLO_LINKS attribute. | ||
2347 | 332 | * Additionally, various commands that need to operate on a specific link | ||
2348 | 333 | * now need to be given the %NL80211_ATTR_MLO_LINK_ID attribute, e.g. to | ||
2349 | 334 | * use %NL80211_CMD_START_AP or similar functions. | ||
2350 | 335 | */ | ||
2351 | 336 | |||
2352 | 337 | /** | ||
2353 | 327 | * enum nl80211_commands - supported nl80211 commands | 338 | * enum nl80211_commands - supported nl80211 commands |
2354 | 328 | * | 339 | * |
2355 | 329 | * @NL80211_CMD_UNSPEC: unspecified command to catch errors | 340 | * @NL80211_CMD_UNSPEC: unspecified command to catch errors |
2356 | @@ -366,14 +377,22 @@ | |||
2357 | 366 | * the non-transmitting interfaces are deleted as well. | 377 | * the non-transmitting interfaces are deleted as well. |
2358 | 367 | * | 378 | * |
2359 | 368 | * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified | 379 | * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified |
2361 | 369 | * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. | 380 | * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC |
2362 | 381 | * represents peer's MLD address for MLO pairwise key. For MLO group key, | ||
2363 | 382 | * the link is identified by %NL80211_ATTR_MLO_LINK_ID. | ||
2364 | 370 | * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, | 383 | * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, |
2365 | 371 | * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. | 384 | * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. |
2366 | 385 | * For MLO connection, the link to set default key is identified by | ||
2367 | 386 | * %NL80211_ATTR_MLO_LINK_ID. | ||
2368 | 372 | * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, | 387 | * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, |
2369 | 373 | * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER, | 388 | * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER, |
2371 | 374 | * and %NL80211_ATTR_KEY_SEQ attributes. | 389 | * and %NL80211_ATTR_KEY_SEQ attributes. %NL80211_ATTR_MAC represents |
2372 | 390 | * peer's MLD address for MLO pairwise key. The link to add MLO | ||
2373 | 391 | * group key is identified by %NL80211_ATTR_MLO_LINK_ID. | ||
2374 | 375 | * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX | 392 | * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX |
2376 | 376 | * or %NL80211_ATTR_MAC. | 393 | * or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC represents peer's MLD address |
2377 | 394 | * for MLO pairwise key. The link to delete group key is identified by | ||
2378 | 395 | * %NL80211_ATTR_MLO_LINK_ID. | ||
2379 | 377 | * | 396 | * |
2380 | 378 | * @NL80211_CMD_GET_BEACON: (not used) | 397 | * @NL80211_CMD_GET_BEACON: (not used) |
2381 | 379 | * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface | 398 | * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface |
2382 | @@ -753,6 +772,13 @@ | |||
2383 | 753 | * %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA | 772 | * %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA |
2384 | 754 | * counters which will be updated to the current value. This attribute | 773 | * counters which will be updated to the current value. This attribute |
2385 | 755 | * is used during CSA period. | 774 | * is used during CSA period. |
2386 | 775 | * For TX on an MLD, the frequency can be omitted and the link ID be | ||
2387 | 776 | * specified, or if transmitting to a known peer MLD (with MLD addresses | ||
2388 | 777 | * in the frame) both can be omitted and the link will be selected by | ||
2389 | 778 | * lower layers. | ||
2390 | 779 | * For RX notification, %NL80211_ATTR_RX_HW_TIMESTAMP may be included to | ||
2391 | 780 | * indicate the frame RX timestamp and %NL80211_ATTR_TX_HW_TIMESTAMP may | ||
2392 | 781 | * be included to indicate the ack TX timestamp. | ||
2393 | 756 | * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this | 782 | * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this |
2394 | 757 | * command may be used with the corresponding cookie to cancel the wait | 783 | * command may be used with the corresponding cookie to cancel the wait |
2395 | 758 | * time if it is known that it is no longer necessary. This command is | 784 | * time if it is known that it is no longer necessary. This command is |
2396 | @@ -763,7 +789,9 @@ | |||
2397 | 763 | * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies | 789 | * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies |
2398 | 764 | * the TX command and %NL80211_ATTR_FRAME includes the contents of the | 790 | * the TX command and %NL80211_ATTR_FRAME includes the contents of the |
2399 | 765 | * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged | 791 | * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged |
2401 | 766 | * the frame. | 792 | * the frame. %NL80211_ATTR_TX_HW_TIMESTAMP may be included to indicate the |
2402 | 793 | * tx timestamp and %NL80211_ATTR_RX_HW_TIMESTAMP may be included to | ||
2403 | 794 | * indicate the ack RX timestamp. | ||
2404 | 767 | * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for | 795 | * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for |
2405 | 768 | * backward compatibility. | 796 | * backward compatibility. |
2406 | 769 | * | 797 | * |
2407 | @@ -1108,6 +1136,12 @@ | |||
2408 | 1108 | * has been received. %NL80211_ATTR_FRAME is used to specify the | 1136 | * has been received. %NL80211_ATTR_FRAME is used to specify the |
2409 | 1109 | * frame contents. The frame is the raw EAPoL data, without ethernet or | 1137 | * frame contents. The frame is the raw EAPoL data, without ethernet or |
2410 | 1110 | * 802.11 headers. | 1138 | * 802.11 headers. |
2411 | 1139 | * For an MLD transmitter, the %NL80211_ATTR_MLO_LINK_ID may be given and | ||
2412 | 1140 | * its effect will depend on the destination: If the destination is known | ||
2413 | 1141 | * to be an MLD, this will be used as a hint to select the link to transmit | ||
2414 | 1142 | * the frame on. If the destination is not an MLD, this will select both | ||
2415 | 1143 | * the link to transmit on and the source address will be set to the link | ||
2416 | 1144 | * address of that link. | ||
2417 | 1111 | * When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, | 1145 | * When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, |
2418 | 1112 | * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added | 1146 | * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added |
2419 | 1113 | * indicating the protocol type of the received frame; whether the frame | 1147 | * indicating the protocol type of the received frame; whether the frame |
2420 | @@ -1237,6 +1271,16 @@ | |||
2421 | 1237 | * to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to | 1271 | * to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to |
2422 | 1238 | * specify the timeout value. | 1272 | * specify the timeout value. |
2423 | 1239 | * | 1273 | * |
2424 | 1274 | * @NL80211_CMD_ADD_LINK: Add a new link to an interface. The | ||
2425 | 1275 | * %NL80211_ATTR_MLO_LINK_ID attribute is used for the new link. | ||
2426 | 1276 | * @NL80211_CMD_REMOVE_LINK: Remove a link from an interface. This may come | ||
2427 | 1277 | * without %NL80211_ATTR_MLO_LINK_ID as an easy way to remove all links | ||
2428 | 1278 | * in preparation for e.g. roaming to a regular (non-MLO) AP. | ||
2429 | 1279 | * | ||
2430 | 1280 | * @NL80211_CMD_ADD_LINK_STA: Add a link to an MLD station | ||
2431 | 1281 | * @NL80211_CMD_MODIFY_LINK_STA: Modify a link of an MLD station | ||
2432 | 1282 | * @NL80211_CMD_REMOVE_LINK_STA: Remove a link of an MLD station | ||
2433 | 1283 | * | ||
2434 | 1240 | * @NL80211_CMD_MAX: highest used command number | 1284 | * @NL80211_CMD_MAX: highest used command number |
2435 | 1241 | * @__NL80211_CMD_AFTER_LAST: internal use | 1285 | * @__NL80211_CMD_AFTER_LAST: internal use |
2436 | 1242 | */ | 1286 | */ |
2437 | @@ -1481,6 +1525,13 @@ enum nl80211_commands { | |||
2438 | 1481 | 1525 | ||
2439 | 1482 | NL80211_CMD_ASSOC_COMEBACK, | 1526 | NL80211_CMD_ASSOC_COMEBACK, |
2440 | 1483 | 1527 | ||
2441 | 1528 | NL80211_CMD_ADD_LINK, | ||
2442 | 1529 | NL80211_CMD_REMOVE_LINK, | ||
2443 | 1530 | |||
2444 | 1531 | NL80211_CMD_ADD_LINK_STA, | ||
2445 | 1532 | NL80211_CMD_MODIFY_LINK_STA, | ||
2446 | 1533 | NL80211_CMD_REMOVE_LINK_STA, | ||
2447 | 1534 | |||
2448 | 1484 | /* add new commands above here */ | 1535 | /* add new commands above here */ |
2449 | 1485 | 1536 | ||
2450 | 1486 | /* used to define NL80211_CMD_MAX below */ | 1537 | /* used to define NL80211_CMD_MAX below */ |
2451 | @@ -2340,8 +2391,10 @@ enum nl80211_commands { | |||
2452 | 2340 | * | 2391 | * |
2453 | 2341 | * @NL80211_ATTR_IFTYPE_EXT_CAPA: Nested attribute of the following attributes: | 2392 | * @NL80211_ATTR_IFTYPE_EXT_CAPA: Nested attribute of the following attributes: |
2454 | 2342 | * %NL80211_ATTR_IFTYPE, %NL80211_ATTR_EXT_CAPA, | 2393 | * %NL80211_ATTR_IFTYPE, %NL80211_ATTR_EXT_CAPA, |
2457 | 2343 | * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per | 2394 | * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities and |
2458 | 2344 | * interface type. | 2395 | * other interface-type specific capabilities per interface type. For MLO, |
2459 | 2396 | * %NL80211_ATTR_EML_CAPABILITY and %NL80211_ATTR_MLD_CAPA_AND_OPS are | ||
2460 | 2397 | * present. | ||
2461 | 2345 | * | 2398 | * |
2462 | 2346 | * @NL80211_ATTR_MU_MIMO_GROUP_DATA: array of 24 bytes that defines a MU-MIMO | 2399 | * @NL80211_ATTR_MU_MIMO_GROUP_DATA: array of 24 bytes that defines a MU-MIMO |
2463 | 2347 | * groupID for monitor mode. | 2400 | * groupID for monitor mode. |
2464 | @@ -2663,6 +2716,41 @@ enum nl80211_commands { | |||
2465 | 2663 | * association request when used with NL80211_CMD_NEW_STATION). Can be set | 2716 | * association request when used with NL80211_CMD_NEW_STATION). Can be set |
2466 | 2664 | * only if %NL80211_STA_FLAG_WME is set. | 2717 | * only if %NL80211_STA_FLAG_WME is set. |
2467 | 2665 | * | 2718 | * |
2468 | 2719 | * @NL80211_ATTR_MLO_LINK_ID: A (u8) link ID for use with MLO, to be used with | ||
2469 | 2720 | * various commands that need a link ID to operate. | ||
2470 | 2721 | * @NL80211_ATTR_MLO_LINKS: A nested array of links, each containing some | ||
2471 | 2722 | * per-link information and a link ID. | ||
2472 | 2723 | * @NL80211_ATTR_MLD_ADDR: An MLD address, used with various commands such as | ||
2473 | 2724 | * authenticate/associate. | ||
2474 | 2725 | * | ||
2475 | 2726 | * @NL80211_ATTR_MLO_SUPPORT: Flag attribute to indicate user space supports MLO | ||
2476 | 2727 | * connection. Used with %NL80211_CMD_CONNECT. If this attribute is not | ||
2477 | 2728 | * included in NL80211_CMD_CONNECT drivers must not perform MLO connection. | ||
2478 | 2729 | * | ||
2479 | 2730 | * @NL80211_ATTR_MAX_NUM_AKM_SUITES: U16 attribute. Indicates maximum number of | ||
2480 | 2731 | * AKM suites allowed for %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and | ||
2481 | 2732 | * %NL80211_CMD_START_AP in %NL80211_CMD_GET_WIPHY response. If this | ||
2482 | 2733 | * attribute is not present userspace shall consider maximum number of AKM | ||
2483 | 2734 | * suites allowed as %NL80211_MAX_NR_AKM_SUITES which is the legacy maximum | ||
2484 | 2735 | * number prior to the introduction of this attribute. | ||
2485 | 2736 | * | ||
2486 | 2737 | * @NL80211_ATTR_EML_CAPABILITY: EML Capability information (u16) | ||
2487 | 2738 | * @NL80211_ATTR_MLD_CAPA_AND_OPS: MLD Capabilities and Operations (u16) | ||
2488 | 2739 | * | ||
2489 | 2740 | * @NL80211_ATTR_TX_HW_TIMESTAMP: Hardware timestamp for TX operation in | ||
2490 | 2741 | * nanoseconds (u64). This is the device clock timestamp so it will | ||
2491 | 2742 | * probably reset when the device is stopped or the firmware is reset. | ||
2492 | 2743 | * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the frame TX | ||
2493 | 2744 | * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates | ||
2494 | 2745 | * the ack TX timestamp. | ||
2495 | 2746 | * @NL80211_ATTR_RX_HW_TIMESTAMP: Hardware timestamp for RX operation in | ||
2496 | 2747 | * nanoseconds (u64). This is the device clock timestamp so it will | ||
2497 | 2748 | * probably reset when the device is stopped or the firmware is reset. | ||
2498 | 2749 | * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX | ||
2499 | 2750 | * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates | ||
2500 | 2751 | * the incoming frame RX timestamp. | ||
2501 | 2752 | * @NL80211_ATTR_TD_BITMAP: Transition Disable bitmap, for subsequent | ||
2502 | 2753 | * (re)associations. | ||
2503 | 2666 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available | 2754 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available |
2504 | 2667 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 2755 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
2505 | 2668 | * @__NL80211_ATTR_AFTER_LAST: internal use | 2756 | * @__NL80211_ATTR_AFTER_LAST: internal use |
2506 | @@ -3177,6 +3265,21 @@ enum nl80211_attrs { | |||
2507 | 3177 | 3265 | ||
2508 | 3178 | NL80211_ATTR_DISABLE_EHT, | 3266 | NL80211_ATTR_DISABLE_EHT, |
2509 | 3179 | 3267 | ||
2510 | 3268 | NL80211_ATTR_MLO_LINKS, | ||
2511 | 3269 | NL80211_ATTR_MLO_LINK_ID, | ||
2512 | 3270 | NL80211_ATTR_MLD_ADDR, | ||
2513 | 3271 | |||
2514 | 3272 | NL80211_ATTR_MLO_SUPPORT, | ||
2515 | 3273 | |||
2516 | 3274 | NL80211_ATTR_MAX_NUM_AKM_SUITES, | ||
2517 | 3275 | |||
2518 | 3276 | NL80211_ATTR_EML_CAPABILITY, | ||
2519 | 3277 | NL80211_ATTR_MLD_CAPA_AND_OPS, | ||
2520 | 3278 | |||
2521 | 3279 | NL80211_ATTR_TX_HW_TIMESTAMP, | ||
2522 | 3280 | NL80211_ATTR_RX_HW_TIMESTAMP, | ||
2523 | 3281 | NL80211_ATTR_TD_BITMAP, | ||
2524 | 3282 | |||
2525 | 3180 | /* add attributes here, update the policy in nl80211.c */ | 3283 | /* add attributes here, update the policy in nl80211.c */ |
2526 | 3181 | 3284 | ||
2527 | 3182 | __NL80211_ATTR_AFTER_LAST, | 3285 | __NL80211_ATTR_AFTER_LAST, |
2528 | @@ -3231,6 +3334,11 @@ enum nl80211_attrs { | |||
2529 | 3231 | #define NL80211_HE_MIN_CAPABILITY_LEN 16 | 3334 | #define NL80211_HE_MIN_CAPABILITY_LEN 16 |
2530 | 3232 | #define NL80211_HE_MAX_CAPABILITY_LEN 54 | 3335 | #define NL80211_HE_MAX_CAPABILITY_LEN 54 |
2531 | 3233 | #define NL80211_MAX_NR_CIPHER_SUITES 5 | 3336 | #define NL80211_MAX_NR_CIPHER_SUITES 5 |
2532 | 3337 | |||
2533 | 3338 | /* | ||
2534 | 3339 | * NL80211_MAX_NR_AKM_SUITES is obsolete when %NL80211_ATTR_MAX_NUM_AKM_SUITES | ||
2535 | 3340 | * present in %NL80211_CMD_GET_WIPHY response. | ||
2536 | 3341 | */ | ||
2537 | 3234 | #define NL80211_MAX_NR_AKM_SUITES 2 | 3342 | #define NL80211_MAX_NR_AKM_SUITES 2 |
2538 | 3235 | #define NL80211_EHT_MIN_CAPABILITY_LEN 13 | 3343 | #define NL80211_EHT_MIN_CAPABILITY_LEN 13 |
2539 | 3236 | #define NL80211_EHT_MAX_CAPABILITY_LEN 51 | 3344 | #define NL80211_EHT_MAX_CAPABILITY_LEN 51 |
2540 | @@ -4853,6 +4961,8 @@ enum nl80211_bss_scan_width { | |||
2541 | 4853 | * Contains a nested array of signal strength attributes (u8, dBm), | 4961 | * Contains a nested array of signal strength attributes (u8, dBm), |
2542 | 4854 | * using the nesting index as the antenna number. | 4962 | * using the nesting index as the antenna number. |
2543 | 4855 | * @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz | 4963 | * @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz |
2544 | 4964 | * @NL80211_BSS_MLO_LINK_ID: MLO link ID of the BSS (u8). | ||
2545 | 4965 | * @NL80211_BSS_MLD_ADDR: MLD address of this BSS if connected to it. | ||
2546 | 4856 | * @__NL80211_BSS_AFTER_LAST: internal | 4966 | * @__NL80211_BSS_AFTER_LAST: internal |
2547 | 4857 | * @NL80211_BSS_MAX: highest BSS attribute | 4967 | * @NL80211_BSS_MAX: highest BSS attribute |
2548 | 4858 | */ | 4968 | */ |
2549 | @@ -4878,6 +4988,8 @@ enum nl80211_bss { | |||
2550 | 4878 | NL80211_BSS_PARENT_BSSID, | 4988 | NL80211_BSS_PARENT_BSSID, |
2551 | 4879 | NL80211_BSS_CHAIN_SIGNAL, | 4989 | NL80211_BSS_CHAIN_SIGNAL, |
2552 | 4880 | NL80211_BSS_FREQUENCY_OFFSET, | 4990 | NL80211_BSS_FREQUENCY_OFFSET, |
2553 | 4991 | NL80211_BSS_MLO_LINK_ID, | ||
2554 | 4992 | NL80211_BSS_MLD_ADDR, | ||
2555 | 4881 | 4993 | ||
2556 | 4882 | /* keep last */ | 4994 | /* keep last */ |
2557 | 4883 | __NL80211_BSS_AFTER_LAST, | 4995 | __NL80211_BSS_AFTER_LAST, |
2558 | @@ -5874,7 +5986,7 @@ enum nl80211_ap_sme_features { | |||
2559 | 5874 | * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up | 5986 | * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up |
2560 | 5875 | * the connected inactive stations in AP mode. | 5987 | * the connected inactive stations in AP mode. |
2561 | 5876 | * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested | 5988 | * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested |
2563 | 5877 | * to work properly to suppport receiving regulatory hints from | 5989 | * to work properly to support receiving regulatory hints from |
2564 | 5878 | * cellular base stations. | 5990 | * cellular base stations. |
2565 | 5879 | * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: (no longer available, only | 5991 | * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: (no longer available, only |
2566 | 5880 | * here to reserve the value for API/ABI compatibility) | 5992 | * here to reserve the value for API/ABI compatibility) |
2567 | @@ -6174,6 +6286,14 @@ enum nl80211_feature_flags { | |||
2568 | 6174 | * @NL80211_EXT_FEATURE_RADAR_BACKGROUND: Device supports background radar/CAC | 6286 | * @NL80211_EXT_FEATURE_RADAR_BACKGROUND: Device supports background radar/CAC |
2569 | 6175 | * detection. | 6287 | * detection. |
2570 | 6176 | * | 6288 | * |
2571 | 6289 | * @NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE: Device can perform a MAC address | ||
2572 | 6290 | * change without having to bring the underlying network device down | ||
2573 | 6291 | * first. For example, in station mode this can be used to vary the | ||
2574 | 6292 | * origin MAC address prior to a connection to a new AP for privacy | ||
2575 | 6293 | * or other reasons. Note that certain driver specific restrictions | ||
2576 | 6294 | * might apply, e.g. no scans in progress, no offchannel operations | ||
2577 | 6295 | * in progress, and no active connections. | ||
2578 | 6296 | * | ||
2579 | 6177 | * @NUM_NL80211_EXT_FEATURES: number of extended features. | 6297 | * @NUM_NL80211_EXT_FEATURES: number of extended features. |
2580 | 6178 | * @MAX_NL80211_EXT_FEATURES: highest extended feature index. | 6298 | * @MAX_NL80211_EXT_FEATURES: highest extended feature index. |
2581 | 6179 | */ | 6299 | */ |
2582 | @@ -6241,6 +6361,7 @@ enum nl80211_ext_feature_index { | |||
2583 | 6241 | NL80211_EXT_FEATURE_BSS_COLOR, | 6361 | NL80211_EXT_FEATURE_BSS_COLOR, |
2584 | 6242 | NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD, | 6362 | NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD, |
2585 | 6243 | NL80211_EXT_FEATURE_RADAR_BACKGROUND, | 6363 | NL80211_EXT_FEATURE_RADAR_BACKGROUND, |
2586 | 6364 | NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE, | ||
2587 | 6244 | 6365 | ||
2588 | 6245 | /* add new features before the definition below */ | 6366 | /* add new features before the definition below */ |
2589 | 6246 | NUM_NL80211_EXT_FEATURES, | 6367 | NUM_NL80211_EXT_FEATURES, |
2590 | diff --git a/src/basic/linux/pkt_sched.h b/src/basic/linux/pkt_sched.h | |||
2591 | index f292b46..000eec1 100644 | |||
2592 | --- a/src/basic/linux/pkt_sched.h | |||
2593 | +++ b/src/basic/linux/pkt_sched.h | |||
2594 | @@ -1233,6 +1233,16 @@ enum { | |||
2595 | 1233 | #define TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD _BITUL(1) | 1233 | #define TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD _BITUL(1) |
2596 | 1234 | 1234 | ||
2597 | 1235 | enum { | 1235 | enum { |
2598 | 1236 | TCA_TAPRIO_TC_ENTRY_UNSPEC, | ||
2599 | 1237 | TCA_TAPRIO_TC_ENTRY_INDEX, /* u32 */ | ||
2600 | 1238 | TCA_TAPRIO_TC_ENTRY_MAX_SDU, /* u32 */ | ||
2601 | 1239 | |||
2602 | 1240 | /* add new constants above here */ | ||
2603 | 1241 | __TCA_TAPRIO_TC_ENTRY_CNT, | ||
2604 | 1242 | TCA_TAPRIO_TC_ENTRY_MAX = (__TCA_TAPRIO_TC_ENTRY_CNT - 1) | ||
2605 | 1243 | }; | ||
2606 | 1244 | |||
2607 | 1245 | enum { | ||
2608 | 1236 | TCA_TAPRIO_ATTR_UNSPEC, | 1246 | TCA_TAPRIO_ATTR_UNSPEC, |
2609 | 1237 | TCA_TAPRIO_ATTR_PRIOMAP, /* struct tc_mqprio_qopt */ | 1247 | TCA_TAPRIO_ATTR_PRIOMAP, /* struct tc_mqprio_qopt */ |
2610 | 1238 | TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST, /* nested of entry */ | 1248 | TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST, /* nested of entry */ |
2611 | @@ -1245,6 +1255,7 @@ enum { | |||
2612 | 1245 | TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION, /* s64 */ | 1255 | TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION, /* s64 */ |
2613 | 1246 | TCA_TAPRIO_ATTR_FLAGS, /* u32 */ | 1256 | TCA_TAPRIO_ATTR_FLAGS, /* u32 */ |
2614 | 1247 | TCA_TAPRIO_ATTR_TXTIME_DELAY, /* u32 */ | 1257 | TCA_TAPRIO_ATTR_TXTIME_DELAY, /* u32 */ |
2615 | 1258 | TCA_TAPRIO_ATTR_TC_ENTRY, /* nest */ | ||
2616 | 1248 | __TCA_TAPRIO_ATTR_MAX, | 1259 | __TCA_TAPRIO_ATTR_MAX, |
2617 | 1249 | }; | 1260 | }; |
2618 | 1250 | 1261 | ||
2619 | diff --git a/src/basic/linux/rtnetlink.h b/src/basic/linux/rtnetlink.h | |||
2620 | index 83849a3..eb2747d 100644 | |||
2621 | --- a/src/basic/linux/rtnetlink.h | |||
2622 | +++ b/src/basic/linux/rtnetlink.h | |||
2623 | @@ -440,7 +440,7 @@ struct rtnexthop { | |||
2624 | 440 | /* RTA_VIA */ | 440 | /* RTA_VIA */ |
2625 | 441 | struct rtvia { | 441 | struct rtvia { |
2626 | 442 | __kernel_sa_family_t rtvia_family; | 442 | __kernel_sa_family_t rtvia_family; |
2628 | 443 | __u8 rtvia_addr[0]; | 443 | __u8 rtvia_addr[]; |
2629 | 444 | }; | 444 | }; |
2630 | 445 | 445 | ||
2631 | 446 | /* RTM_CACHEINFO */ | 446 | /* RTM_CACHEINFO */ |
2632 | diff --git a/src/basic/linux/stddef.h b/src/basic/linux/stddef.h | |||
2633 | 447 | new file mode 100644 | 447 | new file mode 100644 |
2634 | index 0000000..1a73963 | |||
2635 | --- /dev/null | |||
2636 | +++ b/src/basic/linux/stddef.h | |||
2637 | @@ -0,0 +1,46 @@ | |||
2638 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
2639 | 2 | #ifndef _UAPI_LINUX_STDDEF_H | ||
2640 | 3 | #define _UAPI_LINUX_STDDEF_H | ||
2641 | 4 | |||
2642 | 5 | |||
2643 | 6 | #ifndef __always_inline | ||
2644 | 7 | #define __always_inline inline | ||
2645 | 8 | #endif | ||
2646 | 9 | |||
2647 | 10 | /** | ||
2648 | 11 | * __struct_group() - Create a mirrored named and anonyomous struct | ||
2649 | 12 | * | ||
2650 | 13 | * @TAG: The tag name for the named sub-struct (usually empty) | ||
2651 | 14 | * @NAME: The identifier name of the mirrored sub-struct | ||
2652 | 15 | * @ATTRS: Any struct attributes (usually empty) | ||
2653 | 16 | * @MEMBERS: The member declarations for the mirrored structs | ||
2654 | 17 | * | ||
2655 | 18 | * Used to create an anonymous union of two structs with identical layout | ||
2656 | 19 | * and size: one anonymous and one named. The former's members can be used | ||
2657 | 20 | * normally without sub-struct naming, and the latter can be used to | ||
2658 | 21 | * reason about the start, end, and size of the group of struct members. | ||
2659 | 22 | * The named struct can also be explicitly tagged for layer reuse, as well | ||
2660 | 23 | * as both having struct attributes appended. | ||
2661 | 24 | */ | ||
2662 | 25 | #define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \ | ||
2663 | 26 | union { \ | ||
2664 | 27 | struct { MEMBERS } ATTRS; \ | ||
2665 | 28 | struct TAG { MEMBERS } ATTRS NAME; \ | ||
2666 | 29 | } | ||
2667 | 30 | |||
2668 | 31 | /** | ||
2669 | 32 | * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union | ||
2670 | 33 | * | ||
2671 | 34 | * @TYPE: The type of each flexible array element | ||
2672 | 35 | * @NAME: The name of the flexible array member | ||
2673 | 36 | * | ||
2674 | 37 | * In order to have a flexible array member in a union or alone in a | ||
2675 | 38 | * struct, it needs to be wrapped in an anonymous struct with at least 1 | ||
2676 | 39 | * named member, but that member can be empty. | ||
2677 | 40 | */ | ||
2678 | 41 | #define __DECLARE_FLEX_ARRAY(TYPE, NAME) \ | ||
2679 | 42 | struct { \ | ||
2680 | 43 | struct { } __empty_ ## NAME; \ | ||
2681 | 44 | TYPE NAME[]; \ | ||
2682 | 45 | } | ||
2683 | 46 | #endif | ||
2684 | diff --git a/src/basic/linux/update.sh b/src/basic/linux/update.sh | |||
2685 | index 72e133d..6aff039 100755 | |||
2686 | --- a/src/basic/linux/update.sh | |||
2687 | +++ b/src/basic/linux/update.sh | |||
2688 | @@ -6,5 +6,5 @@ set -o pipefail | |||
2689 | 6 | for i in *.h */*.h; do | 6 | for i in *.h */*.h; do |
2690 | 7 | curl --fail "https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/$i" -o "$i" | 7 | curl --fail "https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/$i" -o "$i" |
2691 | 8 | 8 | ||
2693 | 9 | sed -i -e 's/__user //g' -e '/^#include <linux\/compiler.h>/ d' "$i" | 9 | sed -r -i -e 's/__user //g' -e '/^#include <linux\/compiler(_types)?.h>/ d' "$i" |
2694 | 10 | done | 10 | done |
2695 | diff --git a/src/basic/virt.c b/src/basic/virt.c | |||
2696 | index f800bba..c6914d5 100644 | |||
2697 | --- a/src/basic/virt.c | |||
2698 | +++ b/src/basic/virt.c | |||
2699 | @@ -778,7 +778,7 @@ translate_name: | |||
2700 | 778 | /* Some images hardcode container=oci, but OCI is not a specific container manager. | 778 | /* Some images hardcode container=oci, but OCI is not a specific container manager. |
2701 | 779 | * Try to detect one based on well-known files. */ | 779 | * Try to detect one based on well-known files. */ |
2702 | 780 | v = detect_container_files(); | 780 | v = detect_container_files(); |
2704 | 781 | if (v != VIRTUALIZATION_NONE) | 781 | if (v == VIRTUALIZATION_NONE) |
2705 | 782 | v = VIRTUALIZATION_CONTAINER_OTHER; | 782 | v = VIRTUALIZATION_CONTAINER_OTHER; |
2706 | 783 | goto finish; | 783 | goto finish; |
2707 | 784 | } | 784 | } |
2708 | diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c | |||
2709 | index 25a0215..1f4a7db 100644 | |||
2710 | --- a/src/boot/efi/boot.c | |||
2711 | +++ b/src/boot/efi/boot.c | |||
2712 | @@ -1573,7 +1573,7 @@ static EFI_STATUS efivar_get_timeout(const char16_t *var, uint32_t *ret_value) { | |||
2713 | 1573 | 1573 | ||
2714 | 1574 | static void config_load_defaults(Config *config, EFI_FILE *root_dir) { | 1574 | static void config_load_defaults(Config *config, EFI_FILE *root_dir) { |
2715 | 1575 | _cleanup_free_ char *content = NULL; | 1575 | _cleanup_free_ char *content = NULL; |
2717 | 1576 | UINTN value; | 1576 | UINTN value = 0; /* avoid false maybe-uninitialized warning */ |
2718 | 1577 | EFI_STATUS err; | 1577 | EFI_STATUS err; |
2719 | 1578 | 1578 | ||
2720 | 1579 | assert(root_dir); | 1579 | assert(root_dir); |
2721 | @@ -2257,7 +2257,7 @@ static void config_load_xbootldr( | |||
2722 | 2257 | EFI_HANDLE *device) { | 2257 | EFI_HANDLE *device) { |
2723 | 2258 | 2258 | ||
2724 | 2259 | _cleanup_(file_closep) EFI_FILE *root_dir = NULL; | 2259 | _cleanup_(file_closep) EFI_FILE *root_dir = NULL; |
2726 | 2260 | EFI_HANDLE new_device; | 2260 | EFI_HANDLE new_device = NULL; /* avoid false maybe-uninitialized warning */ |
2727 | 2261 | EFI_STATUS err; | 2261 | EFI_STATUS err; |
2728 | 2262 | 2262 | ||
2729 | 2263 | assert(config); | 2263 | assert(config); |
2730 | @@ -2319,6 +2319,9 @@ static EFI_STATUS initrd_prepare( | |||
2731 | 2319 | if (err != EFI_SUCCESS) | 2319 | if (err != EFI_SUCCESS) |
2732 | 2320 | return err; | 2320 | return err; |
2733 | 2321 | 2321 | ||
2734 | 2322 | if (info->FileSize == 0) /* Automatically skip over empty files */ | ||
2735 | 2323 | continue; | ||
2736 | 2324 | |||
2737 | 2322 | UINTN new_size, read_size = info->FileSize; | 2325 | UINTN new_size, read_size = info->FileSize; |
2738 | 2323 | if (__builtin_add_overflow(size, read_size, &new_size)) | 2326 | if (__builtin_add_overflow(size, read_size, &new_size)) |
2739 | 2324 | return EFI_OUT_OF_RESOURCES; | 2327 | return EFI_OUT_OF_RESOURCES; |
2740 | diff --git a/src/boot/efi/console.c b/src/boot/efi/console.c | |||
2741 | index cd980fd..14c0008 100644 | |||
2742 | --- a/src/boot/efi/console.c | |||
2743 | +++ b/src/boot/efi/console.c | |||
2744 | @@ -12,20 +12,6 @@ | |||
2745 | 12 | #define VERTICAL_MAX_OK 1080 | 12 | #define VERTICAL_MAX_OK 1080 |
2746 | 13 | #define VIEWPORT_RATIO 10 | 13 | #define VIEWPORT_RATIO 10 |
2747 | 14 | 14 | ||
2748 | 15 | static EFI_STATUS console_connect(void) { | ||
2749 | 16 | EFI_BOOT_MANAGER_POLICY_PROTOCOL *boot_policy; | ||
2750 | 17 | EFI_STATUS err; | ||
2751 | 18 | |||
2752 | 19 | /* This should make console devices appear/fully initialize on fastboot firmware. */ | ||
2753 | 20 | |||
2754 | 21 | err = BS->LocateProtocol( | ||
2755 | 22 | &(EFI_GUID) EFI_BOOT_MANAGER_POLICY_PROTOCOL_GUID, NULL, (void **) &boot_policy); | ||
2756 | 23 | if (err != EFI_SUCCESS) | ||
2757 | 24 | return err; | ||
2758 | 25 | |||
2759 | 26 | return boot_policy->ConnectDeviceClass(boot_policy, &(EFI_GUID) EFI_BOOT_MANAGER_POLICY_CONSOLE_GUID); | ||
2760 | 27 | } | ||
2761 | 28 | |||
2762 | 29 | static inline void event_closep(EFI_EVENT *event) { | 15 | static inline void event_closep(EFI_EVENT *event) { |
2763 | 30 | if (!*event) | 16 | if (!*event) |
2764 | 31 | return; | 17 | return; |
2765 | @@ -61,8 +47,6 @@ EFI_STATUS console_key_read(uint64_t *key, uint64_t timeout_usec) { | |||
2766 | 61 | assert(key); | 47 | assert(key); |
2767 | 62 | 48 | ||
2768 | 63 | if (!checked) { | 49 | if (!checked) { |
2769 | 64 | console_connect(); | ||
2770 | 65 | |||
2771 | 66 | /* Get the *first* TextInputEx device.*/ | 50 | /* Get the *first* TextInputEx device.*/ |
2772 | 67 | err = BS->LocateProtocol(&SimpleTextInputExProtocol, NULL, (void **) &extraInEx); | 51 | err = BS->LocateProtocol(&SimpleTextInputExProtocol, NULL, (void **) &extraInEx); |
2773 | 68 | if (err != EFI_SUCCESS || BS->CheckEvent(extraInEx->WaitForKeyEx) == EFI_INVALID_PARAMETER) | 52 | if (err != EFI_SUCCESS || BS->CheckEvent(extraInEx->WaitForKeyEx) == EFI_INVALID_PARAMETER) |
2774 | diff --git a/src/boot/efi/cpio.c b/src/boot/efi/cpio.c | |||
2775 | index 76e2cd7..79b5d43 100644 | |||
2776 | --- a/src/boot/efi/cpio.c | |||
2777 | +++ b/src/boot/efi/cpio.c | |||
2778 | @@ -468,7 +468,7 @@ EFI_STATUS pack_cpio( | |||
2779 | 468 | 468 | ||
2780 | 469 | for (UINTN i = 0; i < n_items; i++) { | 469 | for (UINTN i = 0; i < n_items; i++) { |
2781 | 470 | _cleanup_free_ char *content = NULL; | 470 | _cleanup_free_ char *content = NULL; |
2783 | 471 | UINTN contentsize; | 471 | UINTN contentsize = 0; /* avoid false maybe-uninitialized warning */ |
2784 | 472 | 472 | ||
2785 | 473 | err = file_read(extra_dir, items[i], 0, 0, &content, &contentsize); | 473 | err = file_read(extra_dir, items[i], 0, 0, &content, &contentsize); |
2786 | 474 | if (err != EFI_SUCCESS) { | 474 | if (err != EFI_SUCCESS) { |
2787 | diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build | |||
2788 | index 0de4399..fa61c3e 100644 | |||
2789 | --- a/src/boot/efi/meson.build | |||
2790 | +++ b/src/boot/efi/meson.build | |||
2791 | @@ -55,6 +55,7 @@ if not cc.has_header_symbol('efi.h', 'EFI_IMAGE_MACHINE_X64', | |||
2792 | 55 | endif | 55 | endif |
2793 | 56 | 56 | ||
2794 | 57 | objcopy = run_command(cc.cmd_array(), '-print-prog-name=objcopy', check: true).stdout().strip() | 57 | objcopy = run_command(cc.cmd_array(), '-print-prog-name=objcopy', check: true).stdout().strip() |
2795 | 58 | objcopy_2_38 = find_program('objcopy', version: '>=2.38', required: false) | ||
2796 | 58 | 59 | ||
2797 | 59 | efi_ld = get_option('efi-ld') | 60 | efi_ld = get_option('efi-ld') |
2798 | 60 | if efi_ld == 'auto' | 61 | if efi_ld == 'auto' |
2799 | @@ -283,9 +284,17 @@ foreach arg : ['-Wl,--no-warn-execstack', | |||
2800 | 283 | endif | 284 | endif |
2801 | 284 | endforeach | 285 | endforeach |
2802 | 285 | 286 | ||
2804 | 286 | if efi_arch[1] in ['aarch64', 'arm', 'riscv64'] | 287 | # If using objcopy, crt0 must not include the PE/COFF header |
2805 | 288 | if run_command('grep', '-q', 'coff_header', efi_crt0, check: false).returncode() == 0 | ||
2806 | 289 | coff_header_in_crt0 = true | ||
2807 | 290 | else | ||
2808 | 291 | coff_header_in_crt0 = false | ||
2809 | 292 | endif | ||
2810 | 293 | |||
2811 | 294 | if efi_arch[1] in ['arm', 'riscv64'] or (efi_arch[1] == 'aarch64' and (not objcopy_2_38.found() or coff_header_in_crt0)) | ||
2812 | 287 | efi_ldflags += ['-shared'] | 295 | efi_ldflags += ['-shared'] |
2814 | 288 | # Aarch64, ARM32 and 64bit RISC-V don't have an EFI capable objcopy. | 296 | # ARM32 and 64bit RISC-V don't have an EFI capable objcopy. |
2815 | 297 | # Older objcopy doesn't support Aarch64 either. | ||
2816 | 289 | # Use 'binary' instead, and add required symbols manually. | 298 | # Use 'binary' instead, and add required symbols manually. |
2817 | 290 | efi_ldflags += ['-Wl,--defsym=EFI_SUBSYSTEM=0xa'] | 299 | efi_ldflags += ['-Wl,--defsym=EFI_SUBSYSTEM=0xa'] |
2818 | 291 | efi_format = ['-O', 'binary'] | 300 | efi_format = ['-O', 'binary'] |
2819 | diff --git a/src/boot/efi/missing_efi.h b/src/boot/efi/missing_efi.h | |||
2820 | index b446e03..250c84c 100644 | |||
2821 | --- a/src/boot/efi/missing_efi.h | |||
2822 | +++ b/src/boot/efi/missing_efi.h | |||
2823 | @@ -398,22 +398,3 @@ typedef struct { | |||
2824 | 398 | void *StdErr; | 398 | void *StdErr; |
2825 | 399 | } EFI_SHELL_PARAMETERS_PROTOCOL; | 399 | } EFI_SHELL_PARAMETERS_PROTOCOL; |
2826 | 400 | #endif | 400 | #endif |
2827 | 401 | |||
2828 | 402 | #ifndef EFI_BOOT_MANAGER_POLICY_PROTOCOL_GUID | ||
2829 | 403 | #define EFI_BOOT_MANAGER_POLICY_PROTOCOL_GUID \ | ||
2830 | 404 | { 0xFEDF8E0C, 0xE147, 0x11E3, { 0x99, 0x03, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA } } | ||
2831 | 405 | #define EFI_BOOT_MANAGER_POLICY_CONSOLE_GUID \ | ||
2832 | 406 | { 0xCAB0E94C, 0xE15F, 0x11E3, { 0x91, 0x8D, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA } } | ||
2833 | 407 | |||
2834 | 408 | typedef struct EFI_BOOT_MANAGER_POLICY_PROTOCOL EFI_BOOT_MANAGER_POLICY_PROTOCOL; | ||
2835 | 409 | struct EFI_BOOT_MANAGER_POLICY_PROTOCOL { | ||
2836 | 410 | UINT64 Revision; | ||
2837 | 411 | EFI_STATUS (EFIAPI *ConnectDevicePath)( | ||
2838 | 412 | EFI_BOOT_MANAGER_POLICY_PROTOCOL *This, | ||
2839 | 413 | EFI_DEVICE_PATH *DevicePath, | ||
2840 | 414 | BOOLEAN Recursive); | ||
2841 | 415 | EFI_STATUS (EFIAPI *ConnectDeviceClass)( | ||
2842 | 416 | EFI_BOOT_MANAGER_POLICY_PROTOCOL *This, | ||
2843 | 417 | EFI_GUID *Class); | ||
2844 | 418 | }; | ||
2845 | 419 | #endif | ||
2846 | diff --git a/src/boot/efi/secure-boot.c b/src/boot/efi/secure-boot.c | |||
2847 | index 65457bf..6212868 100644 | |||
2848 | --- a/src/boot/efi/secure-boot.c | |||
2849 | +++ b/src/boot/efi/secure-boot.c | |||
2850 | @@ -6,7 +6,7 @@ | |||
2851 | 6 | #include "util.h" | 6 | #include "util.h" |
2852 | 7 | 7 | ||
2853 | 8 | bool secure_boot_enabled(void) { | 8 | bool secure_boot_enabled(void) { |
2855 | 9 | bool secure; | 9 | bool secure = false; /* avoid false maybe-uninitialized warning */ |
2856 | 10 | EFI_STATUS err; | 10 | EFI_STATUS err; |
2857 | 11 | 11 | ||
2858 | 12 | err = efivar_get_boolean_u8(EFI_GLOBAL_GUID, L"SecureBoot", &secure); | 12 | err = efivar_get_boolean_u8(EFI_GLOBAL_GUID, L"SecureBoot", &secure); |
2859 | diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c | |||
2860 | index f9aeeb4..51e483e 100644 | |||
2861 | --- a/src/boot/efi/util.c | |||
2862 | +++ b/src/boot/efi/util.c | |||
2863 | @@ -309,9 +309,11 @@ EFI_STATUS file_read(EFI_FILE *dir, const char16_t *name, UINTN off, UINTN size, | |||
2864 | 309 | UINTN extra = size % sizeof(char16_t) + sizeof(char16_t); | 309 | UINTN extra = size % sizeof(char16_t) + sizeof(char16_t); |
2865 | 310 | 310 | ||
2866 | 311 | buf = xmalloc(size + extra); | 311 | buf = xmalloc(size + extra); |
2870 | 312 | err = handle->Read(handle, &size, buf); | 312 | if (size > 0) { |
2871 | 313 | if (err != EFI_SUCCESS) | 313 | err = handle->Read(handle, &size, buf); |
2872 | 314 | return err; | 314 | if (err != EFI_SUCCESS) |
2873 | 315 | return err; | ||
2874 | 316 | } | ||
2875 | 315 | 317 | ||
2876 | 316 | /* Note that handle->Read() changes size to reflect the actually bytes read. */ | 318 | /* Note that handle->Read() changes size to reflect the actually bytes read. */ |
2877 | 317 | memset(buf + size, 0, extra); | 319 | memset(buf + size, 0, extra); |
2878 | diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c | |||
2879 | index f57a5d6..cc2d0e3 100644 | |||
2880 | --- a/src/busctl/busctl.c | |||
2881 | +++ b/src/busctl/busctl.c | |||
2882 | @@ -1022,10 +1022,11 @@ static int introspect(int argc, char **argv, void *userdata) { | |||
2883 | 1022 | 1022 | ||
2884 | 1023 | for (;;) { | 1023 | for (;;) { |
2885 | 1024 | Member *z; | 1024 | Member *z; |
2887 | 1025 | _cleanup_free_ char *buf = NULL; | 1025 | _cleanup_free_ char *buf = NULL, *signature = NULL; |
2888 | 1026 | _cleanup_fclose_ FILE *mf = NULL; | 1026 | _cleanup_fclose_ FILE *mf = NULL; |
2889 | 1027 | size_t sz = 0; | 1027 | size_t sz = 0; |
2891 | 1028 | const char *name; | 1028 | const char *name, *contents; |
2892 | 1029 | char type; | ||
2893 | 1029 | 1030 | ||
2894 | 1030 | r = sd_bus_message_enter_container(reply, 'e', "sv"); | 1031 | r = sd_bus_message_enter_container(reply, 'e', "sv"); |
2895 | 1031 | if (r < 0) | 1032 | if (r < 0) |
2896 | @@ -1042,6 +1043,21 @@ static int introspect(int argc, char **argv, void *userdata) { | |||
2897 | 1042 | if (r < 0) | 1043 | if (r < 0) |
2898 | 1043 | return bus_log_parse_error(r); | 1044 | return bus_log_parse_error(r); |
2899 | 1044 | 1045 | ||
2900 | 1046 | r = sd_bus_message_peek_type(reply, &type, &contents); | ||
2901 | 1047 | if (r <= 0) | ||
2902 | 1048 | return bus_log_parse_error(r == 0 ? EINVAL : r); | ||
2903 | 1049 | |||
2904 | 1050 | if (type == SD_BUS_TYPE_STRUCT_BEGIN) | ||
2905 | 1051 | signature = strjoin(CHAR_TO_STR(SD_BUS_TYPE_STRUCT_BEGIN), contents, CHAR_TO_STR(SD_BUS_TYPE_STRUCT_END)); | ||
2906 | 1052 | else if (type == SD_BUS_TYPE_DICT_ENTRY_BEGIN) | ||
2907 | 1053 | signature = strjoin(CHAR_TO_STR(SD_BUS_TYPE_DICT_ENTRY_BEGIN), contents, CHAR_TO_STR(SD_BUS_TYPE_DICT_ENTRY_END)); | ||
2908 | 1054 | else if (contents) | ||
2909 | 1055 | signature = strjoin(CHAR_TO_STR(type), contents); | ||
2910 | 1056 | else | ||
2911 | 1057 | signature = strdup(CHAR_TO_STR(type)); | ||
2912 | 1058 | if (!signature) | ||
2913 | 1059 | return log_oom(); | ||
2914 | 1060 | |||
2915 | 1045 | mf = open_memstream_unlocked(&buf, &sz); | 1061 | mf = open_memstream_unlocked(&buf, &sz); |
2916 | 1046 | if (!mf) | 1062 | if (!mf) |
2917 | 1047 | return log_oom(); | 1063 | return log_oom(); |
2918 | @@ -1055,6 +1071,7 @@ static int introspect(int argc, char **argv, void *userdata) { | |||
2919 | 1055 | z = set_get(members, &((Member) { | 1071 | z = set_get(members, &((Member) { |
2920 | 1056 | .type = "property", | 1072 | .type = "property", |
2921 | 1057 | .interface = m->interface, | 1073 | .interface = m->interface, |
2922 | 1074 | .signature = signature, | ||
2923 | 1058 | .name = (char*) name })); | 1075 | .name = (char*) name })); |
2924 | 1059 | if (z) | 1076 | if (z) |
2925 | 1060 | free_and_replace(z->value, buf); | 1077 | free_and_replace(z->value, buf); |
2926 | diff --git a/src/core/cgroup.c b/src/core/cgroup.c | |||
2927 | index 4c0a821..ba26066 100644 | |||
2928 | --- a/src/core/cgroup.c | |||
2929 | +++ b/src/core/cgroup.c | |||
2930 | @@ -2471,7 +2471,7 @@ static bool unit_has_mask_enables_realized( | |||
2931 | 2471 | ((u->cgroup_enabled_mask | enable_mask) & CGROUP_MASK_V2) == (u->cgroup_enabled_mask & CGROUP_MASK_V2); | 2471 | ((u->cgroup_enabled_mask | enable_mask) & CGROUP_MASK_V2) == (u->cgroup_enabled_mask & CGROUP_MASK_V2); |
2932 | 2472 | } | 2472 | } |
2933 | 2473 | 2473 | ||
2935 | 2474 | static void unit_add_to_cgroup_realize_queue(Unit *u) { | 2474 | void unit_add_to_cgroup_realize_queue(Unit *u) { |
2936 | 2475 | assert(u); | 2475 | assert(u); |
2937 | 2476 | 2476 | ||
2938 | 2477 | if (u->in_cgroup_realize_queue) | 2477 | if (u->in_cgroup_realize_queue) |
2939 | diff --git a/src/core/cgroup.h b/src/core/cgroup.h | |||
2940 | index 4413eea..49fbd4f 100644 | |||
2941 | --- a/src/core/cgroup.h | |||
2942 | +++ b/src/core/cgroup.h | |||
2943 | @@ -262,6 +262,7 @@ int unit_realize_cgroup(Unit *u); | |||
2944 | 262 | void unit_prune_cgroup(Unit *u); | 262 | void unit_prune_cgroup(Unit *u); |
2945 | 263 | int unit_watch_cgroup(Unit *u); | 263 | int unit_watch_cgroup(Unit *u); |
2946 | 264 | int unit_watch_cgroup_memory(Unit *u); | 264 | int unit_watch_cgroup_memory(Unit *u); |
2947 | 265 | void unit_add_to_cgroup_realize_queue(Unit *u); | ||
2948 | 265 | 266 | ||
2949 | 266 | void unit_release_cgroup(Unit *u); | 267 | void unit_release_cgroup(Unit *u); |
2950 | 267 | /* Releases the cgroup only if it is recursively empty. | 268 | /* Releases the cgroup only if it is recursively empty. |
2951 | diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c | |||
2952 | index 7d2ceb0..7b07bb8 100644 | |||
2953 | --- a/src/core/dbus-scope.c | |||
2954 | +++ b/src/core/dbus-scope.c | |||
2955 | @@ -5,6 +5,7 @@ | |||
2956 | 5 | #include "bus-get-properties.h" | 5 | #include "bus-get-properties.h" |
2957 | 6 | #include "dbus-cgroup.h" | 6 | #include "dbus-cgroup.h" |
2958 | 7 | #include "dbus-kill.h" | 7 | #include "dbus-kill.h" |
2959 | 8 | #include "dbus-manager.h" | ||
2960 | 8 | #include "dbus-scope.h" | 9 | #include "dbus-scope.h" |
2961 | 9 | #include "dbus-unit.h" | 10 | #include "dbus-unit.h" |
2962 | 10 | #include "dbus-util.h" | 11 | #include "dbus-util.h" |
2963 | @@ -39,6 +40,7 @@ int bus_scope_method_abandon(sd_bus_message *message, void *userdata, sd_bus_err | |||
2964 | 39 | } | 40 | } |
2965 | 40 | 41 | ||
2966 | 41 | static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, scope_result, ScopeResult); | 42 | static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, scope_result, ScopeResult); |
2967 | 43 | static BUS_DEFINE_SET_TRANSIENT_PARSE(oom_policy, OOMPolicy, oom_policy_from_string); | ||
2968 | 42 | 44 | ||
2969 | 43 | const sd_bus_vtable bus_scope_vtable[] = { | 45 | const sd_bus_vtable bus_scope_vtable[] = { |
2970 | 44 | SD_BUS_VTABLE_START(0), | 46 | SD_BUS_VTABLE_START(0), |
2971 | @@ -47,6 +49,7 @@ const sd_bus_vtable bus_scope_vtable[] = { | |||
2972 | 47 | SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Scope, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), | 49 | SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Scope, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), |
2973 | 48 | SD_BUS_PROPERTY("RuntimeMaxUSec", "t", bus_property_get_usec, offsetof(Scope, runtime_max_usec), SD_BUS_VTABLE_PROPERTY_CONST), | 50 | SD_BUS_PROPERTY("RuntimeMaxUSec", "t", bus_property_get_usec, offsetof(Scope, runtime_max_usec), SD_BUS_VTABLE_PROPERTY_CONST), |
2974 | 49 | SD_BUS_PROPERTY("RuntimeRandomizedExtraUSec", "t", bus_property_get_usec, offsetof(Scope, runtime_rand_extra_usec), SD_BUS_VTABLE_PROPERTY_CONST), | 51 | SD_BUS_PROPERTY("RuntimeRandomizedExtraUSec", "t", bus_property_get_usec, offsetof(Scope, runtime_rand_extra_usec), SD_BUS_VTABLE_PROPERTY_CONST), |
2975 | 52 | SD_BUS_PROPERTY("OOMPolicy", "s", bus_property_get_oom_policy, offsetof(Scope, oom_policy), SD_BUS_VTABLE_PROPERTY_CONST), | ||
2976 | 50 | SD_BUS_SIGNAL("RequestStop", NULL, 0), | 53 | SD_BUS_SIGNAL("RequestStop", NULL, 0), |
2977 | 51 | SD_BUS_METHOD("Abandon", NULL, NULL, bus_scope_method_abandon, SD_BUS_VTABLE_UNPRIVILEGED), | 54 | SD_BUS_METHOD("Abandon", NULL, NULL, bus_scope_method_abandon, SD_BUS_VTABLE_UNPRIVILEGED), |
2978 | 52 | SD_BUS_VTABLE_END | 55 | SD_BUS_VTABLE_END |
2979 | @@ -77,6 +80,9 @@ static int bus_scope_set_transient_property( | |||
2980 | 77 | if (streq(name, "RuntimeRandomizedExtraUSec")) | 80 | if (streq(name, "RuntimeRandomizedExtraUSec")) |
2981 | 78 | return bus_set_transient_usec(u, name, &s->runtime_rand_extra_usec, message, flags, error); | 81 | return bus_set_transient_usec(u, name, &s->runtime_rand_extra_usec, message, flags, error); |
2982 | 79 | 82 | ||
2983 | 83 | if (streq(name, "OOMPolicy")) | ||
2984 | 84 | return bus_set_transient_oom_policy(u, name, &s->oom_policy, message, flags, error); | ||
2985 | 85 | |||
2986 | 80 | if (streq(name, "PIDs")) { | 86 | if (streq(name, "PIDs")) { |
2987 | 81 | _cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL; | 87 | _cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL; |
2988 | 82 | unsigned n = 0; | 88 | unsigned n = 0; |
2989 | diff --git a/src/core/execute.c b/src/core/execute.c | |||
2990 | index 6c3fbc2..13222dd 100644 | |||
2991 | --- a/src/core/execute.c | |||
2992 | +++ b/src/core/execute.c | |||
2993 | @@ -5479,6 +5479,23 @@ int exec_context_destroy_credentials(const ExecContext *c, const char *runtime_p | |||
2994 | 5479 | return 0; | 5479 | return 0; |
2995 | 5480 | } | 5480 | } |
2996 | 5481 | 5481 | ||
2997 | 5482 | int exec_context_destroy_mount_ns_dir(Unit *u) { | ||
2998 | 5483 | _cleanup_free_ char *p = NULL; | ||
2999 | 5484 | |||
3000 | 5485 | if (!u || !MANAGER_IS_SYSTEM(u->manager)) | ||
3001 | 5486 | return 0; | ||
3002 | 5487 | |||
3003 | 5488 | p = path_join("/run/systemd/propagate/", u->id); | ||
3004 | 5489 | if (!p) | ||
3005 | 5490 | return -ENOMEM; | ||
3006 | 5491 | |||
3007 | 5492 | /* This is only filled transiently (see mount_in_namespace()), should be empty or even non-existent*/ | ||
3008 | 5493 | if (rmdir(p) < 0 && errno != ENOENT) | ||
3009 | 5494 | log_unit_debug_errno(u, errno, "Unable to remove propagation dir '%s', ignoring: %m", p); | ||
3010 | 5495 | |||
3011 | 5496 | return 0; | ||
3012 | 5497 | } | ||
3013 | 5498 | |||
3014 | 5482 | static void exec_command_done(ExecCommand *c) { | 5499 | static void exec_command_done(ExecCommand *c) { |
3015 | 5483 | assert(c); | 5500 | assert(c); |
3016 | 5484 | 5501 | ||
3017 | diff --git a/src/core/execute.h b/src/core/execute.h | |||
3018 | index a2cf228..4c54422 100644 | |||
3019 | --- a/src/core/execute.h | |||
3020 | +++ b/src/core/execute.h | |||
3021 | @@ -453,6 +453,7 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix); | |||
3022 | 453 | 453 | ||
3023 | 454 | int exec_context_destroy_runtime_directory(const ExecContext *c, const char *runtime_root); | 454 | int exec_context_destroy_runtime_directory(const ExecContext *c, const char *runtime_root); |
3024 | 455 | int exec_context_destroy_credentials(const ExecContext *c, const char *runtime_root, const char *unit); | 455 | int exec_context_destroy_credentials(const ExecContext *c, const char *runtime_root, const char *unit); |
3025 | 456 | int exec_context_destroy_mount_ns_dir(Unit *u); | ||
3026 | 456 | 457 | ||
3027 | 457 | const char* exec_context_fdname(const ExecContext *c, int fd_index); | 458 | const char* exec_context_fdname(const ExecContext *c, int fd_index); |
3028 | 458 | 459 | ||
3029 | diff --git a/src/core/import-creds.c b/src/core/import-creds.c | |||
3030 | index 4685e43..dab7d36 100644 | |||
3031 | --- a/src/core/import-creds.c | |||
3032 | +++ b/src/core/import-creds.c | |||
3033 | @@ -19,6 +19,7 @@ | |||
3034 | 19 | #include "proc-cmdline.h" | 19 | #include "proc-cmdline.h" |
3035 | 20 | #include "recurse-dir.h" | 20 | #include "recurse-dir.h" |
3036 | 21 | #include "strv.h" | 21 | #include "strv.h" |
3037 | 22 | #include "virt.h" | ||
3038 | 22 | 23 | ||
3039 | 23 | /* This imports credentials passed in from environments higher up (VM manager, boot loader, …) and rearranges | 24 | /* This imports credentials passed in from environments higher up (VM manager, boot loader, …) and rearranges |
3040 | 24 | * them so that later code can access them using our regular credential protocol | 25 | * them so that later code can access them using our regular credential protocol |
3041 | @@ -369,6 +370,9 @@ static int import_credentials_qemu(ImportCredentialContext *c) { | |||
3042 | 369 | 370 | ||
3043 | 370 | assert(c); | 371 | assert(c); |
3044 | 371 | 372 | ||
3045 | 373 | if (detect_container() > 0) /* don't access /sys/ in a container */ | ||
3046 | 374 | return 0; | ||
3047 | 375 | |||
3048 | 372 | source_dir_fd = open(QEMU_FWCFG_PATH, O_RDONLY|O_DIRECTORY|O_CLOEXEC); | 376 | source_dir_fd = open(QEMU_FWCFG_PATH, O_RDONLY|O_DIRECTORY|O_CLOEXEC); |
3049 | 373 | if (source_dir_fd < 0) { | 377 | if (source_dir_fd < 0) { |
3050 | 374 | if (errno == ENOENT) { | 378 | if (errno == ENOENT) { |
3051 | @@ -560,6 +564,9 @@ static int import_credentials_smbios(ImportCredentialContext *c) { | |||
3052 | 560 | 564 | ||
3053 | 561 | /* Parses DMI OEM strings fields (SMBIOS type 11), as settable with qemu's -smbios type=11,value=… switch. */ | 565 | /* Parses DMI OEM strings fields (SMBIOS type 11), as settable with qemu's -smbios type=11,value=… switch. */ |
3054 | 562 | 566 | ||
3055 | 567 | if (detect_container() > 0) /* don't access /sys/ in a container */ | ||
3056 | 568 | return 0; | ||
3057 | 569 | |||
3058 | 563 | for (unsigned i = 0;; i++) { | 570 | for (unsigned i = 0;; i++) { |
3059 | 564 | struct dmi_field_header { | 571 | struct dmi_field_header { |
3060 | 565 | uint8_t type; | 572 | uint8_t type; |
3061 | diff --git a/src/core/load-fragment-gperf.gperf.in b/src/core/load-fragment-gperf.gperf.in | |||
3062 | index 7675b7b..81a5971 100644 | |||
3063 | --- a/src/core/load-fragment-gperf.gperf.in | |||
3064 | +++ b/src/core/load-fragment-gperf.gperf.in | |||
3065 | @@ -555,6 +555,7 @@ Path.TriggerLimitBurst, config_parse_unsigned, | |||
3066 | 555 | Scope.RuntimeMaxSec, config_parse_sec, 0, offsetof(Scope, runtime_max_usec) | 555 | Scope.RuntimeMaxSec, config_parse_sec, 0, offsetof(Scope, runtime_max_usec) |
3067 | 556 | Scope.RuntimeRandomizedExtraSec, config_parse_sec, 0, offsetof(Scope, runtime_rand_extra_usec) | 556 | Scope.RuntimeRandomizedExtraSec, config_parse_sec, 0, offsetof(Scope, runtime_rand_extra_usec) |
3068 | 557 | Scope.TimeoutStopSec, config_parse_sec, 0, offsetof(Scope, timeout_stop_usec) | 557 | Scope.TimeoutStopSec, config_parse_sec, 0, offsetof(Scope, timeout_stop_usec) |
3069 | 558 | Scope.OOMPolicy, config_parse_oom_policy, 0, offsetof(Scope, oom_policy) | ||
3070 | 558 | {# The [Install] section is ignored here #} | 559 | {# The [Install] section is ignored here #} |
3071 | 559 | Install.Alias, NULL, 0, 0 | 560 | Install.Alias, NULL, 0, 0 |
3072 | 560 | Install.WantedBy, NULL, 0, 0 | 561 | Install.WantedBy, NULL, 0, 0 |
3073 | diff --git a/src/core/mount.c b/src/core/mount.c | |||
3074 | index dea7cd9..283426b 100644 | |||
3075 | --- a/src/core/mount.c | |||
3076 | +++ b/src/core/mount.c | |||
3077 | @@ -13,6 +13,7 @@ | |||
3078 | 13 | #include "device.h" | 13 | #include "device.h" |
3079 | 14 | #include "exit-status.h" | 14 | #include "exit-status.h" |
3080 | 15 | #include "format-util.h" | 15 | #include "format-util.h" |
3081 | 16 | #include "fs-util.h" | ||
3082 | 16 | #include "fstab-util.h" | 17 | #include "fstab-util.h" |
3083 | 17 | #include "libmount-util.h" | 18 | #include "libmount-util.h" |
3084 | 18 | #include "log.h" | 19 | #include "log.h" |
3085 | @@ -26,6 +27,7 @@ | |||
3086 | 26 | #include "process-util.h" | 27 | #include "process-util.h" |
3087 | 27 | #include "serialize.h" | 28 | #include "serialize.h" |
3088 | 28 | #include "special.h" | 29 | #include "special.h" |
3089 | 30 | #include "stat-util.h" | ||
3090 | 29 | #include "string-table.h" | 31 | #include "string-table.h" |
3091 | 30 | #include "string-util.h" | 32 | #include "string-util.h" |
3092 | 31 | #include "strv.h" | 33 | #include "strv.h" |
3093 | @@ -1073,6 +1075,7 @@ fail: | |||
3094 | 1073 | static void mount_enter_mounting(Mount *m) { | 1075 | static void mount_enter_mounting(Mount *m) { |
3095 | 1074 | int r; | 1076 | int r; |
3096 | 1075 | MountParameters *p; | 1077 | MountParameters *p; |
3097 | 1078 | bool source_is_dir = true; | ||
3098 | 1076 | 1079 | ||
3099 | 1077 | assert(m); | 1080 | assert(m); |
3100 | 1078 | 1081 | ||
3101 | @@ -1080,16 +1083,28 @@ static void mount_enter_mounting(Mount *m) { | |||
3102 | 1080 | if (r < 0) | 1083 | if (r < 0) |
3103 | 1081 | goto fail; | 1084 | goto fail; |
3104 | 1082 | 1085 | ||
3106 | 1083 | (void) mkdir_p_label(m->where, m->directory_mode); | 1086 | p = get_mount_parameters_fragment(m); |
3107 | 1087 | if (p && mount_is_bind(p)) { | ||
3108 | 1088 | r = is_dir(p->what, /* follow = */ true); | ||
3109 | 1089 | if (r < 0 && r != -ENOENT) | ||
3110 | 1090 | log_unit_info_errno(UNIT(m), r, "Failed to determine type of bind mount source '%s', ignoring: %m", p->what); | ||
3111 | 1091 | else if (r == 0) | ||
3112 | 1092 | source_is_dir = false; | ||
3113 | 1093 | } | ||
3114 | 1084 | 1094 | ||
3116 | 1085 | unit_warn_if_dir_nonempty(UNIT(m), m->where); | 1095 | if (source_is_dir) |
3117 | 1096 | (void) mkdir_p_label(m->where, m->directory_mode); | ||
3118 | 1097 | else | ||
3119 | 1098 | (void) touch_file(m->where, /* parents = */ true, USEC_INFINITY, UID_INVALID, GID_INVALID, MODE_INVALID); | ||
3120 | 1099 | |||
3121 | 1100 | if (source_is_dir) | ||
3122 | 1101 | unit_warn_if_dir_nonempty(UNIT(m), m->where); | ||
3123 | 1086 | unit_warn_leftover_processes(UNIT(m), unit_log_leftover_process_start); | 1102 | unit_warn_leftover_processes(UNIT(m), unit_log_leftover_process_start); |
3124 | 1087 | 1103 | ||
3125 | 1088 | m->control_command_id = MOUNT_EXEC_MOUNT; | 1104 | m->control_command_id = MOUNT_EXEC_MOUNT; |
3126 | 1089 | m->control_command = m->exec_command + MOUNT_EXEC_MOUNT; | 1105 | m->control_command = m->exec_command + MOUNT_EXEC_MOUNT; |
3127 | 1090 | 1106 | ||
3128 | 1091 | /* Create the source directory for bind-mounts if needed */ | 1107 | /* Create the source directory for bind-mounts if needed */ |
3129 | 1092 | p = get_mount_parameters_fragment(m); | ||
3130 | 1093 | if (p && mount_is_bind(p)) { | 1108 | if (p && mount_is_bind(p)) { |
3131 | 1094 | r = mkdir_p_label(p->what, m->directory_mode); | 1109 | r = mkdir_p_label(p->what, m->directory_mode); |
3132 | 1095 | /* mkdir_p_label() can return -EEXIST if the target path exists and is not a directory - which is | 1110 | /* mkdir_p_label() can return -EEXIST if the target path exists and is not a directory - which is |
3133 | diff --git a/src/core/scope.c b/src/core/scope.c | |||
3134 | index 54a6cc6..914d1cc 100644 | |||
3135 | --- a/src/core/scope.c | |||
3136 | +++ b/src/core/scope.c | |||
3137 | @@ -43,6 +43,7 @@ static void scope_init(Unit *u) { | |||
3138 | 43 | s->timeout_stop_usec = u->manager->default_timeout_stop_usec; | 43 | s->timeout_stop_usec = u->manager->default_timeout_stop_usec; |
3139 | 44 | u->ignore_on_isolate = true; | 44 | u->ignore_on_isolate = true; |
3140 | 45 | s->user = s->group = NULL; | 45 | s->user = s->group = NULL; |
3141 | 46 | s->oom_policy = _OOM_POLICY_INVALID; | ||
3142 | 46 | } | 47 | } |
3143 | 47 | 48 | ||
3144 | 48 | static void scope_done(Unit *u) { | 49 | static void scope_done(Unit *u) { |
3145 | @@ -194,6 +195,11 @@ static int scope_add_extras(Scope *s) { | |||
3146 | 194 | if (r < 0) | 195 | if (r < 0) |
3147 | 195 | return r; | 196 | return r; |
3148 | 196 | 197 | ||
3149 | 198 | if (s->oom_policy < 0) | ||
3150 | 199 | s->oom_policy = s->cgroup_context.delegate ? OOM_CONTINUE : UNIT(s)->manager->default_oom_policy; | ||
3151 | 200 | |||
3152 | 201 | s->cgroup_context.memory_oom_group = s->oom_policy == OOM_KILL; | ||
3153 | 202 | |||
3154 | 197 | return scope_add_default_dependencies(s); | 203 | return scope_add_default_dependencies(s); |
3155 | 198 | } | 204 | } |
3156 | 199 | 205 | ||
3157 | @@ -286,11 +292,13 @@ static void scope_dump(Unit *u, FILE *f, const char *prefix) { | |||
3158 | 286 | "%sScope State: %s\n" | 292 | "%sScope State: %s\n" |
3159 | 287 | "%sResult: %s\n" | 293 | "%sResult: %s\n" |
3160 | 288 | "%sRuntimeMaxSec: %s\n" | 294 | "%sRuntimeMaxSec: %s\n" |
3162 | 289 | "%sRuntimeRandomizedExtraSec: %s\n", | 295 | "%sRuntimeRandomizedExtraSec: %s\n" |
3163 | 296 | "%sOOMPolicy: %s\n", | ||
3164 | 290 | prefix, scope_state_to_string(s->state), | 297 | prefix, scope_state_to_string(s->state), |
3165 | 291 | prefix, scope_result_to_string(s->result), | 298 | prefix, scope_result_to_string(s->result), |
3166 | 292 | prefix, FORMAT_TIMESPAN(s->runtime_max_usec, USEC_PER_SEC), | 299 | prefix, FORMAT_TIMESPAN(s->runtime_max_usec, USEC_PER_SEC), |
3168 | 293 | prefix, FORMAT_TIMESPAN(s->runtime_rand_extra_usec, USEC_PER_SEC)); | 300 | prefix, FORMAT_TIMESPAN(s->runtime_rand_extra_usec, USEC_PER_SEC), |
3169 | 301 | prefix, oom_policy_to_string(s->oom_policy)); | ||
3170 | 294 | 302 | ||
3171 | 295 | cgroup_context_dump(UNIT(s), f, prefix); | 303 | cgroup_context_dump(UNIT(s), f, prefix); |
3172 | 296 | kill_context_dump(&s->kill_context, f, prefix); | 304 | kill_context_dump(&s->kill_context, f, prefix); |
3173 | @@ -635,11 +643,16 @@ static void scope_notify_cgroup_oom_event(Unit *u, bool managed_oom) { | |||
3174 | 635 | else | 643 | else |
3175 | 636 | log_unit_debug(u, "Process of control group was killed by the OOM killer."); | 644 | log_unit_debug(u, "Process of control group was killed by the OOM killer."); |
3176 | 637 | 645 | ||
3178 | 638 | /* This will probably need to be modified when scope units get an oom-policy */ | 646 | if (s->oom_policy == OOM_CONTINUE) |
3179 | 647 | return; | ||
3180 | 648 | |||
3181 | 639 | switch (s->state) { | 649 | switch (s->state) { |
3182 | 640 | 650 | ||
3183 | 641 | case SCOPE_START_CHOWN: | 651 | case SCOPE_START_CHOWN: |
3184 | 642 | case SCOPE_RUNNING: | 652 | case SCOPE_RUNNING: |
3185 | 653 | scope_enter_signal(s, SCOPE_STOP_SIGTERM, SCOPE_FAILURE_OOM_KILL); | ||
3186 | 654 | break; | ||
3187 | 655 | |||
3188 | 643 | case SCOPE_STOP_SIGTERM: | 656 | case SCOPE_STOP_SIGTERM: |
3189 | 644 | scope_enter_signal(s, SCOPE_STOP_SIGKILL, SCOPE_FAILURE_OOM_KILL); | 657 | scope_enter_signal(s, SCOPE_STOP_SIGKILL, SCOPE_FAILURE_OOM_KILL); |
3190 | 645 | break; | 658 | break; |
3191 | @@ -776,6 +789,10 @@ static void scope_enumerate_perpetual(Manager *m) { | |||
3192 | 776 | 789 | ||
3193 | 777 | unit_add_to_load_queue(u); | 790 | unit_add_to_load_queue(u); |
3194 | 778 | unit_add_to_dbus_queue(u); | 791 | unit_add_to_dbus_queue(u); |
3195 | 792 | /* Enqueue an explicit cgroup realization here. Unlike other cgroups this one already exists and is | ||
3196 | 793 | * populated (by us, after all!) already, even when we are not in a reload cycle. Hence we cannot | ||
3197 | 794 | * apply the settings at creation time anymore, but let's at least apply them asynchronously. */ | ||
3198 | 795 | unit_add_to_cgroup_realize_queue(u); | ||
3199 | 779 | } | 796 | } |
3200 | 780 | 797 | ||
3201 | 781 | static const char* const scope_result_table[_SCOPE_RESULT_MAX] = { | 798 | static const char* const scope_result_table[_SCOPE_RESULT_MAX] = { |
3202 | diff --git a/src/core/scope.h b/src/core/scope.h | |||
3203 | index 6a228f1..c9574a3 100644 | |||
3204 | --- a/src/core/scope.h | |||
3205 | +++ b/src/core/scope.h | |||
3206 | @@ -38,6 +38,8 @@ struct Scope { | |||
3207 | 38 | 38 | ||
3208 | 39 | char *user; | 39 | char *user; |
3209 | 40 | char *group; | 40 | char *group; |
3210 | 41 | |||
3211 | 42 | OOMPolicy oom_policy; | ||
3212 | 41 | }; | 43 | }; |
3213 | 42 | 44 | ||
3214 | 43 | extern const UnitVTable scope_vtable; | 45 | extern const UnitVTable scope_vtable; |
3215 | diff --git a/src/core/slice.c b/src/core/slice.c | |||
3216 | index c453aa0..4824a30 100644 | |||
3217 | --- a/src/core/slice.c | |||
3218 | +++ b/src/core/slice.c | |||
3219 | @@ -381,6 +381,9 @@ static int slice_freezer_action(Unit *s, FreezerAction action) { | |||
3220 | 381 | } | 381 | } |
3221 | 382 | 382 | ||
3222 | 383 | UNIT_FOREACH_DEPENDENCY(member, s, UNIT_ATOM_SLICE_OF) { | 383 | UNIT_FOREACH_DEPENDENCY(member, s, UNIT_ATOM_SLICE_OF) { |
3223 | 384 | if (!member->cgroup_realized) | ||
3224 | 385 | continue; | ||
3225 | 386 | |||
3226 | 384 | if (action == FREEZER_FREEZE) | 387 | if (action == FREEZER_FREEZE) |
3227 | 385 | r = UNIT_VTABLE(member)->freeze(member); | 388 | r = UNIT_VTABLE(member)->freeze(member); |
3228 | 386 | else | 389 | else |
3229 | diff --git a/src/core/swap.c b/src/core/swap.c | |||
3230 | index 2196793..5c83c47 100644 | |||
3231 | --- a/src/core/swap.c | |||
3232 | +++ b/src/core/swap.c | |||
3233 | @@ -827,7 +827,7 @@ static void swap_enter_activating(Swap *s) { | |||
3234 | 827 | } | 827 | } |
3235 | 828 | } | 828 | } |
3236 | 829 | 829 | ||
3238 | 830 | r = exec_command_set(s->control_command, "/sbin/swapon", NULL); | 830 | r = exec_command_set(s->control_command, "/sbin/swapon", "--fixpgsz", NULL); |
3239 | 831 | if (r < 0) | 831 | if (r < 0) |
3240 | 832 | goto fail; | 832 | goto fail; |
3241 | 833 | 833 | ||
3242 | diff --git a/src/core/unit.c b/src/core/unit.c | |||
3243 | index bed5544..3ac56c1 100644 | |||
3244 | --- a/src/core/unit.c | |||
3245 | +++ b/src/core/unit.c | |||
3246 | @@ -5732,6 +5732,7 @@ void unit_destroy_runtime_data(Unit *u, const ExecContext *context) { | |||
3247 | 5732 | exec_context_destroy_runtime_directory(context, u->manager->prefix[EXEC_DIRECTORY_RUNTIME]); | 5732 | exec_context_destroy_runtime_directory(context, u->manager->prefix[EXEC_DIRECTORY_RUNTIME]); |
3248 | 5733 | 5733 | ||
3249 | 5734 | exec_context_destroy_credentials(context, u->manager->prefix[EXEC_DIRECTORY_RUNTIME], u->id); | 5734 | exec_context_destroy_credentials(context, u->manager->prefix[EXEC_DIRECTORY_RUNTIME], u->id); |
3250 | 5735 | exec_context_destroy_mount_ns_dir(u); | ||
3251 | 5735 | } | 5736 | } |
3252 | 5736 | 5737 | ||
3253 | 5737 | int unit_clean(Unit *u, ExecCleanMask mask) { | 5738 | int unit_clean(Unit *u, ExecCleanMask mask) { |
3254 | diff --git a/src/cryptsetup/cryptsetup-fido2.c b/src/cryptsetup/cryptsetup-fido2.c | |||
3255 | index 74053b8..a3bdedb 100644 | |||
3256 | --- a/src/cryptsetup/cryptsetup-fido2.c | |||
3257 | +++ b/src/cryptsetup/cryptsetup-fido2.c | |||
3258 | @@ -38,6 +38,10 @@ int acquire_fido2_key( | |||
3259 | 38 | size_t salt_size; | 38 | size_t salt_size; |
3260 | 39 | int r; | 39 | int r; |
3261 | 40 | 40 | ||
3262 | 41 | if ((required & (FIDO2ENROLL_PIN | FIDO2ENROLL_UP | FIDO2ENROLL_UV)) && headless) | ||
3263 | 42 | return log_error_errno(SYNTHETIC_ERRNO(ENOPKG), | ||
3264 | 43 | "Local verification is required to unlock this volume, but the 'headless' parameter was set."); | ||
3265 | 44 | |||
3266 | 41 | ask_password_flags |= ASK_PASSWORD_PUSH_CACHE | ASK_PASSWORD_ACCEPT_CACHED; | 45 | ask_password_flags |= ASK_PASSWORD_PUSH_CACHE | ASK_PASSWORD_ACCEPT_CACHED; |
3267 | 42 | 46 | ||
3268 | 43 | assert(cid); | 47 | assert(cid); |
3269 | @@ -76,28 +80,6 @@ int acquire_fido2_key( | |||
3270 | 76 | } | 80 | } |
3271 | 77 | 81 | ||
3272 | 78 | for (;;) { | 82 | for (;;) { |
3273 | 79 | if (!FLAGS_SET(required, FIDO2ENROLL_PIN) || pins) { | ||
3274 | 80 | r = fido2_use_hmac_hash( | ||
3275 | 81 | device, | ||
3276 | 82 | rp_id ?: "io.systemd.cryptsetup", | ||
3277 | 83 | salt, salt_size, | ||
3278 | 84 | cid, cid_size, | ||
3279 | 85 | pins, | ||
3280 | 86 | required, | ||
3281 | 87 | ret_decrypted_key, | ||
3282 | 88 | ret_decrypted_key_size); | ||
3283 | 89 | if (!IN_SET(r, | ||
3284 | 90 | -ENOANO, /* needs pin */ | ||
3285 | 91 | -ENOLCK)) /* pin incorrect */ | ||
3286 | 92 | return r; | ||
3287 | 93 | |||
3288 | 94 | device_exists = true; /* that a PIN is needed/wasn't correct means that we managed to | ||
3289 | 95 | * talk to a device */ | ||
3290 | 96 | } | ||
3291 | 97 | |||
3292 | 98 | if (headless) | ||
3293 | 99 | return log_error_errno(SYNTHETIC_ERRNO(ENOPKG), "PIN querying disabled via 'headless' option. Use the '$PIN' environment variable."); | ||
3294 | 100 | |||
3295 | 101 | if (!device_exists) { | 83 | if (!device_exists) { |
3296 | 102 | /* Before we inquire for the PIN we'll need, if we never talked to the device, check | 84 | /* Before we inquire for the PIN we'll need, if we never talked to the device, check |
3297 | 103 | * if the device actually is plugged in. Otherwise we'll ask for the PIN already when | 85 | * if the device actually is plugged in. Otherwise we'll ask for the PIN already when |
3298 | @@ -112,6 +94,30 @@ int acquire_fido2_key( | |||
3299 | 112 | device_exists = true; /* now we know for sure, a device exists, no need to ask again */ | 94 | device_exists = true; /* now we know for sure, a device exists, no need to ask again */ |
3300 | 113 | } | 95 | } |
3301 | 114 | 96 | ||
3302 | 97 | /* Always make an attempt before asking for PIN. | ||
3303 | 98 | * fido2_use_hmac_hash() will perform a pre-flight check for whether the credential for | ||
3304 | 99 | * can be found on one of the connected devices. This way, we can avoid prompting the user | ||
3305 | 100 | * for a PIN when we are sure that no device can be used. */ | ||
3306 | 101 | r = fido2_use_hmac_hash( | ||
3307 | 102 | device, | ||
3308 | 103 | rp_id ?: "io.systemd.cryptsetup", | ||
3309 | 104 | salt, salt_size, | ||
3310 | 105 | cid, cid_size, | ||
3311 | 106 | pins, | ||
3312 | 107 | required, | ||
3313 | 108 | ret_decrypted_key, | ||
3314 | 109 | ret_decrypted_key_size); | ||
3315 | 110 | if (!IN_SET(r, | ||
3316 | 111 | -ENOANO, /* needs pin */ | ||
3317 | 112 | -ENOLCK)) /* pin incorrect */ | ||
3318 | 113 | return r; | ||
3319 | 114 | |||
3320 | 115 | device_exists = true; /* that a PIN is needed/wasn't correct means that we managed to | ||
3321 | 116 | * talk to a device */ | ||
3322 | 117 | |||
3323 | 118 | if (headless) | ||
3324 | 119 | return log_error_errno(SYNTHETIC_ERRNO(ENOPKG), "PIN querying disabled via 'headless' option. Use the '$PIN' environment variable."); | ||
3325 | 120 | |||
3326 | 115 | pins = strv_free_erase(pins); | 121 | pins = strv_free_erase(pins); |
3327 | 116 | r = ask_password_auto("Please enter security token PIN:", "drive-harddisk", NULL, "fido2-pin", "cryptsetup.fido2-pin", until, ask_password_flags, &pins); | 122 | r = ask_password_auto("Please enter security token PIN:", "drive-harddisk", NULL, "fido2-pin", "cryptsetup.fido2-pin", until, ask_password_flags, &pins); |
3328 | 117 | if (r < 0) | 123 | if (r < 0) |
3329 | @@ -121,35 +127,38 @@ int acquire_fido2_key( | |||
3330 | 121 | } | 127 | } |
3331 | 122 | } | 128 | } |
3332 | 123 | 129 | ||
3334 | 124 | int find_fido2_auto_data( | 130 | int acquire_fido2_key_auto( |
3335 | 125 | struct crypt_device *cd, | 131 | struct crypt_device *cd, |
3348 | 126 | char **ret_rp_id, | 132 | const char *name, |
3349 | 127 | void **ret_salt, | 133 | const char *friendly_name, |
3350 | 128 | size_t *ret_salt_size, | 134 | const char *fido2_device, |
3351 | 129 | void **ret_cid, | 135 | const char *key_file, |
3352 | 130 | size_t *ret_cid_size, | 136 | size_t key_file_size, |
3353 | 131 | int *ret_keyslot, | 137 | uint64_t key_file_offset, |
3354 | 132 | Fido2EnrollFlags *ret_required) { | 138 | usec_t until, |
3355 | 133 | 139 | bool headless, | |
3356 | 134 | _cleanup_free_ void *cid = NULL, *salt = NULL; | 140 | void **ret_decrypted_key, |
3357 | 135 | size_t cid_size = 0, salt_size = 0; | 141 | size_t *ret_decrypted_key_size, |
3358 | 136 | _cleanup_free_ char *rp = NULL; | 142 | AskPasswordFlags ask_password_flags) { |
3359 | 137 | int r, keyslot = -1; | 143 | |
3360 | 144 | _cleanup_free_ void *cid = NULL; | ||
3361 | 145 | size_t cid_size = 0; | ||
3362 | 146 | int r, ret = -ENOENT; | ||
3363 | 138 | Fido2EnrollFlags required = 0; | 147 | Fido2EnrollFlags required = 0; |
3364 | 139 | 148 | ||
3365 | 140 | assert(cd); | 149 | assert(cd); |
3372 | 141 | assert(ret_salt); | 150 | assert(name); |
3373 | 142 | assert(ret_salt_size); | 151 | assert(ret_decrypted_key); |
3374 | 143 | assert(ret_cid); | 152 | assert(ret_decrypted_key_size); |
3369 | 144 | assert(ret_cid_size); | ||
3370 | 145 | assert(ret_keyslot); | ||
3371 | 146 | assert(ret_required); | ||
3375 | 147 | 153 | ||
3376 | 148 | /* Loads FIDO2 metadata from LUKS2 JSON token headers. */ | 154 | /* Loads FIDO2 metadata from LUKS2 JSON token headers. */ |
3377 | 149 | 155 | ||
3378 | 150 | for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token ++) { | 156 | for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token ++) { |
3379 | 151 | _cleanup_(json_variant_unrefp) JsonVariant *v = NULL; | 157 | _cleanup_(json_variant_unrefp) JsonVariant *v = NULL; |
3380 | 152 | JsonVariant *w; | 158 | JsonVariant *w; |
3381 | 159 | _cleanup_free_ void *salt = NULL; | ||
3382 | 160 | _cleanup_free_ char *rp = NULL; | ||
3383 | 161 | size_t salt_size = 0; | ||
3384 | 153 | int ks; | 162 | int ks; |
3385 | 154 | 163 | ||
3386 | 155 | r = cryptsetup_get_token_as_json(cd, token, "systemd-fido2", &v); | 164 | r = cryptsetup_get_token_as_json(cd, token, "systemd-fido2", &v); |
3387 | @@ -166,13 +175,6 @@ int find_fido2_auto_data( | |||
3388 | 166 | continue; | 175 | continue; |
3389 | 167 | } | 176 | } |
3390 | 168 | 177 | ||
3391 | 169 | if (cid) | ||
3392 | 170 | return log_error_errno(SYNTHETIC_ERRNO(ENOTUNIQ), | ||
3393 | 171 | "Multiple FIDO2 tokens enrolled, cannot automatically determine token."); | ||
3394 | 172 | |||
3395 | 173 | assert(keyslot < 0); | ||
3396 | 174 | keyslot = ks; | ||
3397 | 175 | |||
3398 | 176 | w = json_variant_by_key(v, "fido2-credential"); | 178 | w = json_variant_by_key(v, "fido2-credential"); |
3399 | 177 | if (!w || !json_variant_is_string(w)) | 179 | if (!w || !json_variant_is_string(w)) |
3400 | 178 | return log_error_errno(SYNTHETIC_ERRNO(EINVAL), | 180 | return log_error_errno(SYNTHETIC_ERRNO(EINVAL), |
3401 | @@ -243,20 +245,33 @@ int find_fido2_auto_data( | |||
3402 | 243 | SET_FLAG(required, FIDO2ENROLL_UV, json_variant_boolean(w)); | 245 | SET_FLAG(required, FIDO2ENROLL_UV, json_variant_boolean(w)); |
3403 | 244 | } else | 246 | } else |
3404 | 245 | required |= FIDO2ENROLL_UV_OMIT; /* compat with 248 */ | 247 | required |= FIDO2ENROLL_UV_OMIT; /* compat with 248 */ |
3405 | 248 | |||
3406 | 249 | ret = acquire_fido2_key( | ||
3407 | 250 | name, | ||
3408 | 251 | friendly_name, | ||
3409 | 252 | fido2_device, | ||
3410 | 253 | rp, | ||
3411 | 254 | cid, cid_size, | ||
3412 | 255 | key_file, key_file_size, key_file_offset, | ||
3413 | 256 | salt, salt_size, | ||
3414 | 257 | until, | ||
3415 | 258 | headless, | ||
3416 | 259 | required, | ||
3417 | 260 | ret_decrypted_key, ret_decrypted_key_size, | ||
3418 | 261 | ask_password_flags); | ||
3419 | 262 | if (ret == 0) | ||
3420 | 263 | break; | ||
3421 | 246 | } | 264 | } |
3422 | 247 | 265 | ||
3423 | 248 | if (!cid) | 266 | if (!cid) |
3424 | 249 | return log_error_errno(SYNTHETIC_ERRNO(ENXIO), | 267 | return log_error_errno(SYNTHETIC_ERRNO(ENXIO), |
3425 | 250 | "No valid FIDO2 token data found."); | 268 | "No valid FIDO2 token data found."); |
3426 | 251 | 269 | ||
3428 | 252 | log_info("Automatically discovered security FIDO2 token unlocks volume."); | 270 | if (ret == -EAGAIN) /* fido2 device does not exist, or UV is blocked; caller will prompt for retry */ |
3429 | 271 | return log_debug_errno(ret, "FIDO2 token does not exist, or UV is blocked."); | ||
3430 | 272 | if (ret < 0) | ||
3431 | 273 | return log_error_errno(ret, "Failed to unlock LUKS volume with FIDO2 token: %m"); | ||
3432 | 253 | 274 | ||
3441 | 254 | *ret_rp_id = TAKE_PTR(rp); | 275 | log_info("Unlocked volume via automatically discovered security FIDO2 token."); |
3442 | 255 | *ret_cid = TAKE_PTR(cid); | 276 | return ret; |
3435 | 256 | *ret_cid_size = cid_size; | ||
3436 | 257 | *ret_salt = TAKE_PTR(salt); | ||
3437 | 258 | *ret_salt_size = salt_size; | ||
3438 | 259 | *ret_keyslot = keyslot; | ||
3439 | 260 | *ret_required = required; | ||
3440 | 261 | return 0; | ||
3443 | 262 | } | 277 | } |
3444 | diff --git a/src/cryptsetup/cryptsetup-fido2.h b/src/cryptsetup/cryptsetup-fido2.h | |||
3445 | index 204f1e0..371bf21 100644 | |||
3446 | --- a/src/cryptsetup/cryptsetup-fido2.h | |||
3447 | +++ b/src/cryptsetup/cryptsetup-fido2.h | |||
3448 | @@ -29,15 +29,19 @@ int acquire_fido2_key( | |||
3449 | 29 | size_t *ret_decrypted_key_size, | 29 | size_t *ret_decrypted_key_size, |
3450 | 30 | AskPasswordFlags ask_password_flags); | 30 | AskPasswordFlags ask_password_flags); |
3451 | 31 | 31 | ||
3453 | 32 | int find_fido2_auto_data( | 32 | int acquire_fido2_key_auto( |
3454 | 33 | struct crypt_device *cd, | 33 | struct crypt_device *cd, |
3462 | 34 | char **ret_rp_id, | 34 | const char *name, |
3463 | 35 | void **ret_salt, | 35 | const char *friendly_name, |
3464 | 36 | size_t *ret_salt_size, | 36 | const char *fido2_device, |
3465 | 37 | void **ret_cid, | 37 | const char *key_file, |
3466 | 38 | size_t *ret_cid_size, | 38 | size_t key_file_size, |
3467 | 39 | int *ret_keyslot, | 39 | uint64_t key_file_offset, |
3468 | 40 | Fido2EnrollFlags *ret_required); | 40 | usec_t until, |
3469 | 41 | bool headless, | ||
3470 | 42 | void **ret_decrypted_key, | ||
3471 | 43 | size_t *ret_decrypted_key_size, | ||
3472 | 44 | AskPasswordFlags ask_password_flags); | ||
3473 | 41 | 45 | ||
3474 | 42 | #else | 46 | #else |
3475 | 43 | 47 | ||
3476 | @@ -64,15 +68,19 @@ static inline int acquire_fido2_key( | |||
3477 | 64 | "FIDO2 token support not available."); | 68 | "FIDO2 token support not available."); |
3478 | 65 | } | 69 | } |
3479 | 66 | 70 | ||
3481 | 67 | static inline int find_fido2_auto_data( | 71 | static inline int acquire_fido2_key_auto( |
3482 | 68 | struct crypt_device *cd, | 72 | struct crypt_device *cd, |
3490 | 69 | char **ret_rp_id, | 73 | const char *name, |
3491 | 70 | void **ret_salt, | 74 | const char *friendly_name, |
3492 | 71 | size_t *ret_salt_size, | 75 | const char *fido2_device, |
3493 | 72 | void **ret_cid, | 76 | const char *key_file, |
3494 | 73 | size_t *ret_cid_size, | 77 | size_t key_file_size, |
3495 | 74 | int *ret_keyslot, | 78 | uint64_t key_file_offset, |
3496 | 75 | Fido2EnrollFlags *ret_required) { | 79 | usec_t until, |
3497 | 80 | bool headless, | ||
3498 | 81 | void **ret_decrypted_key, | ||
3499 | 82 | size_t *ret_decrypted_key_size, | ||
3500 | 83 | AskPasswordFlags ask_password_flags) { | ||
3501 | 76 | 84 | ||
3502 | 77 | return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), | 85 | return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), |
3503 | 78 | "FIDO2 token support not available."); | 86 | "FIDO2 token support not available."); |
3504 | diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c | |||
3505 | index 7aa36b4..a8cfc6d 100644 | |||
3506 | --- a/src/cryptsetup/cryptsetup.c | |||
3507 | +++ b/src/cryptsetup/cryptsetup.c | |||
3508 | @@ -1061,9 +1061,8 @@ static int attach_luks_or_plain_or_bitlk_by_fido2( | |||
3509 | 1061 | _cleanup_(sd_device_monitor_unrefp) sd_device_monitor *monitor = NULL; | 1061 | _cleanup_(sd_device_monitor_unrefp) sd_device_monitor *monitor = NULL; |
3510 | 1062 | _cleanup_(erase_and_freep) void *decrypted_key = NULL; | 1062 | _cleanup_(erase_and_freep) void *decrypted_key = NULL; |
3511 | 1063 | _cleanup_(sd_event_unrefp) sd_event *event = NULL; | 1063 | _cleanup_(sd_event_unrefp) sd_event *event = NULL; |
3515 | 1064 | _cleanup_free_ void *discovered_salt = NULL, *discovered_cid = NULL; | 1064 | size_t decrypted_key_size, cid_size = 0; |
3516 | 1065 | size_t discovered_salt_size, discovered_cid_size, decrypted_key_size, cid_size = 0; | 1065 | _cleanup_free_ char *friendly = NULL; |
3514 | 1066 | _cleanup_free_ char *friendly = NULL, *discovered_rp_id = NULL; | ||
3517 | 1067 | int keyslot = arg_key_slot, r; | 1066 | int keyslot = arg_key_slot, r; |
3518 | 1068 | const char *rp_id = NULL; | 1067 | const char *rp_id = NULL; |
3519 | 1069 | const void *cid = NULL; | 1068 | const void *cid = NULL; |
3520 | @@ -1088,32 +1087,6 @@ static int attach_luks_or_plain_or_bitlk_by_fido2( | |||
3521 | 1088 | * use PIN + UP when needed, and do not configure UV at all. Eventually, we should make this | 1087 | * use PIN + UP when needed, and do not configure UV at all. Eventually, we should make this |
3522 | 1089 | * explicitly configurable. */ | 1088 | * explicitly configurable. */ |
3523 | 1090 | required = FIDO2ENROLL_PIN_IF_NEEDED | FIDO2ENROLL_UP_IF_NEEDED | FIDO2ENROLL_UV_OMIT; | 1089 | required = FIDO2ENROLL_PIN_IF_NEEDED | FIDO2ENROLL_UP_IF_NEEDED | FIDO2ENROLL_UV_OMIT; |
3524 | 1091 | } else if (!use_libcryptsetup_plugin) { | ||
3525 | 1092 | r = find_fido2_auto_data( | ||
3526 | 1093 | cd, | ||
3527 | 1094 | &discovered_rp_id, | ||
3528 | 1095 | &discovered_salt, | ||
3529 | 1096 | &discovered_salt_size, | ||
3530 | 1097 | &discovered_cid, | ||
3531 | 1098 | &discovered_cid_size, | ||
3532 | 1099 | &keyslot, | ||
3533 | 1100 | &required); | ||
3534 | 1101 | |||
3535 | 1102 | if (IN_SET(r, -ENOTUNIQ, -ENXIO)) | ||
3536 | 1103 | return log_debug_errno(SYNTHETIC_ERRNO(EAGAIN), | ||
3537 | 1104 | "Automatic FIDO2 metadata discovery was not possible because missing or not unique, falling back to traditional unlocking."); | ||
3538 | 1105 | if (r < 0) | ||
3539 | 1106 | return r; | ||
3540 | 1107 | |||
3541 | 1108 | if ((required & (FIDO2ENROLL_PIN | FIDO2ENROLL_UP | FIDO2ENROLL_UV)) && arg_headless) | ||
3542 | 1109 | return log_error_errno(SYNTHETIC_ERRNO(ENOPKG), | ||
3543 | 1110 | "Local verification is required to unlock this volume, but the 'headless' parameter was set."); | ||
3544 | 1111 | |||
3545 | 1112 | rp_id = discovered_rp_id; | ||
3546 | 1113 | key_data = discovered_salt; | ||
3547 | 1114 | key_data_size = discovered_salt_size; | ||
3548 | 1115 | cid = discovered_cid; | ||
3549 | 1116 | cid_size = discovered_cid_size; | ||
3550 | 1117 | } | 1090 | } |
3551 | 1118 | 1091 | ||
3552 | 1119 | friendly = friendly_disk_name(crypt_get_device_name(cd), name); | 1092 | friendly = friendly_disk_name(crypt_get_device_name(cd), name); |
3553 | @@ -1128,19 +1101,31 @@ static int attach_luks_or_plain_or_bitlk_by_fido2( | |||
3554 | 1128 | "Automatic FIDO2 metadata discovery was not possible because missing or not unique, falling back to traditional unlocking."); | 1101 | "Automatic FIDO2 metadata discovery was not possible because missing or not unique, falling back to traditional unlocking."); |
3555 | 1129 | 1102 | ||
3556 | 1130 | } else { | 1103 | } else { |
3570 | 1131 | r = acquire_fido2_key( | 1104 | if (cid) |
3571 | 1132 | name, | 1105 | r = acquire_fido2_key( |
3572 | 1133 | friendly, | 1106 | name, |
3573 | 1134 | arg_fido2_device, | 1107 | friendly, |
3574 | 1135 | rp_id, | 1108 | arg_fido2_device, |
3575 | 1136 | cid, cid_size, | 1109 | rp_id, |
3576 | 1137 | key_file, arg_keyfile_size, arg_keyfile_offset, | 1110 | cid, cid_size, |
3577 | 1138 | key_data, key_data_size, | 1111 | key_file, arg_keyfile_size, arg_keyfile_offset, |
3578 | 1139 | until, | 1112 | key_data, key_data_size, |
3579 | 1140 | arg_headless, | 1113 | until, |
3580 | 1141 | required, | 1114 | arg_headless, |
3581 | 1142 | &decrypted_key, &decrypted_key_size, | 1115 | required, |
3582 | 1143 | arg_ask_password_flags); | 1116 | &decrypted_key, &decrypted_key_size, |
3583 | 1117 | arg_ask_password_flags); | ||
3584 | 1118 | else | ||
3585 | 1119 | r = acquire_fido2_key_auto( | ||
3586 | 1120 | cd, | ||
3587 | 1121 | name, | ||
3588 | 1122 | friendly, | ||
3589 | 1123 | arg_fido2_device, | ||
3590 | 1124 | key_file, arg_keyfile_size, arg_keyfile_offset, | ||
3591 | 1125 | until, | ||
3592 | 1126 | arg_headless, | ||
3593 | 1127 | &decrypted_key, &decrypted_key_size, | ||
3594 | 1128 | arg_ask_password_flags); | ||
3595 | 1144 | if (r >= 0) | 1129 | if (r >= 0) |
3596 | 1145 | break; | 1130 | break; |
3597 | 1146 | } | 1131 | } |
3598 | diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h | |||
3599 | index c11a5b1..e73174a 100644 | |||
3600 | --- a/src/fundamental/macro-fundamental.h | |||
3601 | +++ b/src/fundamental/macro-fundamental.h | |||
3602 | @@ -20,6 +20,7 @@ | |||
3603 | 20 | #define _hidden_ __attribute__((__visibility__("hidden"))) | 20 | #define _hidden_ __attribute__((__visibility__("hidden"))) |
3604 | 21 | #define _likely_(x) (__builtin_expect(!!(x), 1)) | 21 | #define _likely_(x) (__builtin_expect(!!(x), 1)) |
3605 | 22 | #define _malloc_ __attribute__((__malloc__)) | 22 | #define _malloc_ __attribute__((__malloc__)) |
3606 | 23 | #define _noinline_ __attribute__((noinline)) | ||
3607 | 23 | #define _noreturn_ _Noreturn | 24 | #define _noreturn_ _Noreturn |
3608 | 24 | #define _packed_ __attribute__((__packed__)) | 25 | #define _packed_ __attribute__((__packed__)) |
3609 | 25 | #define _printf_(a, b) __attribute__((__format__(printf, a, b))) | 26 | #define _printf_(a, b) __attribute__((__format__(printf, a, b))) |
3610 | diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c | |||
3611 | index 143faa0..30639b3 100644 | |||
3612 | --- a/src/gpt-auto-generator/gpt-auto-generator.c | |||
3613 | +++ b/src/gpt-auto-generator/gpt-auto-generator.c | |||
3614 | @@ -414,14 +414,14 @@ static int add_automount( | |||
3615 | 414 | static const char *esp_or_xbootldr_options(const DissectedPartition *p) { | 414 | static const char *esp_or_xbootldr_options(const DissectedPartition *p) { |
3616 | 415 | assert(p); | 415 | assert(p); |
3617 | 416 | 416 | ||
3621 | 417 | /* if we probed vfat or have no idea about the file system then assume these file systems are vfat | 417 | /* Discoveried ESP and XBOOTLDR partition are always hardened with "noexec,nosuid,nodev". |
3622 | 418 | * and thus understand "umask=0077". If we detected something else then don't specify any options and | 418 | * If we probed vfat or have no idea about the file system then assume these file systems are vfat |
3623 | 419 | * use kernel defaults. */ | 419 | * and thus understand "umask=0077". */ |
3624 | 420 | 420 | ||
3625 | 421 | if (!p->fstype || streq(p->fstype, "vfat")) | 421 | if (!p->fstype || streq(p->fstype, "vfat")) |
3627 | 422 | return "umask=0077"; | 422 | return "umask=0077,noexec,nosuid,nodev"; |
3628 | 423 | 423 | ||
3630 | 424 | return NULL; | 424 | return "noexec,nosuid,nodev"; |
3631 | 425 | } | 425 | } |
3632 | 426 | 426 | ||
3633 | 427 | static int add_partition_xbootldr(DissectedPartition *p) { | 427 | static int add_partition_xbootldr(DissectedPartition *p) { |
3634 | diff --git a/src/import/curl-util.c b/src/import/curl-util.c | |||
3635 | index c124c98..94f718d 100644 | |||
3636 | --- a/src/import/curl-util.c | |||
3637 | +++ b/src/import/curl-util.c | |||
3638 | @@ -252,7 +252,11 @@ int curl_glue_make(CURL **ret, const char *url, void *userdata) { | |||
3639 | 252 | if (curl_easy_setopt(c, CURLOPT_LOW_SPEED_LIMIT, 30L) != CURLE_OK) | 252 | if (curl_easy_setopt(c, CURLOPT_LOW_SPEED_LIMIT, 30L) != CURLE_OK) |
3640 | 253 | return -EIO; | 253 | return -EIO; |
3641 | 254 | 254 | ||
3642 | 255 | #if LIBCURL_VERSION_NUM >= 0x075500 /* libcurl 7.85.0 */ | ||
3643 | 256 | if (curl_easy_setopt(c, CURLOPT_PROTOCOLS_STR, "HTTP,HTTPS,FILE") != CURLE_OK) | ||
3644 | 257 | #else | ||
3645 | 255 | if (curl_easy_setopt(c, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS|CURLPROTO_FILE) != CURLE_OK) | 258 | if (curl_easy_setopt(c, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS|CURLPROTO_FILE) != CURLE_OK) |
3646 | 259 | #endif | ||
3647 | 256 | return -EIO; | 260 | return -EIO; |
3648 | 257 | 261 | ||
3649 | 258 | *ret = TAKE_PTR(c); | 262 | *ret = TAKE_PTR(c); |
3650 | diff --git a/src/import/pull-job.c b/src/import/pull-job.c | |||
3651 | index 1e105bc..d4d07a0 100644 | |||
3652 | --- a/src/import/pull-job.c | |||
3653 | +++ b/src/import/pull-job.c | |||
3654 | @@ -124,8 +124,8 @@ static int pull_job_restart(PullJob *j, const char *new_url) { | |||
3655 | 124 | 124 | ||
3656 | 125 | void pull_job_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result) { | 125 | void pull_job_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result) { |
3657 | 126 | PullJob *j = NULL; | 126 | PullJob *j = NULL; |
3658 | 127 | char *scheme = NULL; | ||
3659 | 127 | CURLcode code; | 128 | CURLcode code; |
3660 | 128 | long protocol; | ||
3661 | 129 | int r; | 129 | int r; |
3662 | 130 | 130 | ||
3663 | 131 | if (curl_easy_getinfo(curl, CURLINFO_PRIVATE, (char **)&j) != CURLE_OK) | 131 | if (curl_easy_getinfo(curl, CURLINFO_PRIVATE, (char **)&j) != CURLE_OK) |
3664 | @@ -139,13 +139,13 @@ void pull_job_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result) { | |||
3665 | 139 | goto finish; | 139 | goto finish; |
3666 | 140 | } | 140 | } |
3667 | 141 | 141 | ||
3671 | 142 | code = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol); | 142 | code = curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme); |
3672 | 143 | if (code != CURLE_OK) { | 143 | if (code != CURLE_OK || !scheme) { |
3673 | 144 | r = log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to retrieve response code: %s", curl_easy_strerror(code)); | 144 | r = log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to retrieve URL scheme."); |
3674 | 145 | goto finish; | 145 | goto finish; |
3675 | 146 | } | 146 | } |
3676 | 147 | 147 | ||
3678 | 148 | if (IN_SET(protocol, CURLPROTO_HTTP, CURLPROTO_HTTPS)) { | 148 | if (STRCASE_IN_SET(scheme, "HTTP", "HTTPS")) { |
3679 | 149 | long status; | 149 | long status; |
3680 | 150 | 150 | ||
3681 | 151 | code = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status); | 151 | code = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status); |
3682 | diff --git a/src/journal-remote/microhttpd-util.h b/src/journal-remote/microhttpd-util.h | |||
3683 | index 7e7d1b5..df18335 100644 | |||
3684 | --- a/src/journal-remote/microhttpd-util.h | |||
3685 | +++ b/src/journal-remote/microhttpd-util.h | |||
3686 | @@ -64,11 +64,11 @@ void microhttpd_logger(void *arg, const char *fmt, va_list ap) _printf_(2, 0); | |||
3687 | 64 | 64 | ||
3688 | 65 | int mhd_respondf(struct MHD_Connection *connection, | 65 | int mhd_respondf(struct MHD_Connection *connection, |
3689 | 66 | int error, | 66 | int error, |
3691 | 67 | unsigned code, | 67 | enum MHD_RequestTerminationCode code, |
3692 | 68 | const char *format, ...) _printf_(4,5); | 68 | const char *format, ...) _printf_(4,5); |
3693 | 69 | 69 | ||
3694 | 70 | int mhd_respond(struct MHD_Connection *connection, | 70 | int mhd_respond(struct MHD_Connection *connection, |
3696 | 71 | unsigned code, | 71 | enum MHD_RequestTerminationCode code, |
3697 | 72 | const char *message); | 72 | const char *message); |
3698 | 73 | 73 | ||
3699 | 74 | int mhd_respond_oom(struct MHD_Connection *connection); | 74 | int mhd_respond_oom(struct MHD_Connection *connection); |
3700 | diff --git a/src/kernel-install/50-depmod.install b/src/kernel-install/50-depmod.install | |||
3701 | index 43bd87c..88f858f 100755 | |||
3702 | --- a/src/kernel-install/50-depmod.install | |||
3703 | +++ b/src/kernel-install/50-depmod.install | |||
3704 | @@ -23,6 +23,8 @@ set -e | |||
3705 | 23 | COMMAND="${1:?}" | 23 | COMMAND="${1:?}" |
3706 | 24 | KERNEL_VERSION="${2:?}" | 24 | KERNEL_VERSION="${2:?}" |
3707 | 25 | 25 | ||
3708 | 26 | [ -w "/lib/modules" ] || exit 0 | ||
3709 | 27 | |||
3710 | 26 | case "$COMMAND" in | 28 | case "$COMMAND" in |
3711 | 27 | add) | 29 | add) |
3712 | 28 | [ -d "/lib/modules/$KERNEL_VERSION/kernel" ] || exit 0 | 30 | [ -d "/lib/modules/$KERNEL_VERSION/kernel" ] || exit 0 |
3713 | diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c | |||
3714 | index a106f7f..b755c12 100644 | |||
3715 | --- a/src/libsystemd-network/sd-dhcp-client.c | |||
3716 | +++ b/src/libsystemd-network/sd-dhcp-client.c | |||
3717 | @@ -188,35 +188,33 @@ int sd_dhcp_client_id_to_string(const void *data, size_t len, char **ret) { | |||
3718 | 188 | r = asprintf(&t, "DATA"); | 188 | r = asprintf(&t, "DATA"); |
3719 | 189 | break; | 189 | break; |
3720 | 190 | case 1: | 190 | case 1: |
3731 | 191 | if (len != sizeof_field(sd_dhcp_client_id, eth)) | 191 | if (len == sizeof_field(sd_dhcp_client_id, eth)) |
3732 | 192 | return -EINVAL; | 192 | r = asprintf(&t, "%02x:%02x:%02x:%02x:%02x:%02x", |
3733 | 193 | 193 | client_id->eth.haddr[0], | |
3734 | 194 | r = asprintf(&t, "%02x:%02x:%02x:%02x:%02x:%02x", | 194 | client_id->eth.haddr[1], |
3735 | 195 | client_id->eth.haddr[0], | 195 | client_id->eth.haddr[2], |
3736 | 196 | client_id->eth.haddr[1], | 196 | client_id->eth.haddr[3], |
3737 | 197 | client_id->eth.haddr[2], | 197 | client_id->eth.haddr[4], |
3738 | 198 | client_id->eth.haddr[3], | 198 | client_id->eth.haddr[5]); |
3739 | 199 | client_id->eth.haddr[4], | 199 | else |
3740 | 200 | client_id->eth.haddr[5]); | 200 | r = asprintf(&t, "ETHER"); |
3741 | 201 | break; | 201 | break; |
3742 | 202 | case 2 ... 254: | 202 | case 2 ... 254: |
3743 | 203 | r = asprintf(&t, "ARP/LL"); | 203 | r = asprintf(&t, "ARP/LL"); |
3744 | 204 | break; | 204 | break; |
3745 | 205 | case 255: | 205 | case 255: |
3755 | 206 | if (len < 6) | 206 | if (len < sizeof(uint32_t)) |
3756 | 207 | return -EINVAL; | 207 | r = asprintf(&t, "IAID/DUID"); |
3757 | 208 | 208 | else { | |
3758 | 209 | uint32_t iaid = be32toh(client_id->ns.iaid); | 209 | uint32_t iaid = be32toh(client_id->ns.iaid); |
3759 | 210 | uint16_t duid_type = be16toh(client_id->ns.duid.type); | 210 | /* TODO: check and stringify DUID */ |
3760 | 211 | if (dhcp_validate_duid_len(duid_type, len - 6, true) < 0) | 211 | r = asprintf(&t, "IAID:0x%x/DUID", iaid); |
3761 | 212 | return -EINVAL; | 212 | } |
3753 | 213 | |||
3754 | 214 | r = asprintf(&t, "IAID:0x%x/DUID", iaid); | ||
3762 | 215 | break; | 213 | break; |
3763 | 216 | } | 214 | } |
3764 | 217 | |||
3765 | 218 | if (r < 0) | 215 | if (r < 0) |
3766 | 219 | return -ENOMEM; | 216 | return -ENOMEM; |
3767 | 217 | |||
3768 | 220 | *ret = TAKE_PTR(t); | 218 | *ret = TAKE_PTR(t); |
3769 | 221 | return 0; | 219 | return 0; |
3770 | 222 | } | 220 | } |
3771 | diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c | |||
3772 | index d9db35f..b14ad57 100644 | |||
3773 | --- a/src/libsystemd-network/sd-dhcp-lease.c | |||
3774 | +++ b/src/libsystemd-network/sd-dhcp-lease.c | |||
3775 | @@ -995,7 +995,7 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) { | |||
3776 | 995 | r = sd_dhcp_lease_get_router(lease, &addresses); | 995 | r = sd_dhcp_lease_get_router(lease, &addresses); |
3777 | 996 | if (r > 0) { | 996 | if (r > 0) { |
3778 | 997 | fputs("ROUTER=", f); | 997 | fputs("ROUTER=", f); |
3780 | 998 | serialize_in_addrs(f, addresses, r, false, NULL); | 998 | serialize_in_addrs(f, addresses, r, NULL, NULL); |
3781 | 999 | fputc('\n', f); | 999 | fputc('\n', f); |
3782 | 1000 | } | 1000 | } |
3783 | 1001 | 1001 | ||
3784 | @@ -1030,21 +1030,21 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) { | |||
3785 | 1030 | r = sd_dhcp_lease_get_dns(lease, &addresses); | 1030 | r = sd_dhcp_lease_get_dns(lease, &addresses); |
3786 | 1031 | if (r > 0) { | 1031 | if (r > 0) { |
3787 | 1032 | fputs("DNS=", f); | 1032 | fputs("DNS=", f); |
3789 | 1033 | serialize_in_addrs(f, addresses, r, false, NULL); | 1033 | serialize_in_addrs(f, addresses, r, NULL, NULL); |
3790 | 1034 | fputc('\n', f); | 1034 | fputc('\n', f); |
3791 | 1035 | } | 1035 | } |
3792 | 1036 | 1036 | ||
3793 | 1037 | r = sd_dhcp_lease_get_ntp(lease, &addresses); | 1037 | r = sd_dhcp_lease_get_ntp(lease, &addresses); |
3794 | 1038 | if (r > 0) { | 1038 | if (r > 0) { |
3795 | 1039 | fputs("NTP=", f); | 1039 | fputs("NTP=", f); |
3797 | 1040 | serialize_in_addrs(f, addresses, r, false, NULL); | 1040 | serialize_in_addrs(f, addresses, r, NULL, NULL); |
3798 | 1041 | fputc('\n', f); | 1041 | fputc('\n', f); |
3799 | 1042 | } | 1042 | } |
3800 | 1043 | 1043 | ||
3801 | 1044 | r = sd_dhcp_lease_get_sip(lease, &addresses); | 1044 | r = sd_dhcp_lease_get_sip(lease, &addresses); |
3802 | 1045 | if (r > 0) { | 1045 | if (r > 0) { |
3803 | 1046 | fputs("SIP=", f); | 1046 | fputs("SIP=", f); |
3805 | 1047 | serialize_in_addrs(f, addresses, r, false, NULL); | 1047 | serialize_in_addrs(f, addresses, r, NULL, NULL); |
3806 | 1048 | fputc('\n', f); | 1048 | fputc('\n', f); |
3807 | 1049 | } | 1049 | } |
3808 | 1050 | 1050 | ||
3809 | diff --git a/src/libsystemd-network/test-ndisc-ra.c b/src/libsystemd-network/test-ndisc-ra.c | |||
3810 | index 001df4d..bd8c0fd 100644 | |||
3811 | --- a/src/libsystemd-network/test-ndisc-ra.c | |||
3812 | +++ b/src/libsystemd-network/test-ndisc-ra.c | |||
3813 | @@ -53,7 +53,6 @@ static uint8_t advertisement[] = { | |||
3814 | 53 | 53 | ||
3815 | 54 | static bool test_stopped; | 54 | static bool test_stopped; |
3816 | 55 | static int test_fd[2]; | 55 | static int test_fd[2]; |
3817 | 56 | static sd_event_source *recv_router_advertisement; | ||
3818 | 57 | static struct { | 56 | static struct { |
3819 | 58 | struct in6_addr address; | 57 | struct in6_addr address; |
3820 | 59 | unsigned char prefixlen; | 58 | unsigned char prefixlen; |
3821 | @@ -281,9 +280,9 @@ static int radv_recv(sd_event_source *s, int fd, uint32_t revents, void *userdat | |||
3822 | 281 | } | 280 | } |
3823 | 282 | 281 | ||
3824 | 283 | TEST(ra) { | 282 | TEST(ra) { |
3828 | 284 | sd_event *e; | 283 | _cleanup_(sd_event_unrefp) sd_event *e = NULL; |
3829 | 285 | sd_radv *ra; | 284 | _cleanup_(sd_event_source_unrefp) sd_event_source *recv_router_advertisement = NULL; |
3830 | 286 | unsigned i; | 285 | _cleanup_(sd_radv_unrefp) sd_radv *ra = NULL; |
3831 | 287 | 286 | ||
3832 | 288 | assert_se(socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_fd) >= 0); | 287 | assert_se(socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_fd) >= 0); |
3833 | 289 | 288 | ||
3834 | @@ -303,7 +302,7 @@ TEST(ra) { | |||
3835 | 303 | assert_se(sd_radv_set_rdnss(ra, 60, &test_rdnss, 1) >= 0); | 302 | assert_se(sd_radv_set_rdnss(ra, 60, &test_rdnss, 1) >= 0); |
3836 | 304 | assert_se(sd_radv_set_dnssl(ra, 60, (char **)test_dnssl) >= 0); | 303 | assert_se(sd_radv_set_dnssl(ra, 60, (char **)test_dnssl) >= 0); |
3837 | 305 | 304 | ||
3839 | 306 | for (i = 0; i < ELEMENTSOF(prefix); i++) { | 305 | for (unsigned i = 0; i < ELEMENTSOF(prefix); i++) { |
3840 | 307 | sd_radv_prefix *p; | 306 | sd_radv_prefix *p; |
3841 | 308 | 307 | ||
3842 | 309 | printf("Test prefix %u\n", i); | 308 | printf("Test prefix %u\n", i); |
3843 | @@ -324,8 +323,8 @@ TEST(ra) { | |||
3844 | 324 | assert_se(!p); | 323 | assert_se(!p); |
3845 | 325 | } | 324 | } |
3846 | 326 | 325 | ||
3849 | 327 | assert_se(sd_event_add_io(e, &recv_router_advertisement, test_fd[0], | 326 | assert_se(sd_event_add_io(e, &recv_router_advertisement, test_fd[0], EPOLLIN, radv_recv, ra) >= 0); |
3850 | 328 | EPOLLIN, radv_recv, ra) >= 0); | 327 | assert_se(sd_event_source_set_io_fd_own(recv_router_advertisement, true) >= 0); |
3851 | 329 | 328 | ||
3852 | 330 | assert_se(sd_event_add_time_relative(e, NULL, CLOCK_BOOTTIME, | 329 | assert_se(sd_event_add_time_relative(e, NULL, CLOCK_BOOTTIME, |
3853 | 331 | 2 * USEC_PER_SEC, 0, | 330 | 2 * USEC_PER_SEC, 0, |
3854 | @@ -334,13 +333,6 @@ TEST(ra) { | |||
3855 | 334 | assert_se(sd_radv_start(ra) >= 0); | 333 | assert_se(sd_radv_start(ra) >= 0); |
3856 | 335 | 334 | ||
3857 | 336 | assert_se(sd_event_loop(e) >= 0); | 335 | assert_se(sd_event_loop(e) >= 0); |
3858 | 337 | |||
3859 | 338 | ra = sd_radv_unref(ra); | ||
3860 | 339 | assert_se(!ra); | ||
3861 | 340 | |||
3862 | 341 | close(test_fd[0]); | ||
3863 | 342 | |||
3864 | 343 | sd_event_unref(e); | ||
3865 | 344 | } | 336 | } |
3866 | 345 | 337 | ||
3867 | 346 | DEFINE_TEST_MAIN(LOG_DEBUG); | 338 | DEFINE_TEST_MAIN(LOG_DEBUG); |
3868 | diff --git a/src/libsystemd-network/test-ndisc-rs.c b/src/libsystemd-network/test-ndisc-rs.c | |||
3869 | index 3c679f6..e501b64 100644 | |||
3870 | --- a/src/libsystemd-network/test-ndisc-rs.c | |||
3871 | +++ b/src/libsystemd-network/test-ndisc-rs.c | |||
3872 | @@ -10,6 +10,7 @@ | |||
3873 | 10 | #include "sd-ndisc.h" | 10 | #include "sd-ndisc.h" |
3874 | 11 | 11 | ||
3875 | 12 | #include "alloc-util.h" | 12 | #include "alloc-util.h" |
3876 | 13 | #include "fd-util.h" | ||
3877 | 13 | #include "hexdecoct.h" | 14 | #include "hexdecoct.h" |
3878 | 14 | #include "icmp6-util.h" | 15 | #include "icmp6-util.h" |
3879 | 15 | #include "socket-util.h" | 16 | #include "socket-util.h" |
3880 | @@ -255,8 +256,8 @@ static void test_callback(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router | |||
3881 | 255 | } | 256 | } |
3882 | 256 | 257 | ||
3883 | 257 | TEST(rs) { | 258 | TEST(rs) { |
3886 | 258 | sd_event *e; | 259 | _cleanup_(sd_event_unrefp) sd_event *e = NULL; |
3887 | 259 | sd_ndisc *nd; | 260 | _cleanup_(sd_ndisc_unrefp) sd_ndisc *nd = NULL; |
3888 | 260 | 261 | ||
3889 | 261 | send_ra_function = send_ra; | 262 | send_ra_function = send_ra; |
3890 | 262 | 263 | ||
3891 | @@ -279,17 +280,13 @@ TEST(rs) { | |||
3892 | 279 | assert_se(sd_ndisc_start(nd) >= 0); | 280 | assert_se(sd_ndisc_start(nd) >= 0); |
3893 | 280 | assert_se(sd_ndisc_start(nd) >= 0); | 281 | assert_se(sd_ndisc_start(nd) >= 0); |
3894 | 281 | assert_se(sd_ndisc_stop(nd) >= 0); | 282 | assert_se(sd_ndisc_stop(nd) >= 0); |
3895 | 283 | test_fd[1] = safe_close(test_fd[1]); | ||
3896 | 282 | 284 | ||
3897 | 283 | assert_se(sd_ndisc_start(nd) >= 0); | 285 | assert_se(sd_ndisc_start(nd) >= 0); |
3898 | 284 | 286 | ||
3899 | 285 | assert_se(sd_event_loop(e) >= 0); | 287 | assert_se(sd_event_loop(e) >= 0); |
3900 | 286 | 288 | ||
3907 | 287 | nd = sd_ndisc_unref(nd); | 289 | test_fd[1] = safe_close(test_fd[1]); |
3902 | 288 | assert_se(!nd); | ||
3903 | 289 | |||
3904 | 290 | close(test_fd[1]); | ||
3905 | 291 | |||
3906 | 292 | sd_event_unref(e); | ||
3908 | 293 | } | 290 | } |
3909 | 294 | 291 | ||
3910 | 295 | static int test_timeout_value(uint8_t flags) { | 292 | static int test_timeout_value(uint8_t flags) { |
3911 | @@ -342,8 +339,8 @@ static int test_timeout_value(uint8_t flags) { | |||
3912 | 342 | } | 339 | } |
3913 | 343 | 340 | ||
3914 | 344 | TEST(timeout) { | 341 | TEST(timeout) { |
3917 | 345 | sd_event *e; | 342 | _cleanup_(sd_event_unrefp) sd_event *e = NULL; |
3918 | 346 | sd_ndisc *nd; | 343 | _cleanup_(sd_ndisc_unrefp) sd_ndisc *nd = NULL; |
3919 | 347 | 344 | ||
3920 | 348 | send_ra_function = test_timeout_value; | 345 | send_ra_function = test_timeout_value; |
3921 | 349 | 346 | ||
3922 | @@ -367,9 +364,7 @@ TEST(timeout) { | |||
3923 | 367 | 364 | ||
3924 | 368 | assert_se(sd_event_loop(e) >= 0); | 365 | assert_se(sd_event_loop(e) >= 0); |
3925 | 369 | 366 | ||
3929 | 370 | nd = sd_ndisc_unref(nd); | 367 | test_fd[1] = safe_close(test_fd[1]); |
3927 | 371 | |||
3928 | 372 | sd_event_unref(e); | ||
3930 | 373 | } | 368 | } |
3931 | 374 | 369 | ||
3932 | 375 | DEFINE_TEST_MAIN(LOG_DEBUG); | 370 | DEFINE_TEST_MAIN(LOG_DEBUG); |
3933 | diff --git a/src/libsystemd/sd-device/test-sd-device.c b/src/libsystemd/sd-device/test-sd-device.c | |||
3934 | index 4ab8b38..ff4209e 100644 | |||
3935 | --- a/src/libsystemd/sd-device/test-sd-device.c | |||
3936 | +++ b/src/libsystemd/sd-device/test-sd-device.c | |||
3937 | @@ -180,15 +180,16 @@ static void test_sd_device_one(sd_device *d) { | |||
3938 | 180 | } else | 180 | } else |
3939 | 181 | assert_se(r == -ENOENT); | 181 | assert_se(r == -ENOENT); |
3940 | 182 | 182 | ||
3945 | 183 | r = sd_device_get_sysattr_value(d, "name_assign_type", &val); | 183 | r = sd_device_get_sysattr_value(d, "nsid", NULL); |
3946 | 184 | assert_se(r >= 0 || ERRNO_IS_PRIVILEGE(r) || IN_SET(r, -ENOENT, -EINVAL)); | 184 | if (r >= 0) { |
3943 | 185 | |||
3944 | 186 | if (r > 0) { | ||
3947 | 187 | unsigned x; | 185 | unsigned x; |
3948 | 188 | 186 | ||
3952 | 189 | assert_se(device_get_sysattr_unsigned(d, "name_assign_type", NULL) >= 0); | 187 | assert_se(device_get_sysattr_unsigned(d, "nsid", NULL) >= 0); |
3953 | 190 | assert_se(device_get_sysattr_unsigned(d, "name_assign_type", &x) >= 0); | 188 | r = device_get_sysattr_unsigned(d, "nsid", &x); |
3954 | 191 | } | 189 | assert_se(r >= 0); |
3955 | 190 | assert_se((x > 0) == (r > 0)); | ||
3956 | 191 | } else | ||
3957 | 192 | assert_se(ERRNO_IS_PRIVILEGE(r) || IN_SET(r, -ENOENT, -EINVAL)); | ||
3958 | 192 | } | 193 | } |
3959 | 193 | 194 | ||
3960 | 194 | TEST(sd_device_enumerator_devices) { | 195 | TEST(sd_device_enumerator_devices) { |
3961 | diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c | |||
3962 | index 778070a..4a4cc3a 100644 | |||
3963 | --- a/src/libsystemd/sd-event/sd-event.c | |||
3964 | +++ b/src/libsystemd/sd-event/sd-event.c | |||
3965 | @@ -658,7 +658,9 @@ static int event_make_signal_data( | |||
3966 | 658 | ss_copy = d->sigset; | 658 | ss_copy = d->sigset; |
3967 | 659 | assert_se(sigaddset(&ss_copy, sig) >= 0); | 659 | assert_se(sigaddset(&ss_copy, sig) >= 0); |
3968 | 660 | 660 | ||
3970 | 661 | r = signalfd(d->fd, &ss_copy, SFD_NONBLOCK|SFD_CLOEXEC); | 661 | r = signalfd(d->fd >= 0 ? d->fd : -1, /* the first arg must be -1 or a valid signalfd */ |
3971 | 662 | &ss_copy, | ||
3972 | 663 | SFD_NONBLOCK|SFD_CLOEXEC); | ||
3973 | 662 | if (r < 0) { | 664 | if (r < 0) { |
3974 | 663 | r = -errno; | 665 | r = -errno; |
3975 | 664 | goto fail; | 666 | goto fail; |
3976 | @@ -2723,6 +2725,9 @@ _public_ int sd_event_source_set_time_relative(sd_event_source *s, uint64_t usec | |||
3977 | 2723 | assert_return(s, -EINVAL); | 2725 | assert_return(s, -EINVAL); |
3978 | 2724 | assert_return(EVENT_SOURCE_IS_TIME(s->type), -EDOM); | 2726 | assert_return(EVENT_SOURCE_IS_TIME(s->type), -EDOM); |
3979 | 2725 | 2727 | ||
3980 | 2728 | if (usec == USEC_INFINITY) | ||
3981 | 2729 | return sd_event_source_set_time(s, USEC_INFINITY); | ||
3982 | 2730 | |||
3983 | 2726 | r = sd_event_now(s->event, event_source_type_to_clock(s->type), &t); | 2731 | r = sd_event_now(s->event, event_source_type_to_clock(s->type), &t); |
3984 | 2727 | if (r < 0) | 2732 | if (r < 0) |
3985 | 2728 | return r; | 2733 | return r; |
3986 | diff --git a/src/locale/localed.c b/src/locale/localed.c | |||
3987 | index 7aa47f1..8b1f0de 100644 | |||
3988 | --- a/src/locale/localed.c | |||
3989 | +++ b/src/locale/localed.c | |||
3990 | @@ -32,7 +32,7 @@ | |||
3991 | 32 | #include "strv.h" | 32 | #include "strv.h" |
3992 | 33 | #include "user-util.h" | 33 | #include "user-util.h" |
3993 | 34 | 34 | ||
3995 | 35 | static int locale_update_system_manager(sd_bus *bus, char **l_set, char **l_unset) { | 35 | static int reload_system_manager(sd_bus *bus) { |
3996 | 36 | _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; | 36 | _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; |
3997 | 37 | _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; | 37 | _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; |
3998 | 38 | int r; | 38 | int r; |
3999 | @@ -43,21 +43,13 @@ static int locale_update_system_manager(sd_bus *bus, char **l_set, char **l_unse | |||
4000 | 43 | "org.freedesktop.systemd1", | 43 | "org.freedesktop.systemd1", |
4001 | 44 | "/org/freedesktop/systemd1", | 44 | "/org/freedesktop/systemd1", |
4002 | 45 | "org.freedesktop.systemd1.Manager", | 45 | "org.freedesktop.systemd1.Manager", |
4012 | 46 | "UnsetAndSetEnvironment"); | 46 | "Reload"); |
4004 | 47 | if (r < 0) | ||
4005 | 48 | return bus_log_create_error(r); | ||
4006 | 49 | |||
4007 | 50 | r = sd_bus_message_append_strv(m, l_unset); | ||
4008 | 51 | if (r < 0) | ||
4009 | 52 | return bus_log_create_error(r); | ||
4010 | 53 | |||
4011 | 54 | r = sd_bus_message_append_strv(m, l_set); | ||
4013 | 55 | if (r < 0) | 47 | if (r < 0) |
4014 | 56 | return bus_log_create_error(r); | 48 | return bus_log_create_error(r); |
4015 | 57 | 49 | ||
4016 | 58 | r = sd_bus_call(bus, m, 0, &error, NULL); | 50 | r = sd_bus_call(bus, m, 0, &error, NULL); |
4017 | 59 | if (r < 0) | 51 | if (r < 0) |
4019 | 60 | return log_error_errno(r, "Failed to update the manager environment: %s", bus_error_message(&error, r)); | 52 | return log_error_errno(r, "Failed to reload system manager: %s", bus_error_message(&error, r)); |
4020 | 61 | 53 | ||
4021 | 62 | return 0; | 54 | return 0; |
4022 | 63 | } | 55 | } |
4023 | @@ -393,7 +385,11 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er | |||
4024 | 393 | return sd_bus_error_set_errnof(error, r, "Failed to set locale: %m"); | 385 | return sd_bus_error_set_errnof(error, r, "Failed to set locale: %m"); |
4025 | 394 | } | 386 | } |
4026 | 395 | 387 | ||
4028 | 396 | (void) locale_update_system_manager(sd_bus_message_get_bus(m), l_set, l_unset); | 388 | /* Since we just updated the locale configuration file, ask the system manager to read it again to |
4029 | 389 | * update its default locale settings. It's important to not use UnsetAndSetEnvironment or a similar | ||
4030 | 390 | * method because in this case unsetting variables means restoring them to PID1 default values, which | ||
4031 | 391 | * may be outdated, since locale.conf has just changed and PID1 hasn't read it */ | ||
4032 | 392 | (void) reload_system_manager(sd_bus_message_get_bus(m)); | ||
4033 | 397 | 393 | ||
4034 | 398 | if (!strv_isempty(l_set)) { | 394 | if (!strv_isempty(l_set)) { |
4035 | 399 | _cleanup_free_ char *line = NULL; | 395 | _cleanup_free_ char *line = NULL; |
4036 | diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c | |||
4037 | index 86a5dec..2ab26b9 100644 | |||
4038 | --- a/src/login/logind-dbus.c | |||
4039 | +++ b/src/login/logind-dbus.c | |||
4040 | @@ -3970,6 +3970,12 @@ int manager_start_scope( | |||
4041 | 3970 | if (r < 0) | 3970 | if (r < 0) |
4042 | 3971 | return r; | 3971 | return r; |
4043 | 3972 | 3972 | ||
4044 | 3973 | /* For login session scopes, if a process is OOM killed by the kernel, *don't* terminate the rest of | ||
4045 | 3974 | the scope */ | ||
4046 | 3975 | r = sd_bus_message_append(m, "(sv)", "OOMPolicy", "s", "continue"); | ||
4047 | 3976 | if (r < 0) | ||
4048 | 3977 | return r; | ||
4049 | 3978 | |||
4050 | 3973 | /* disable TasksMax= for the session scope, rely on the slice setting for it */ | 3979 | /* disable TasksMax= for the session scope, rely on the slice setting for it */ |
4051 | 3974 | r = sd_bus_message_append(m, "(sv)", "TasksMax", "t", UINT64_MAX); | 3980 | r = sd_bus_message_append(m, "(sv)", "TasksMax", "t", UINT64_MAX); |
4052 | 3975 | if (r < 0) | 3981 | if (r < 0) |
4053 | diff --git a/src/network/netdev/l2tp-tunnel.c b/src/network/netdev/l2tp-tunnel.c | |||
4054 | index 2bce0fc..fd2783e 100644 | |||
4055 | --- a/src/network/netdev/l2tp-tunnel.c | |||
4056 | +++ b/src/network/netdev/l2tp-tunnel.c | |||
4057 | @@ -522,7 +522,7 @@ int config_parse_l2tp_tunnel_local_address( | |||
4058 | 522 | return log_oom(); | 522 | return log_oom(); |
4059 | 523 | } | 523 | } |
4060 | 524 | 524 | ||
4062 | 525 | type = l2tp_local_address_type_from_string(rvalue); | 525 | type = l2tp_local_address_type_from_string(addr_or_type); |
4063 | 526 | if (type >= 0) { | 526 | if (type >= 0) { |
4064 | 527 | free_and_replace(t->local_ifname, ifname); | 527 | free_and_replace(t->local_ifname, ifname); |
4065 | 528 | t->local_address_type = type; | 528 | t->local_address_type = type; |
4066 | @@ -535,15 +535,15 @@ int config_parse_l2tp_tunnel_local_address( | |||
4067 | 535 | return 0; | 535 | return 0; |
4068 | 536 | } | 536 | } |
4069 | 537 | 537 | ||
4071 | 538 | r = in_addr_from_string_auto(rvalue, &f, &a); | 538 | r = in_addr_from_string_auto(addr_or_type, &f, &a); |
4072 | 539 | if (r < 0) { | 539 | if (r < 0) { |
4073 | 540 | log_syntax(unit, LOG_WARNING, filename, line, r, | 540 | log_syntax(unit, LOG_WARNING, filename, line, r, |
4075 | 541 | "Invalid L2TP Tunnel local address specified, ignoring assignment: %s", rvalue); | 541 | "Invalid L2TP Tunnel local address \"%s\" specified, ignoring assignment: %s", addr_or_type, rvalue); |
4076 | 542 | return 0; | 542 | return 0; |
4077 | 543 | } | 543 | } |
4078 | 544 | 544 | ||
4079 | 545 | if (in_addr_is_null(f, &a)) { | 545 | if (in_addr_is_null(f, &a)) { |
4081 | 546 | log_syntax(unit, LOG_WARNING, filename, line, r, | 546 | log_syntax(unit, LOG_WARNING, filename, line, 0, |
4082 | 547 | "L2TP Tunnel local address cannot be null, ignoring assignment: %s", rvalue); | 547 | "L2TP Tunnel local address cannot be null, ignoring assignment: %s", rvalue); |
4083 | 548 | return 0; | 548 | return 0; |
4084 | 549 | } | 549 | } |
4085 | @@ -599,7 +599,7 @@ int config_parse_l2tp_tunnel_remote_address( | |||
4086 | 599 | } | 599 | } |
4087 | 600 | 600 | ||
4088 | 601 | if (in_addr_is_null(f, &a)) { | 601 | if (in_addr_is_null(f, &a)) { |
4090 | 602 | log_syntax(unit, LOG_WARNING, filename, line, r, | 602 | log_syntax(unit, LOG_WARNING, filename, line, 0, |
4091 | 603 | "L2TP Tunnel remote address cannot be null, ignoring assignment: %s", rvalue); | 603 | "L2TP Tunnel remote address cannot be null, ignoring assignment: %s", rvalue); |
4092 | 604 | return 0; | 604 | return 0; |
4093 | 605 | } | 605 | } |
4094 | diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c | |||
4095 | index b614f6b..08b5bd8 100644 | |||
4096 | --- a/src/network/networkd-address.c | |||
4097 | +++ b/src/network/networkd-address.c | |||
4098 | @@ -1230,9 +1230,13 @@ int link_request_address( | |||
4099 | 1230 | 1230 | ||
4100 | 1231 | (void) address_get(link, address, &existing); | 1231 | (void) address_get(link, address, &existing); |
4101 | 1232 | 1232 | ||
4103 | 1233 | if (address->lifetime_valid_usec == 0) | 1233 | if (address->lifetime_valid_usec == 0) { |
4104 | 1234 | if (consume_object) | ||
4105 | 1235 | address_free(address); | ||
4106 | 1236 | |||
4107 | 1234 | /* The requested address is outdated. Let's remove it. */ | 1237 | /* The requested address is outdated. Let's remove it. */ |
4108 | 1235 | return address_remove_and_drop(existing); | 1238 | return address_remove_and_drop(existing); |
4109 | 1239 | } | ||
4110 | 1236 | 1240 | ||
4111 | 1237 | if (!existing) { | 1241 | if (!existing) { |
4112 | 1238 | _cleanup_(address_freep) Address *tmp = NULL; | 1242 | _cleanup_(address_freep) Address *tmp = NULL; |
4113 | diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c | |||
4114 | index a1402d7..5fb5d96 100644 | |||
4115 | --- a/src/network/networkd-ndisc.c | |||
4116 | +++ b/src/network/networkd-ndisc.c | |||
4117 | @@ -794,31 +794,24 @@ static int ndisc_router_process_options(Link *link, sd_ndisc_router *rt) { | |||
4118 | 794 | return log_link_error_errno(link, r, "Failed to get RA option type: %m"); | 794 | return log_link_error_errno(link, r, "Failed to get RA option type: %m"); |
4119 | 795 | 795 | ||
4120 | 796 | switch (type) { | 796 | switch (type) { |
4121 | 797 | |||
4122 | 798 | case SD_NDISC_OPTION_PREFIX_INFORMATION: | 797 | case SD_NDISC_OPTION_PREFIX_INFORMATION: |
4123 | 799 | r = ndisc_router_process_prefix(link, rt); | 798 | r = ndisc_router_process_prefix(link, rt); |
4124 | 800 | if (r < 0) | ||
4125 | 801 | return r; | ||
4126 | 802 | break; | 799 | break; |
4127 | 803 | 800 | ||
4128 | 804 | case SD_NDISC_OPTION_ROUTE_INFORMATION: | 801 | case SD_NDISC_OPTION_ROUTE_INFORMATION: |
4129 | 805 | r = ndisc_router_process_route(link, rt); | 802 | r = ndisc_router_process_route(link, rt); |
4130 | 806 | if (r < 0) | ||
4131 | 807 | return r; | ||
4132 | 808 | break; | 803 | break; |
4133 | 809 | 804 | ||
4134 | 810 | case SD_NDISC_OPTION_RDNSS: | 805 | case SD_NDISC_OPTION_RDNSS: |
4135 | 811 | r = ndisc_router_process_rdnss(link, rt); | 806 | r = ndisc_router_process_rdnss(link, rt); |
4136 | 812 | if (r < 0) | ||
4137 | 813 | return r; | ||
4138 | 814 | break; | 807 | break; |
4139 | 815 | 808 | ||
4140 | 816 | case SD_NDISC_OPTION_DNSSL: | 809 | case SD_NDISC_OPTION_DNSSL: |
4141 | 817 | r = ndisc_router_process_dnssl(link, rt); | 810 | r = ndisc_router_process_dnssl(link, rt); |
4142 | 818 | if (r < 0) | ||
4143 | 819 | return r; | ||
4144 | 820 | break; | 811 | break; |
4145 | 821 | } | 812 | } |
4146 | 813 | if (r < 0 && r != -EBADMSG) | ||
4147 | 814 | return r; | ||
4148 | 822 | } | 815 | } |
4149 | 823 | } | 816 | } |
4150 | 824 | 817 | ||
4151 | @@ -1001,6 +994,10 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) { | |||
4152 | 1001 | assert(rt); | 994 | assert(rt); |
4153 | 1002 | 995 | ||
4154 | 1003 | r = sd_ndisc_router_get_address(rt, &router); | 996 | r = sd_ndisc_router_get_address(rt, &router); |
4155 | 997 | if (r == -ENODATA) { | ||
4156 | 998 | log_link_debug(link, "Received RA without router address, ignoring."); | ||
4157 | 999 | return 0; | ||
4158 | 1000 | } | ||
4159 | 1004 | if (r < 0) | 1001 | if (r < 0) |
4160 | 1005 | return log_link_error_errno(link, r, "Failed to get router address from RA: %m"); | 1002 | return log_link_error_errno(link, r, "Failed to get router address from RA: %m"); |
4161 | 1006 | 1003 | ||
4162 | @@ -1015,6 +1012,10 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) { | |||
4163 | 1015 | } | 1012 | } |
4164 | 1016 | 1013 | ||
4165 | 1017 | r = sd_ndisc_router_get_timestamp(rt, CLOCK_BOOTTIME, ×tamp_usec); | 1014 | r = sd_ndisc_router_get_timestamp(rt, CLOCK_BOOTTIME, ×tamp_usec); |
4166 | 1015 | if (r == -ENODATA) { | ||
4167 | 1016 | log_link_debug(link, "Received RA without timestamp, ignoring."); | ||
4168 | 1017 | return 0; | ||
4169 | 1018 | } | ||
4170 | 1018 | if (r < 0) | 1019 | if (r < 0) |
4171 | 1019 | return r; | 1020 | return r; |
4172 | 1020 | 1021 | ||
4173 | @@ -1061,7 +1062,7 @@ static void ndisc_handler(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router | |||
4174 | 1061 | 1062 | ||
4175 | 1062 | case SD_NDISC_EVENT_ROUTER: | 1063 | case SD_NDISC_EVENT_ROUTER: |
4176 | 1063 | r = ndisc_router_handler(link, rt); | 1064 | r = ndisc_router_handler(link, rt); |
4178 | 1064 | if (r < 0) { | 1065 | if (r < 0 && r != -EBADMSG) { |
4179 | 1065 | link_enter_failed(link); | 1066 | link_enter_failed(link); |
4180 | 1066 | return; | 1067 | return; |
4181 | 1067 | } | 1068 | } |
4182 | diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c | |||
4183 | index d1f3bab..5214a8a 100644 | |||
4184 | --- a/src/network/networkd-route.c | |||
4185 | +++ b/src/network/networkd-route.c | |||
4186 | @@ -1437,9 +1437,13 @@ int link_request_route( | |||
4187 | 1437 | 1437 | ||
4188 | 1438 | (void) route_get(link->manager, link, route, &existing); | 1438 | (void) route_get(link->manager, link, route, &existing); |
4189 | 1439 | 1439 | ||
4191 | 1440 | if (route->lifetime_usec == 0) | 1440 | if (route->lifetime_usec == 0) { |
4192 | 1441 | if (consume_object) | ||
4193 | 1442 | route_free(route); | ||
4194 | 1443 | |||
4195 | 1441 | /* The requested route is outdated. Let's remove it. */ | 1444 | /* The requested route is outdated. Let's remove it. */ |
4196 | 1442 | return route_remove_and_drop(existing); | 1445 | return route_remove_and_drop(existing); |
4197 | 1446 | } | ||
4198 | 1443 | 1447 | ||
4199 | 1444 | if (!existing) { | 1448 | if (!existing) { |
4200 | 1445 | _cleanup_(route_freep) Route *tmp = NULL; | 1449 | _cleanup_(route_freep) Route *tmp = NULL; |
4201 | diff --git a/src/nspawn/nspawn-patch-uid.c b/src/nspawn/nspawn-patch-uid.c | |||
4202 | index 1535d19..75fa931 100644 | |||
4203 | --- a/src/nspawn/nspawn-patch-uid.c | |||
4204 | +++ b/src/nspawn/nspawn-patch-uid.c | |||
4205 | @@ -181,7 +181,9 @@ static int patch_acls(int fd, const char *name, const struct stat *st, uid_t shi | |||
4206 | 181 | 181 | ||
4207 | 182 | if (S_ISDIR(st->st_mode)) { | 182 | if (S_ISDIR(st->st_mode)) { |
4208 | 183 | acl_free(acl); | 183 | acl_free(acl); |
4210 | 184 | acl_free(shifted); | 184 | |
4211 | 185 | if (shifted) | ||
4212 | 186 | acl_free(shifted); | ||
4213 | 185 | 187 | ||
4214 | 186 | acl = shifted = NULL; | 188 | acl = shifted = NULL; |
4215 | 187 | 189 | ||
4216 | diff --git a/src/partition/growfs.c b/src/partition/growfs.c | |||
4217 | index 8a04071..6280a24 100644 | |||
4218 | --- a/src/partition/growfs.c | |||
4219 | +++ b/src/partition/growfs.c | |||
4220 | @@ -3,12 +3,17 @@ | |||
4221 | 3 | #include <errno.h> | 3 | #include <errno.h> |
4222 | 4 | #include <fcntl.h> | 4 | #include <fcntl.h> |
4223 | 5 | #include <getopt.h> | 5 | #include <getopt.h> |
4224 | 6 | #include <linux/btrfs.h> | ||
4225 | 7 | #include <linux/magic.h> | 6 | #include <linux/magic.h> |
4226 | 8 | #include <sys/ioctl.h> | 7 | #include <sys/ioctl.h> |
4227 | 9 | #include <sys/mount.h> | 8 | #include <sys/mount.h> |
4228 | 10 | #include <sys/types.h> | 9 | #include <sys/types.h> |
4229 | 11 | #include <sys/vfs.h> | 10 | #include <sys/vfs.h> |
4230 | 11 | /* This needs to be included after sys/mount.h, as since [0] linux/btrfs.h | ||
4231 | 12 | * includes linux/fs.h causing build errors | ||
4232 | 13 | * See: https://github.com/systemd/systemd/issues/8507 | ||
4233 | 14 | * [0] https://github.com/torvalds/linux/commit/a28135303a669917002f569aecebd5758263e4aa | ||
4234 | 15 | */ | ||
4235 | 16 | #include <linux/btrfs.h> | ||
4236 | 12 | 17 | ||
4237 | 13 | #include "sd-device.h" | 18 | #include "sd-device.h" |
4238 | 14 | 19 | ||
4239 | diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c | |||
4240 | index b07761a..2d1caf7 100644 | |||
4241 | --- a/src/resolve/resolvectl.c | |||
4242 | +++ b/src/resolve/resolvectl.c | |||
4243 | @@ -1933,15 +1933,15 @@ static int status_global(sd_bus *bus, StatusMode mode, bool *empty_line) { | |||
4244 | 1933 | return table_log_add_error(r); | 1933 | return table_log_add_error(r); |
4245 | 1934 | } | 1934 | } |
4246 | 1935 | 1935 | ||
4248 | 1936 | r = dump_list(table, "DNS Servers:", global_info.dns_ex ?: global_info.dns); | 1936 | r = dump_list(table, "DNS Servers", global_info.dns_ex ?: global_info.dns); |
4249 | 1937 | if (r < 0) | 1937 | if (r < 0) |
4250 | 1938 | return r; | 1938 | return r; |
4251 | 1939 | 1939 | ||
4253 | 1940 | r = dump_list(table, "Fallback DNS Servers:", global_info.fallback_dns_ex ?: global_info.fallback_dns); | 1940 | r = dump_list(table, "Fallback DNS Servers", global_info.fallback_dns_ex ?: global_info.fallback_dns); |
4254 | 1941 | if (r < 0) | 1941 | if (r < 0) |
4255 | 1942 | return r; | 1942 | return r; |
4256 | 1943 | 1943 | ||
4258 | 1944 | r = dump_list(table, "DNS Domain:", global_info.domains); | 1944 | r = dump_list(table, "DNS Domain", global_info.domains); |
4259 | 1945 | if (r < 0) | 1945 | if (r < 0) |
4260 | 1946 | return r; | 1946 | return r; |
4261 | 1947 | 1947 | ||
4262 | diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c | |||
4263 | index 4f74449..88830fb 100644 | |||
4264 | --- a/src/resolve/resolved-dns-scope.c | |||
4265 | +++ b/src/resolve/resolved-dns-scope.c | |||
4266 | @@ -474,7 +474,8 @@ static int dns_scope_socket( | |||
4267 | 474 | * host result in EHOSTUNREACH, since Linux won't send the packets out of the specified | 474 | * host result in EHOSTUNREACH, since Linux won't send the packets out of the specified |
4268 | 475 | * interface, but delivers them directly to the local socket. */ | 475 | * interface, but delivers them directly to the local socket. */ |
4269 | 476 | if (s->link && | 476 | if (s->link && |
4271 | 477 | !manager_find_link_address(s->manager, sa.sa.sa_family, sockaddr_in_addr(&sa.sa))) { | 477 | !manager_find_link_address(s->manager, sa.sa.sa_family, sockaddr_in_addr(&sa.sa)) && |
4272 | 478 | in_addr_is_localhost(sa.sa.sa_family, sockaddr_in_addr(&sa.sa)) == 0) { | ||
4273 | 478 | r = socket_bind_to_ifindex(fd, ifindex); | 479 | r = socket_bind_to_ifindex(fd, ifindex); |
4274 | 479 | if (r < 0) | 480 | if (r < 0) |
4275 | 480 | return r; | 481 | return r; |
4276 | diff --git a/src/resolve/resolved-dns-search-domain.c b/src/resolve/resolved-dns-search-domain.c | |||
4277 | index bcbb275..647c0bd 100644 | |||
4278 | --- a/src/resolve/resolved-dns-search-domain.c | |||
4279 | +++ b/src/resolve/resolved-dns-search-domain.c | |||
4280 | @@ -52,7 +52,7 @@ int dns_search_domain_new( | |||
4281 | 52 | l->n_search_domains++; | 52 | l->n_search_domains++; |
4282 | 53 | break; | 53 | break; |
4283 | 54 | 54 | ||
4285 | 55 | case DNS_SERVER_SYSTEM: | 55 | case DNS_SEARCH_DOMAIN_SYSTEM: |
4286 | 56 | LIST_APPEND(domains, m->search_domains, d); | 56 | LIST_APPEND(domains, m->search_domains, d); |
4287 | 57 | m->n_search_domains++; | 57 | m->n_search_domains++; |
4288 | 58 | break; | 58 | break; |
4289 | diff --git a/src/resolve/resolved-dns-server.h b/src/resolve/resolved-dns-server.h | |||
4290 | index be9efb0..f939b53 100644 | |||
4291 | --- a/src/resolve/resolved-dns-server.h | |||
4292 | +++ b/src/resolve/resolved-dns-server.h | |||
4293 | @@ -44,8 +44,8 @@ typedef enum DnsServerFeatureLevel { | |||
4294 | 44 | #define DNS_SERVER_FEATURE_LEVEL_IS_DNSSEC(x) ((x) >= DNS_SERVER_FEATURE_LEVEL_DO) | 44 | #define DNS_SERVER_FEATURE_LEVEL_IS_DNSSEC(x) ((x) >= DNS_SERVER_FEATURE_LEVEL_DO) |
4295 | 45 | #define DNS_SERVER_FEATURE_LEVEL_IS_UDP(x) IN_SET(x, DNS_SERVER_FEATURE_LEVEL_UDP, DNS_SERVER_FEATURE_LEVEL_EDNS0, DNS_SERVER_FEATURE_LEVEL_DO) | 45 | #define DNS_SERVER_FEATURE_LEVEL_IS_UDP(x) IN_SET(x, DNS_SERVER_FEATURE_LEVEL_UDP, DNS_SERVER_FEATURE_LEVEL_EDNS0, DNS_SERVER_FEATURE_LEVEL_DO) |
4296 | 46 | 46 | ||
4299 | 47 | const char* dns_server_feature_level_to_string(int i) _const_; | 47 | const char* dns_server_feature_level_to_string(DnsServerFeatureLevel i) _const_; |
4300 | 48 | int dns_server_feature_level_from_string(const char *s) _pure_; | 48 | DnsServerFeatureLevel dns_server_feature_level_from_string(const char *s) _pure_; |
4301 | 49 | 49 | ||
4302 | 50 | struct DnsServer { | 50 | struct DnsServer { |
4303 | 51 | Manager *manager; | 51 | Manager *manager; |
4304 | diff --git a/src/resolve/resolved-varlink.c b/src/resolve/resolved-varlink.c | |||
4305 | index 8ba5eb9..f878d9e 100644 | |||
4306 | --- a/src/resolve/resolved-varlink.c | |||
4307 | +++ b/src/resolve/resolved-varlink.c | |||
4308 | @@ -243,7 +243,7 @@ static void vl_method_resolve_hostname_complete(DnsQuery *query) { | |||
4309 | 243 | JSON_BUILD_PAIR("flags", JSON_BUILD_INTEGER(dns_query_reply_flags_make(q))))); | 243 | JSON_BUILD_PAIR("flags", JSON_BUILD_INTEGER(dns_query_reply_flags_make(q))))); |
4310 | 244 | finish: | 244 | finish: |
4311 | 245 | if (r < 0) { | 245 | if (r < 0) { |
4313 | 246 | log_error_errno(r, "Failed to send hostname reply: %m"); | 246 | log_full_errno(ERRNO_IS_DISCONNECT(r) ? LOG_DEBUG : LOG_ERR, r, "Failed to send hostname reply: %m"); |
4314 | 247 | r = varlink_error_errno(q->varlink_request, r); | 247 | r = varlink_error_errno(q->varlink_request, r); |
4315 | 248 | } | 248 | } |
4316 | 249 | } | 249 | } |
4317 | @@ -462,7 +462,7 @@ static void vl_method_resolve_address_complete(DnsQuery *query) { | |||
4318 | 462 | JSON_BUILD_PAIR("flags", JSON_BUILD_INTEGER(dns_query_reply_flags_make(q))))); | 462 | JSON_BUILD_PAIR("flags", JSON_BUILD_INTEGER(dns_query_reply_flags_make(q))))); |
4319 | 463 | finish: | 463 | finish: |
4320 | 464 | if (r < 0) { | 464 | if (r < 0) { |
4322 | 465 | log_error_errno(r, "Failed to send address reply: %m"); | 465 | log_full_errno(ERRNO_IS_DISCONNECT(r) ? LOG_DEBUG : LOG_ERR, r, "Failed to send address reply: %m"); |
4323 | 466 | r = varlink_error_errno(q->varlink_request, r); | 466 | r = varlink_error_errno(q->varlink_request, r); |
4324 | 467 | } | 467 | } |
4325 | 468 | } | 468 | } |
4326 | diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c | |||
4327 | index 14bcbf6..ceb7012 100644 | |||
4328 | --- a/src/shared/bootspec.c | |||
4329 | +++ b/src/shared/bootspec.c | |||
4330 | @@ -740,9 +740,11 @@ static int boot_entry_load_unified( | |||
4331 | 740 | if (!tmp.title) | 740 | if (!tmp.title) |
4332 | 741 | return log_oom(); | 741 | return log_oom(); |
4333 | 742 | 742 | ||
4337 | 743 | tmp.sort_key = strdup(good_sort_key); | 743 | if (good_sort_key) { |
4338 | 744 | if (!tmp.sort_key) | 744 | tmp.sort_key = strdup(good_sort_key); |
4339 | 745 | return log_oom(); | 745 | if (!tmp.sort_key) |
4340 | 746 | return log_oom(); | ||
4341 | 747 | } | ||
4342 | 746 | 748 | ||
4343 | 747 | if (good_version) { | 749 | if (good_version) { |
4344 | 748 | tmp.version = strdup(good_version); | 750 | tmp.version = strdup(good_version); |
4345 | diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c | |||
4346 | index b850a28..922011e 100644 | |||
4347 | --- a/src/shared/bus-unit-util.c | |||
4348 | +++ b/src/shared/bus-unit-util.c | |||
4349 | @@ -2142,6 +2142,9 @@ static int bus_append_scope_property(sd_bus_message *m, const char *field, const | |||
4350 | 2142 | if (STR_IN_SET(field, "User", "Group")) | 2142 | if (STR_IN_SET(field, "User", "Group")) |
4351 | 2143 | return bus_append_string(m, field, eq); | 2143 | return bus_append_string(m, field, eq); |
4352 | 2144 | 2144 | ||
4353 | 2145 | if (streq(field, "OOMPolicy")) | ||
4354 | 2146 | return bus_append_string(m, field, eq); | ||
4355 | 2147 | |||
4356 | 2145 | return 0; | 2148 | return 0; |
4357 | 2146 | } | 2149 | } |
4358 | 2147 | 2150 | ||
4359 | diff --git a/src/shared/creds-util.c b/src/shared/creds-util.c | |||
4360 | index ecf90e2..eab0ca1 100644 | |||
4361 | --- a/src/shared/creds-util.c | |||
4362 | +++ b/src/shared/creds-util.c | |||
4363 | @@ -9,6 +9,7 @@ | |||
4364 | 9 | #include "sd-id128.h" | 9 | #include "sd-id128.h" |
4365 | 10 | 10 | ||
4366 | 11 | #include "blockdev-util.h" | 11 | #include "blockdev-util.h" |
4367 | 12 | #include "capability-util.h" | ||
4368 | 12 | #include "chattr-util.h" | 13 | #include "chattr-util.h" |
4369 | 13 | #include "creds-util.h" | 14 | #include "creds-util.h" |
4370 | 14 | #include "def.h" | 15 | #include "def.h" |
4371 | @@ -173,10 +174,15 @@ static int make_credential_host_secret( | |||
4372 | 173 | assert(dfd >= 0); | 174 | assert(dfd >= 0); |
4373 | 174 | assert(fn); | 175 | assert(fn); |
4374 | 175 | 176 | ||
4376 | 176 | fd = openat(dfd, ".", O_CLOEXEC|O_WRONLY|O_TMPFILE, 0400); | 177 | /* For non-root users creating a temporary file using the openat(2) over "." will fail later, in the |
4377 | 178 | * linkat(2) step at the end. The reason is that linkat(2) requires the CAP_DAC_READ_SEARCH | ||
4378 | 179 | * capability when it uses the AT_EMPTY_PATH flag. */ | ||
4379 | 180 | if (have_effective_cap(CAP_DAC_READ_SEARCH) > 0) { | ||
4380 | 181 | fd = openat(dfd, ".", O_CLOEXEC|O_WRONLY|O_TMPFILE, 0400); | ||
4381 | 182 | if (fd < 0) | ||
4382 | 183 | log_debug_errno(errno, "Failed to create temporary credential file with O_TMPFILE, proceeding without: %m"); | ||
4383 | 184 | } | ||
4384 | 177 | if (fd < 0) { | 185 | if (fd < 0) { |
4385 | 178 | log_debug_errno(errno, "Failed to create temporary credential file with O_TMPFILE, proceeding without: %m"); | ||
4386 | 179 | |||
4387 | 180 | if (asprintf(&t, "credential.secret.%016" PRIx64, random_u64()) < 0) | 186 | if (asprintf(&t, "credential.secret.%016" PRIx64, random_u64()) < 0) |
4388 | 181 | return -ENOMEM; | 187 | return -ENOMEM; |
4389 | 182 | 188 | ||
4390 | @@ -602,24 +608,14 @@ int encrypt_credential_and_warn( | |||
4391 | 602 | 608 | ||
4392 | 603 | #if HAVE_TPM2 | 609 | #if HAVE_TPM2 |
4393 | 604 | bool try_tpm2; | 610 | bool try_tpm2; |
4408 | 605 | if (sd_id128_equal(with_key, _CRED_AUTO)) { | 611 | if (sd_id128_in_set(with_key, _CRED_AUTO, _CRED_AUTO_INITRD)) { |
4409 | 606 | /* If automatic mode is selected and we are running in a container, let's not try TPM2. OTOH | 612 | /* If automatic mode is selected lets see if a TPM2 it is present. If we are running in a |
4410 | 607 | * if user picks TPM2 explicitly, let's always honour the request and try. */ | 613 | * container tpm2_support will detect this, and will return a different flag combination of |
4411 | 608 | 614 | * TPM2_SUPPORT_FULL, effectively skipping the use of TPM2 when inside one. */ | |
4398 | 609 | r = detect_container(); | ||
4399 | 610 | if (r < 0) | ||
4400 | 611 | log_debug_errno(r, "Failed to determine whether we are running in a container, ignoring: %m"); | ||
4401 | 612 | else if (r > 0) | ||
4402 | 613 | log_debug("Running in container, not attempting to use TPM2."); | ||
4403 | 614 | |||
4404 | 615 | try_tpm2 = r <= 0; | ||
4405 | 616 | } else if (sd_id128_equal(with_key, _CRED_AUTO_INITRD)) { | ||
4406 | 617 | /* If automatic mode for initrds is selected, we'll use the TPM2 key if the firmware does it, | ||
4407 | 618 | * otherwise we'll use a fixed key */ | ||
4412 | 619 | 615 | ||
4414 | 620 | try_tpm2 = efi_has_tpm2(); | 616 | try_tpm2 = tpm2_support() == TPM2_SUPPORT_FULL; |
4415 | 621 | if (!try_tpm2) | 617 | if (!try_tpm2) |
4417 | 622 | log_debug("Firmware lacks TPM2 support, not attempting to use TPM2."); | 618 | log_debug("System lacks TPM2 support or running in a container, not attempting to use TPM2."); |
4418 | 623 | } else | 619 | } else |
4419 | 624 | try_tpm2 = sd_id128_in_set(with_key, | 620 | try_tpm2 = sd_id128_in_set(with_key, |
4420 | 625 | CRED_AES256_GCM_BY_TPM2_HMAC, | 621 | CRED_AES256_GCM_BY_TPM2_HMAC, |
4421 | @@ -660,7 +656,7 @@ int encrypt_credential_and_warn( | |||
4422 | 660 | &tpm2_primary_alg); | 656 | &tpm2_primary_alg); |
4423 | 661 | if (r < 0) { | 657 | if (r < 0) { |
4424 | 662 | if (sd_id128_equal(with_key, _CRED_AUTO_INITRD)) | 658 | if (sd_id128_equal(with_key, _CRED_AUTO_INITRD)) |
4426 | 663 | log_warning("Firmware reported a TPM2 being present and used, but we didn't manage to talk to it. Credential will be refused if SecureBoot is enabled."); | 659 | log_warning("TPM2 present and used, but we didn't manage to talk to it. Credential will be refused if SecureBoot is enabled."); |
4427 | 664 | else if (!sd_id128_equal(with_key, _CRED_AUTO)) | 660 | else if (!sd_id128_equal(with_key, _CRED_AUTO)) |
4428 | 665 | return r; | 661 | return r; |
4429 | 666 | 662 | ||
4430 | diff --git a/src/shared/generator.c b/src/shared/generator.c | |||
4431 | index 5d019f4..85a6316 100644 | |||
4432 | --- a/src/shared/generator.c | |||
4433 | +++ b/src/shared/generator.c | |||
4434 | @@ -467,6 +467,14 @@ int generator_hook_up_mkfs( | |||
4435 | 467 | 467 | ||
4436 | 468 | log_debug("Creating %s", unit_file); | 468 | log_debug("Creating %s", unit_file); |
4437 | 469 | 469 | ||
4438 | 470 | const char *fsck_unit; | ||
4439 | 471 | if (in_initrd() && path_equal(where, "/sysroot")) | ||
4440 | 472 | fsck_unit = SPECIAL_FSCK_ROOT_SERVICE; | ||
4441 | 473 | else if (in_initrd() && path_equal(where, "/sysusr/usr")) | ||
4442 | 474 | fsck_unit = SPECIAL_FSCK_USR_SERVICE; | ||
4443 | 475 | else | ||
4444 | 476 | fsck_unit = "systemd-fsck@%i.service"; | ||
4445 | 477 | |||
4446 | 470 | escaped = cescape(node); | 478 | escaped = cescape(node); |
4447 | 471 | if (!escaped) | 479 | if (!escaped) |
4448 | 472 | return log_oom(); | 480 | return log_oom(); |
4449 | @@ -492,7 +500,7 @@ int generator_hook_up_mkfs( | |||
4450 | 492 | "After=%%i.device\n" | 500 | "After=%%i.device\n" |
4451 | 493 | /* fsck might or might not be used, so let's be safe and order | 501 | /* fsck might or might not be used, so let's be safe and order |
4452 | 494 | * ourselves before both systemd-fsck@.service and the mount unit. */ | 502 | * ourselves before both systemd-fsck@.service and the mount unit. */ |
4454 | 495 | "Before=shutdown.target systemd-fsck@%%i.service %s\n" | 503 | "Before=shutdown.target %s %s\n" |
4455 | 496 | "\n" | 504 | "\n" |
4456 | 497 | "[Service]\n" | 505 | "[Service]\n" |
4457 | 498 | "Type=oneshot\n" | 506 | "Type=oneshot\n" |
4458 | @@ -500,6 +508,7 @@ int generator_hook_up_mkfs( | |||
4459 | 500 | "ExecStart="SYSTEMD_MAKEFS_PATH " %s %s\n" | 508 | "ExecStart="SYSTEMD_MAKEFS_PATH " %s %s\n" |
4460 | 501 | "TimeoutSec=0\n", | 509 | "TimeoutSec=0\n", |
4461 | 502 | program_invocation_short_name, | 510 | program_invocation_short_name, |
4462 | 511 | fsck_unit, | ||
4463 | 503 | where_unit, | 512 | where_unit, |
4464 | 504 | type, | 513 | type, |
4465 | 505 | escaped); | 514 | escaped); |
4466 | diff --git a/src/shared/install.c b/src/shared/install.c | |||
4467 | index 834a1c5..2c030b8 100644 | |||
4468 | --- a/src/shared/install.c | |||
4469 | +++ b/src/shared/install.c | |||
4470 | @@ -284,6 +284,9 @@ InstallChangeType install_changes_add( | |||
4471 | 284 | assert(!changes == !n_changes); | 284 | assert(!changes == !n_changes); |
4472 | 285 | assert(INSTALL_CHANGE_TYPE_VALID(type)); | 285 | assert(INSTALL_CHANGE_TYPE_VALID(type)); |
4473 | 286 | 286 | ||
4474 | 287 | /* Message formatting requires <path> to be set. */ | ||
4475 | 288 | assert(path); | ||
4476 | 289 | |||
4477 | 287 | /* Register a change or error. Note that the return value may be the error | 290 | /* Register a change or error. Note that the return value may be the error |
4478 | 288 | * that was passed in, or -ENOMEM generated internally. */ | 291 | * that was passed in, or -ENOMEM generated internally. */ |
4479 | 289 | 292 | ||
4480 | @@ -339,7 +342,9 @@ void install_changes_dump(int r, const char *verb, const InstallChange *changes, | |||
4481 | 339 | assert(verb || r >= 0); | 342 | assert(verb || r >= 0); |
4482 | 340 | 343 | ||
4483 | 341 | for (size_t i = 0; i < n_changes; i++) { | 344 | for (size_t i = 0; i < n_changes; i++) { |
4485 | 342 | assert(verb || changes[i].type >= 0); | 345 | if (changes[i].type < 0) |
4486 | 346 | assert(verb); | ||
4487 | 347 | assert(changes[i].path); | ||
4488 | 343 | 348 | ||
4489 | 344 | /* When making changes here, make sure to also change install_error() in dbus-manager.c. */ | 349 | /* When making changes here, make sure to also change install_error() in dbus-manager.c. */ |
4490 | 345 | 350 | ||
4491 | @@ -376,7 +381,7 @@ void install_changes_dump(int r, const char *verb, const InstallChange *changes, | |||
4492 | 376 | break; | 381 | break; |
4493 | 377 | case INSTALL_CHANGE_AUXILIARY_FAILED: | 382 | case INSTALL_CHANGE_AUXILIARY_FAILED: |
4494 | 378 | if (!quiet) | 383 | if (!quiet) |
4496 | 379 | log_warning("Failed to enable auxiliary unit %s, ignoring.", changes[i].source); | 384 | log_warning("Failed to enable auxiliary unit %s, ignoring.", changes[i].path); |
4497 | 380 | break; | 385 | break; |
4498 | 381 | case -EEXIST: | 386 | case -EEXIST: |
4499 | 382 | if (changes[i].source) | 387 | if (changes[i].source) |
4500 | @@ -2126,7 +2131,7 @@ static int install_context_apply( | |||
4501 | 2126 | q = install_info_traverse(ctx, lp, i, flags, NULL); | 2131 | q = install_info_traverse(ctx, lp, i, flags, NULL); |
4502 | 2127 | if (q < 0) { | 2132 | if (q < 0) { |
4503 | 2128 | if (i->auxiliary) { | 2133 | if (i->auxiliary) { |
4505 | 2129 | q = install_changes_add(changes, n_changes, INSTALL_CHANGE_AUXILIARY_FAILED, NULL, i->name); | 2134 | q = install_changes_add(changes, n_changes, INSTALL_CHANGE_AUXILIARY_FAILED, i->name, NULL); |
4506 | 2130 | if (q < 0) | 2135 | if (q < 0) |
4507 | 2131 | return q; | 2136 | return q; |
4508 | 2132 | continue; | 2137 | continue; |
4509 | diff --git a/src/shared/install.h b/src/shared/install.h | |||
4510 | index 9bb412b..0abc738 100644 | |||
4511 | --- a/src/shared/install.h | |||
4512 | +++ b/src/shared/install.h | |||
4513 | @@ -197,7 +197,7 @@ int unit_file_exists(LookupScope scope, const LookupPaths *paths, const char *na | |||
4514 | 197 | int unit_file_get_list(LookupScope scope, const char *root_dir, Hashmap *h, char **states, char **patterns); | 197 | int unit_file_get_list(LookupScope scope, const char *root_dir, Hashmap *h, char **states, char **patterns); |
4515 | 198 | Hashmap* unit_file_list_free(Hashmap *h); | 198 | Hashmap* unit_file_list_free(Hashmap *h); |
4516 | 199 | 199 | ||
4518 | 200 | InstallChangeType install_changes_add(InstallChange **changes, size_t *n_changes, int type, const char *path, const char *source); | 200 | InstallChangeType install_changes_add(InstallChange **changes, size_t *n_changes, InstallChangeType type, const char *path, const char *source); |
4519 | 201 | void install_changes_free(InstallChange *changes, size_t n_changes); | 201 | void install_changes_free(InstallChange *changes, size_t n_changes); |
4520 | 202 | void install_changes_dump(int r, const char *verb, const InstallChange *changes, size_t n_changes, bool quiet); | 202 | void install_changes_dump(int r, const char *verb, const InstallChange *changes, size_t n_changes, bool quiet); |
4521 | 203 | 203 | ||
4522 | @@ -224,7 +224,7 @@ UnitFileState unit_file_state_from_string(const char *s) _pure_; | |||
4523 | 224 | /* from_string conversion is unreliable because of the overlap between -EPERM and -1 for error. */ | 224 | /* from_string conversion is unreliable because of the overlap between -EPERM and -1 for error. */ |
4524 | 225 | 225 | ||
4525 | 226 | const char *install_change_type_to_string(InstallChangeType t) _const_; | 226 | const char *install_change_type_to_string(InstallChangeType t) _const_; |
4527 | 227 | int install_change_type_from_string(const char *s) _pure_; | 227 | InstallChangeType install_change_type_from_string(const char *s) _pure_; |
4528 | 228 | 228 | ||
4529 | 229 | const char *unit_file_preset_mode_to_string(UnitFilePresetMode m) _const_; | 229 | const char *unit_file_preset_mode_to_string(UnitFilePresetMode m) _const_; |
4530 | 230 | UnitFilePresetMode unit_file_preset_mode_from_string(const char *s) _pure_; | 230 | UnitFilePresetMode unit_file_preset_mode_from_string(const char *s) _pure_; |
4531 | diff --git a/src/shared/mount-setup.c b/src/shared/mount-setup.c | |||
4532 | index 975c027..6882b62 100644 | |||
4533 | --- a/src/shared/mount-setup.c | |||
4534 | +++ b/src/shared/mount-setup.c | |||
4535 | @@ -102,8 +102,10 @@ static const MountPoint mount_table[] = { | |||
4536 | 102 | cg_is_legacy_wanted, MNT_IN_CONTAINER }, | 102 | cg_is_legacy_wanted, MNT_IN_CONTAINER }, |
4537 | 103 | { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd", MS_NOSUID|MS_NOEXEC|MS_NODEV, | 103 | { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd", MS_NOSUID|MS_NOEXEC|MS_NODEV, |
4538 | 104 | cg_is_legacy_wanted, MNT_FATAL|MNT_IN_CONTAINER }, | 104 | cg_is_legacy_wanted, MNT_FATAL|MNT_IN_CONTAINER }, |
4539 | 105 | #if ENABLE_PSTORE | ||
4540 | 105 | { "pstore", "/sys/fs/pstore", "pstore", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, | 106 | { "pstore", "/sys/fs/pstore", "pstore", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, |
4541 | 106 | NULL, MNT_NONE }, | 107 | NULL, MNT_NONE }, |
4542 | 108 | #endif | ||
4543 | 107 | #if ENABLE_EFI | 109 | #if ENABLE_EFI |
4544 | 108 | { "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, | 110 | { "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, |
4545 | 109 | is_efi_boot, MNT_NONE }, | 111 | is_efi_boot, MNT_NONE }, |
4546 | diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c | |||
4547 | index efc066c..1632132 100644 | |||
4548 | --- a/src/shared/sleep-config.c | |||
4549 | +++ b/src/shared/sleep-config.c | |||
4550 | @@ -116,7 +116,7 @@ int parse_sleep_config(SleepConfig **ret_sleep_config) { | |||
4551 | 116 | if (sc->hibernate_delay_sec == 0) | 116 | if (sc->hibernate_delay_sec == 0) |
4552 | 117 | sc->hibernate_delay_sec = 2 * USEC_PER_HOUR; | 117 | sc->hibernate_delay_sec = 2 * USEC_PER_HOUR; |
4553 | 118 | 118 | ||
4555 | 119 | /* ensure values set for all required fields */ | 119 | /* Ensure values set for all required fields */ |
4556 | 120 | if (!sc->states[SLEEP_SUSPEND] || !sc->modes[SLEEP_HIBERNATE] | 120 | if (!sc->states[SLEEP_SUSPEND] || !sc->modes[SLEEP_HIBERNATE] |
4557 | 121 | || !sc->states[SLEEP_HIBERNATE] || !sc->modes[SLEEP_HYBRID_SLEEP] || !sc->states[SLEEP_HYBRID_SLEEP]) | 121 | || !sc->states[SLEEP_HIBERNATE] || !sc->modes[SLEEP_HYBRID_SLEEP] || !sc->states[SLEEP_HYBRID_SLEEP]) |
4558 | 122 | return log_oom(); | 122 | return log_oom(); |
4559 | @@ -172,11 +172,11 @@ static int read_battery_capacity_percentage(sd_device *dev) { | |||
4560 | 172 | 172 | ||
4561 | 173 | r = sd_device_get_property_value(dev, "POWER_SUPPLY_CAPACITY", &power_supply_capacity); | 173 | r = sd_device_get_property_value(dev, "POWER_SUPPLY_CAPACITY", &power_supply_capacity); |
4562 | 174 | if (r < 0) | 174 | if (r < 0) |
4564 | 175 | return log_device_debug_errno(dev, r, "Failed to read battery capacity: %m"); | 175 | return log_device_debug_errno(dev, r, "Failed to get property POWER_SUPPLY_CAPACITY: %m"); |
4565 | 176 | 176 | ||
4566 | 177 | r = safe_atoi(power_supply_capacity, &battery_capacity); | 177 | r = safe_atoi(power_supply_capacity, &battery_capacity); |
4567 | 178 | if (r < 0) | 178 | if (r < 0) |
4569 | 179 | return log_device_debug_errno(dev, r, "Failed to parse battery capacity: %m"); | 179 | return log_device_debug_errno(dev, r, "Failed to parse property POWER_SUPPLY_CAPACITY: %m"); |
4570 | 180 | 180 | ||
4571 | 181 | if (battery_capacity < 0 || battery_capacity > 100) | 181 | if (battery_capacity < 0 || battery_capacity > 100) |
4572 | 182 | return log_device_debug_errno(dev, SYNTHETIC_ERRNO(ERANGE), "Invalid battery capacity"); | 182 | return log_device_debug_errno(dev, SYNTHETIC_ERRNO(ERANGE), "Invalid battery capacity"); |
4573 | @@ -184,14 +184,14 @@ static int read_battery_capacity_percentage(sd_device *dev) { | |||
4574 | 184 | return battery_capacity; | 184 | return battery_capacity; |
4575 | 185 | } | 185 | } |
4576 | 186 | 186 | ||
4578 | 187 | /* If battery percentage capacity is less than equal to 5% return success */ | 187 | /* If battery percentage capacity is <= 5%, return success */ |
4579 | 188 | int battery_is_low(void) { | 188 | int battery_is_low(void) { |
4580 | 189 | _cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL; | 189 | _cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL; |
4581 | 190 | sd_device *dev; | 190 | sd_device *dev; |
4582 | 191 | int r; | 191 | int r; |
4583 | 192 | 192 | ||
4584 | 193 | /* We have not used battery capacity_level since value is set to full | 193 | /* We have not used battery capacity_level since value is set to full |
4586 | 194 | * or Normal in case acpi is not working properly. In case of no battery | 194 | * or Normal in case ACPI is not working properly. In case of no battery |
4587 | 195 | * 0 will be returned and system will be suspended for 1st cycle then hibernated */ | 195 | * 0 will be returned and system will be suspended for 1st cycle then hibernated */ |
4588 | 196 | 196 | ||
4589 | 197 | r = battery_enumerator_new(&e); | 197 | r = battery_enumerator_new(&e); |
4590 | @@ -234,14 +234,12 @@ int fetch_batteries_capacity_by_name(Hashmap **ret) { | |||
4591 | 234 | int battery_capacity; | 234 | int battery_capacity; |
4592 | 235 | 235 | ||
4593 | 236 | battery_capacity = r = read_battery_capacity_percentage(dev); | 236 | battery_capacity = r = read_battery_capacity_percentage(dev); |
4596 | 237 | if (r < 0) { | 237 | if (r < 0) |
4595 | 238 | log_device_debug_errno(dev, r, "Failed to get battery capacity, ignoring: %m"); | ||
4597 | 239 | continue; | 238 | continue; |
4598 | 240 | } | ||
4599 | 241 | 239 | ||
4600 | 242 | r = sd_device_get_property_value(dev, "POWER_SUPPLY_NAME", &battery_name); | 240 | r = sd_device_get_property_value(dev, "POWER_SUPPLY_NAME", &battery_name); |
4601 | 243 | if (r < 0) { | 241 | if (r < 0) { |
4603 | 244 | log_device_debug_errno(dev, r, "Failed to read battery name, ignoring: %m"); | 242 | log_device_debug_errno(dev, r, "Failed to get POWER_SUPPLY_NAME property, ignoring: %m"); |
4604 | 245 | continue; | 243 | continue; |
4605 | 246 | } | 244 | } |
4606 | 247 | 245 | ||
4607 | @@ -272,11 +270,11 @@ static int get_battery_identifier(sd_device *dev, const char *property, struct s | |||
4608 | 272 | 270 | ||
4609 | 273 | r = sd_device_get_property_value(dev, property, &x); | 271 | r = sd_device_get_property_value(dev, property, &x); |
4610 | 274 | if (r == -ENOENT) | 272 | if (r == -ENOENT) |
4612 | 275 | log_device_debug_errno(dev, r, "battery device property %s is unavailable, ignoring: %m", property); | 273 | log_device_debug_errno(dev, r, "Battery device property %s is unavailable, ignoring: %m", property); |
4613 | 276 | else if (r < 0) | 274 | else if (r < 0) |
4615 | 277 | return log_device_debug_errno(dev, r, "Failed to read battery device property %s: %m", property); | 275 | return log_device_debug_errno(dev, r, "Failed to get battery device property %s: %m", property); |
4616 | 278 | else if (isempty(x)) | 276 | else if (isempty(x)) |
4618 | 279 | log_device_debug(dev, "battery device property '%s' is null.", property); | 277 | log_device_debug(dev, "Battery device property '%s' is empty.", property); |
4619 | 280 | else | 278 | else |
4620 | 281 | siphash24_compress_string(x, state); | 279 | siphash24_compress_string(x, state); |
4621 | 282 | 280 | ||
4622 | @@ -319,7 +317,7 @@ static int get_system_battery_identifier_hash(sd_device *dev, uint64_t *ret) { | |||
4623 | 319 | return 0; | 317 | return 0; |
4624 | 320 | } | 318 | } |
4625 | 321 | 319 | ||
4627 | 322 | /* battery percentage discharge rate per hour is in range 1-199 then return success */ | 320 | /* Return success if battery percentage discharge rate per hour is in the range 1–199 */ |
4628 | 323 | static bool battery_discharge_rate_is_valid(int battery_discharge_rate) { | 321 | static bool battery_discharge_rate_is_valid(int battery_discharge_rate) { |
4629 | 324 | return battery_discharge_rate > 0 && battery_discharge_rate < 200; | 322 | return battery_discharge_rate > 0 && battery_discharge_rate < 200; |
4630 | 325 | } | 323 | } |
4631 | @@ -470,7 +468,7 @@ int estimate_battery_discharge_rate_per_hour( | |||
4632 | 470 | return 0; | 468 | return 0; |
4633 | 471 | } | 469 | } |
4634 | 472 | 470 | ||
4636 | 473 | /* calculate the suspend interval for each battery and then return the sum of it */ | 471 | /* Calculate the suspend interval for each battery and then return their sum */ |
4637 | 474 | int get_total_suspend_interval(Hashmap *last_capacity, usec_t *ret) { | 472 | int get_total_suspend_interval(Hashmap *last_capacity, usec_t *ret) { |
4638 | 475 | _cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL; | 473 | _cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL; |
4639 | 476 | usec_t total_suspend_interval = 0; | 474 | usec_t total_suspend_interval = 0; |
4640 | @@ -495,7 +493,7 @@ int get_total_suspend_interval(Hashmap *last_capacity, usec_t *ret) { | |||
4641 | 495 | continue; | 493 | continue; |
4642 | 496 | } | 494 | } |
4643 | 497 | 495 | ||
4645 | 498 | battery_last_capacity = PTR_TO_CAPACITY(hashmap_get(last_capacity, battery_name)); | 496 | battery_last_capacity = get_capacity_by_name(last_capacity, battery_name); |
4646 | 499 | if (battery_last_capacity <= 0) | 497 | if (battery_last_capacity <= 0) |
4647 | 500 | continue; | 498 | continue; |
4648 | 501 | 499 | ||
4649 | @@ -516,8 +514,8 @@ int get_total_suspend_interval(Hashmap *last_capacity, usec_t *ret) { | |||
4650 | 516 | 514 | ||
4651 | 517 | total_suspend_interval = usec_add(total_suspend_interval, suspend_interval); | 515 | total_suspend_interval = usec_add(total_suspend_interval, suspend_interval); |
4652 | 518 | } | 516 | } |
4655 | 519 | /* The previous discharge rate is stored in per hour basis so converted to minutes. | 517 | /* Previous discharge rate is stored in per hour basis converted to usec. |
4656 | 520 | * Subtracted 30 minutes from the result to keep a buffer of 30 minutes before battery gets critical */ | 518 | * Subtract 30 minutes from the result to keep a buffer of 30 minutes before battery gets critical */ |
4657 | 521 | total_suspend_interval = usec_sub_unsigned(total_suspend_interval, 30 * USEC_PER_MINUTE); | 519 | total_suspend_interval = usec_sub_unsigned(total_suspend_interval, 30 * USEC_PER_MINUTE); |
4658 | 522 | if (total_suspend_interval == 0) | 520 | if (total_suspend_interval == 0) |
4659 | 523 | return -ENOENT; | 521 | return -ENOENT; |
4660 | diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c | |||
4661 | index 30ba5d2..84fd5d3 100644 | |||
4662 | --- a/src/sleep/sleep.c | |||
4663 | +++ b/src/sleep/sleep.c | |||
4664 | @@ -267,12 +267,12 @@ static int execute( | |||
4665 | 267 | } | 267 | } |
4666 | 268 | 268 | ||
4667 | 269 | static int custom_timer_suspend(const SleepConfig *sleep_config) { | 269 | static int custom_timer_suspend(const SleepConfig *sleep_config) { |
4668 | 270 | _cleanup_hashmap_free_ Hashmap *last_capacity = NULL, *current_capacity = NULL; | ||
4669 | 271 | int r; | 270 | int r; |
4670 | 272 | 271 | ||
4671 | 273 | assert(sleep_config); | 272 | assert(sleep_config); |
4672 | 274 | 273 | ||
4673 | 275 | while (battery_is_low() == 0) { | 274 | while (battery_is_low() == 0) { |
4674 | 275 | _cleanup_hashmap_free_ Hashmap *last_capacity = NULL, *current_capacity = NULL; | ||
4675 | 276 | _cleanup_close_ int tfd = -1; | 276 | _cleanup_close_ int tfd = -1; |
4676 | 277 | struct itimerspec ts = {}; | 277 | struct itimerspec ts = {}; |
4677 | 278 | usec_t suspend_interval = sleep_config->hibernate_delay_sec, before_timestamp = 0, after_timestamp = 0, total_suspend_interval; | 278 | usec_t suspend_interval = sleep_config->hibernate_delay_sec, before_timestamp = 0, after_timestamp = 0, total_suspend_interval; |
4678 | @@ -327,7 +327,8 @@ static int custom_timer_suspend(const SleepConfig *sleep_config) { | |||
4679 | 327 | } | 327 | } |
4680 | 328 | 328 | ||
4681 | 329 | after_timestamp = now(CLOCK_BOOTTIME); | 329 | after_timestamp = now(CLOCK_BOOTTIME); |
4683 | 330 | log_debug("Attempting to estimate battery discharge rate after wakeup from %s sleep", FORMAT_TIMESPAN(after_timestamp - before_timestamp, USEC_PER_HOUR)); | 330 | log_debug("Attempting to estimate battery discharge rate after wakeup from %s sleep", |
4684 | 331 | FORMAT_TIMESPAN(after_timestamp - before_timestamp, USEC_PER_HOUR)); | ||
4685 | 331 | 332 | ||
4686 | 332 | if (after_timestamp != before_timestamp) { | 333 | if (after_timestamp != before_timestamp) { |
4687 | 333 | r = estimate_battery_discharge_rate_per_hour(last_capacity, current_capacity, before_timestamp, after_timestamp); | 334 | r = estimate_battery_discharge_rate_per_hour(last_capacity, current_capacity, before_timestamp, after_timestamp); |
4688 | @@ -366,6 +367,9 @@ static int freeze_thaw_user_slice(const char **method) { | |||
4689 | 366 | if (r < 0) | 367 | if (r < 0) |
4690 | 367 | return log_debug_errno(r, "Failed to open connection to systemd: %m"); | 368 | return log_debug_errno(r, "Failed to open connection to systemd: %m"); |
4691 | 368 | 369 | ||
4692 | 370 | /* Wait for 1.5 seconds at maximum for freeze operation */ | ||
4693 | 371 | (void) sd_bus_set_method_call_timeout(bus, 1500 * USEC_PER_MSEC); | ||
4694 | 372 | |||
4695 | 369 | r = bus_call_method(bus, bus_systemd_mgr, *method, &error, NULL, "s", SPECIAL_USER_SLICE); | 373 | r = bus_call_method(bus, bus_systemd_mgr, *method, &error, NULL, "s", SPECIAL_USER_SLICE); |
4696 | 370 | if (r < 0) | 374 | if (r < 0) |
4697 | 371 | return log_debug_errno(r, "Failed to execute operation: %s", bus_error_message(&error, r)); | 375 | return log_debug_errno(r, "Failed to execute operation: %s", bus_error_message(&error, r)); |
4698 | diff --git a/src/test/test-execute.c b/src/test/test-execute.c | |||
4699 | index 0283cae..ce3489d 100644 | |||
4700 | --- a/src/test/test-execute.c | |||
4701 | +++ b/src/test/test-execute.c | |||
4702 | @@ -1228,6 +1228,9 @@ int main(int argc, char *argv[]) { | |||
4703 | 1228 | if (r == -ENOMEDIUM) | 1228 | if (r == -ENOMEDIUM) |
4704 | 1229 | return log_tests_skipped("cgroupfs not available"); | 1229 | return log_tests_skipped("cgroupfs not available"); |
4705 | 1230 | 1230 | ||
4706 | 1231 | if (path_is_read_only_fs("/sys") > 0) | ||
4707 | 1232 | return log_tests_skipped("/sys is mounted read-only"); | ||
4708 | 1233 | |||
4709 | 1231 | _cleanup_free_ char *unit_dir = NULL, *unit_paths = NULL; | 1234 | _cleanup_free_ char *unit_dir = NULL, *unit_paths = NULL; |
4710 | 1232 | assert_se(get_testdata_dir("test-execute/", &unit_dir) >= 0); | 1235 | assert_se(get_testdata_dir("test-execute/", &unit_dir) >= 0); |
4711 | 1233 | assert_se(runtime_dir = setup_fake_runtime_dir()); | 1236 | assert_se(runtime_dir = setup_fake_runtime_dir()); |
4712 | diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c | |||
4713 | index 43fdb15..eec4831 100644 | |||
4714 | --- a/src/test/test-unit-name.c | |||
4715 | +++ b/src/test/test-unit-name.c | |||
4716 | @@ -241,11 +241,13 @@ TEST_RET(unit_printf, .sd_booted = true) { | |||
4717 | 241 | *user, *group, *uid, *gid, *home, *shell, | 241 | *user, *group, *uid, *gid, *home, *shell, |
4718 | 242 | *tmp_dir, *var_tmp_dir; | 242 | *tmp_dir, *var_tmp_dir; |
4719 | 243 | _cleanup_(manager_freep) Manager *m = NULL; | 243 | _cleanup_(manager_freep) Manager *m = NULL; |
4720 | 244 | _cleanup_close_ int fd = -EBADF; | ||
4721 | 244 | Unit *u; | 245 | Unit *u; |
4722 | 245 | int r; | 246 | int r; |
4723 | 246 | 247 | ||
4724 | 247 | _cleanup_(unlink_tempfilep) char filename[] = "/tmp/test-unit_printf.XXXXXX"; | 248 | _cleanup_(unlink_tempfilep) char filename[] = "/tmp/test-unit_printf.XXXXXX"; |
4726 | 248 | assert_se(mkostemp_safe(filename) >= 0); | 249 | fd = mkostemp_safe(filename); |
4727 | 250 | assert_se(fd >= 0); | ||
4728 | 249 | 251 | ||
4729 | 250 | /* Using the specifier functions is admittedly a bit circular, but we don't want to reimplement the | 252 | /* Using the specifier functions is admittedly a bit circular, but we don't want to reimplement the |
4730 | 251 | * logic a second time. We're at least testing that the hookup works. */ | 253 | * logic a second time. We're at least testing that the hookup works. */ |
4731 | diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c | |||
4732 | index 18bb757..3501ccf 100644 | |||
4733 | --- a/src/tmpfiles/tmpfiles.c | |||
4734 | +++ b/src/tmpfiles/tmpfiles.c | |||
4735 | @@ -2849,8 +2849,11 @@ static void item_free_contents(Item *i) { | |||
4736 | 2849 | strv_free(i->xattrs); | 2849 | strv_free(i->xattrs); |
4737 | 2850 | 2850 | ||
4738 | 2851 | #if HAVE_ACL | 2851 | #if HAVE_ACL |
4741 | 2852 | acl_free(i->acl_access); | 2852 | if (i->acl_access) |
4742 | 2853 | acl_free(i->acl_default); | 2853 | acl_free(i->acl_access); |
4743 | 2854 | |||
4744 | 2855 | if (i->acl_default) | ||
4745 | 2856 | acl_free(i->acl_default); | ||
4746 | 2854 | #endif | 2857 | #endif |
4747 | 2855 | } | 2858 | } |
4748 | 2856 | 2859 | ||
4749 | diff --git a/test/TEST-55-OOMD/test.sh b/test/TEST-55-OOMD/test.sh | |||
4750 | index 4dc4142..4032896 100755 | |||
4751 | --- a/test/TEST-55-OOMD/test.sh | |||
4752 | +++ b/test/TEST-55-OOMD/test.sh | |||
4753 | @@ -17,6 +17,12 @@ test_append_files() { | |||
4754 | 17 | cat >>"${initdir:?}/etc/fstab" <<EOF | 17 | cat >>"${initdir:?}/etc/fstab" <<EOF |
4755 | 18 | UUID=$(blkid -o value -s UUID "${LOOPDEV}p2") none swap defaults 0 0 | 18 | UUID=$(blkid -o value -s UUID "${LOOPDEV}p2") none swap defaults 0 0 |
4756 | 19 | EOF | 19 | EOF |
4757 | 20 | |||
4758 | 21 | mkdir -p "${initdir:?}/etc/systemd/system/init.scope.d/" | ||
4759 | 22 | cat >>"${initdir:?}/etc/systemd/system/init.scope.d/test-55-oomd.conf" <<EOF | ||
4760 | 23 | [Scope] | ||
4761 | 24 | MemoryHigh=10G | ||
4762 | 25 | EOF | ||
4763 | 20 | ) | 26 | ) |
4764 | 21 | } | 27 | } |
4765 | 22 | 28 | ||
4766 | diff --git a/test/fuzz/fuzz-unit-file/directives.scope b/test/fuzz/fuzz-unit-file/directives.scope | |||
4767 | index 4552d0b..2285587 100644 | |||
4768 | --- a/test/fuzz/fuzz-unit-file/directives.scope | |||
4769 | +++ b/test/fuzz/fuzz-unit-file/directives.scope | |||
4770 | @@ -47,6 +47,7 @@ MemoryMax= | |||
4771 | 47 | MemoryMin= | 47 | MemoryMin= |
4772 | 48 | MemorySwapMax= | 48 | MemorySwapMax= |
4773 | 49 | NetClass= | 49 | NetClass= |
4774 | 50 | OOMPolicy= | ||
4775 | 50 | RestartKillSignal= | 51 | RestartKillSignal= |
4776 | 51 | RestrictNetworkInterfaces= | 52 | RestrictNetworkInterfaces= |
4777 | 52 | RuntimeMaxSec= | 53 | RuntimeMaxSec= |
4778 | diff --git a/test/test-functions b/test/test-functions | |||
4779 | index 5613215..ae0a993 100644 | |||
4780 | --- a/test/test-functions | |||
4781 | +++ b/test/test-functions | |||
4782 | @@ -158,6 +158,7 @@ BASICTOOLS=( | |||
4783 | 158 | cat | 158 | cat |
4784 | 159 | chmod | 159 | chmod |
4785 | 160 | chown | 160 | chown |
4786 | 161 | chroot | ||
4787 | 161 | cmp | 162 | cmp |
4788 | 162 | cryptsetup | 163 | cryptsetup |
4789 | 163 | cut | 164 | cut |
4790 | @@ -1908,6 +1909,21 @@ install_dbus() { | |||
4791 | 1908 | </policy> | 1909 | </policy> |
4792 | 1909 | </busconfig> | 1910 | </busconfig> |
4793 | 1910 | EOF | 1911 | EOF |
4794 | 1912 | |||
4795 | 1913 | # If we run without KVM, bump the service start timeout | ||
4796 | 1914 | if ! get_bool "$QEMU_KVM"; then | ||
4797 | 1915 | cat >"$initdir/etc/dbus-1/system.d/service.timeout.conf" <<EOF | ||
4798 | 1916 | <?xml version="1.0"?> | ||
4799 | 1917 | <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | ||
4800 | 1918 | "https://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
4801 | 1919 | <busconfig> | ||
4802 | 1920 | <limit name="service_start_timeout">60000</limit> | ||
4803 | 1921 | </busconfig> | ||
4804 | 1922 | EOF | ||
4805 | 1923 | # Bump the client-side timeout in sd-bus as well | ||
4806 | 1924 | mkdir -p "$initdir/etc/systemd/system.conf.d" | ||
4807 | 1925 | echo -e '[Manager]\nDefaultEnvironment=SYSTEMD_BUS_TIMEOUT=60' >"$initdir/etc/systemd/system.conf.d/bus-timeout.conf" | ||
4808 | 1926 | fi | ||
4809 | 1911 | } | 1927 | } |
4810 | 1912 | 1928 | ||
4811 | 1913 | install_user_dbus() { | 1929 | install_user_dbus() { |
4812 | diff --git a/test/test-network/conf/23-bond199.network b/test/test-network/conf/23-bond199.network | |||
4813 | index 6a1f9a1..9f4879f 100644 | |||
4814 | --- a/test/test-network/conf/23-bond199.network | |||
4815 | +++ b/test/test-network/conf/23-bond199.network | |||
4816 | @@ -4,6 +4,3 @@ Name=bond199 | |||
4817 | 4 | 4 | ||
4818 | 5 | [Network] | 5 | [Network] |
4819 | 6 | IPv6AcceptRA=no | 6 | IPv6AcceptRA=no |
4820 | 7 | |||
4821 | 8 | [Link] | ||
4822 | 9 | MACAddress=00:11:22:33:44:55 | ||
4823 | diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py | |||
4824 | index 693ddfa..5a731f5 100755 | |||
4825 | --- a/test/test-network/systemd-networkd-tests.py | |||
4826 | +++ b/test/test-network/systemd-networkd-tests.py | |||
4827 | @@ -1063,6 +1063,10 @@ class NetworkctlTests(unittest.TestCase, Utilities): | |||
4828 | 1063 | self.assertRegex(output, r'Link File: (/usr)?/lib/systemd/network/99-default.link') | 1063 | self.assertRegex(output, r'Link File: (/usr)?/lib/systemd/network/99-default.link') |
4829 | 1064 | self.assertRegex(output, r'Network File: /run/systemd/network/11-dummy.network') | 1064 | self.assertRegex(output, r'Network File: /run/systemd/network/11-dummy.network') |
4830 | 1065 | 1065 | ||
4831 | 1066 | # This test may be run on the system that has older udevd than 70f32a260b5ebb68c19ecadf5d69b3844896ba55 (v249). | ||
4832 | 1067 | # In that case, the udev DB for the loopback network interface may already have ID_NET_LINK_FILE property. | ||
4833 | 1068 | # Let's reprocess the interface and drop the property. | ||
4834 | 1069 | check_output(*udevadm_cmd, 'trigger', '--settle', '--action=add', '/sys/class/net/lo') | ||
4835 | 1066 | output = check_output(*networkctl_cmd, '-n', '0', 'status', 'lo', env=env) | 1070 | output = check_output(*networkctl_cmd, '-n', '0', 'status', 'lo', env=env) |
4836 | 1067 | print(output) | 1071 | print(output) |
4837 | 1068 | self.assertRegex(output, r'Link File: n/a') | 1072 | self.assertRegex(output, r'Link File: n/a') |
4838 | @@ -3799,7 +3803,7 @@ class NetworkdBondTests(unittest.TestCase, Utilities): | |||
4839 | 3799 | 3803 | ||
4840 | 3800 | output = check_output('ip -d link show bond199') | 3804 | output = check_output('ip -d link show bond199') |
4841 | 3801 | print(output) | 3805 | print(output) |
4843 | 3802 | self.assertRegex(output, 'active_slave dummy98') | 3806 | self.assertIn('active_slave dummy98', output) |
4844 | 3803 | 3807 | ||
4845 | 3804 | def test_bond_primary_slave(self): | 3808 | def test_bond_primary_slave(self): |
4846 | 3805 | copy_network_unit('23-primary-slave.network', '23-bond199.network', '25-bond-active-backup-slave.netdev', '12-dummy.netdev') | 3809 | copy_network_unit('23-primary-slave.network', '23-bond199.network', '25-bond-active-backup-slave.netdev', '12-dummy.netdev') |
4847 | @@ -3808,8 +3812,20 @@ class NetworkdBondTests(unittest.TestCase, Utilities): | |||
4848 | 3808 | 3812 | ||
4849 | 3809 | output = check_output('ip -d link show bond199') | 3813 | output = check_output('ip -d link show bond199') |
4850 | 3810 | print(output) | 3814 | print(output) |
4853 | 3811 | self.assertRegex(output, 'primary dummy98') | 3815 | self.assertIn('primary dummy98', output) |
4854 | 3812 | self.assertIn('link/ether 00:11:22:33:44:55', output) | 3816 | |
4855 | 3817 | # for issue #25627 | ||
4856 | 3818 | mkdir_p(os.path.join(network_unit_dir, '23-bond199.network.d')) | ||
4857 | 3819 | for mac in ['00:11:22:33:44:55', '00:11:22:33:44:56']: | ||
4858 | 3820 | with open(os.path.join(network_unit_dir, '23-bond199.network.d/mac.conf'), mode='w', encoding='utf-8') as f: | ||
4859 | 3821 | f.write(f'[Link]\nMACAddress={mac}\n') | ||
4860 | 3822 | |||
4861 | 3823 | networkctl_reload() | ||
4862 | 3824 | self.wait_online(['dummy98:enslaved', 'bond199:degraded']) | ||
4863 | 3825 | |||
4864 | 3826 | output = check_output('ip -d link show bond199') | ||
4865 | 3827 | print(output) | ||
4866 | 3828 | self.assertIn(f'link/ether {mac}', output) | ||
4867 | 3813 | 3829 | ||
4868 | 3814 | def test_bond_operstate(self): | 3830 | def test_bond_operstate(self): |
4869 | 3815 | copy_network_unit('25-bond.netdev', '11-dummy.netdev', '12-dummy.netdev', | 3831 | copy_network_unit('25-bond.netdev', '11-dummy.netdev', '12-dummy.netdev', |
4870 | diff --git a/test/test-shutdown.py b/test/test-shutdown.py | |||
4871 | index e181f97..13e18ec 100755 | |||
4872 | --- a/test/test-shutdown.py | |||
4873 | +++ b/test/test-shutdown.py | |||
4874 | @@ -17,7 +17,7 @@ def run(args): | |||
4875 | 17 | logger.info("spawning test") | 17 | logger.info("spawning test") |
4876 | 18 | console = pexpect.spawn(args.command, args.arg, env={ | 18 | console = pexpect.spawn(args.command, args.arg, env={ |
4877 | 19 | "TERM": "linux", | 19 | "TERM": "linux", |
4879 | 20 | }, encoding='utf-8', timeout=30) | 20 | }, encoding='utf-8', timeout=60) |
4880 | 21 | 21 | ||
4881 | 22 | if args.verbose: | 22 | if args.verbose: |
4882 | 23 | console.logfile = sys.stdout | 23 | console.logfile = sys.stdout |
4883 | diff --git a/test/units/testsuite-26.sh b/test/units/testsuite-26.sh | |||
4884 | index a8e7a5a..37ae606 100755 | |||
4885 | --- a/test/units/testsuite-26.sh | |||
4886 | +++ b/test/units/testsuite-26.sh | |||
4887 | @@ -294,7 +294,7 @@ systemctl unset-environment IMPORT_THIS IMPORT_THIS_TOO | |||
4888 | 294 | 294 | ||
4889 | 295 | # test for sysv-generator (issue #24990) | 295 | # test for sysv-generator (issue #24990) |
4890 | 296 | if [[ -x /usr/lib/systemd/system-generators/systemd-sysv-generator ]]; then | 296 | if [[ -x /usr/lib/systemd/system-generators/systemd-sysv-generator ]]; then |
4892 | 297 | 297 | mkdir -p /etc/init.d | |
4893 | 298 | # invalid dependency | 298 | # invalid dependency |
4894 | 299 | cat >/etc/init.d/issue-24990 <<\EOF | 299 | cat >/etc/init.d/issue-24990 <<\EOF |
4895 | 300 | #!/bin/bash | 300 | #!/bin/bash |
4896 | diff --git a/test/units/testsuite-55.sh b/test/units/testsuite-55.sh | |||
4897 | index 8fa1d01..0887eac 100755 | |||
4898 | --- a/test/units/testsuite-55.sh | |||
4899 | +++ b/test/units/testsuite-55.sh | |||
4900 | @@ -5,6 +5,9 @@ set -o pipefail | |||
4901 | 5 | 5 | ||
4902 | 6 | systemd-analyze log-level debug | 6 | systemd-analyze log-level debug |
4903 | 7 | 7 | ||
4904 | 8 | # Ensure that the init.scope.d drop-in is applied on boot | ||
4905 | 9 | test "$(cat /sys/fs/cgroup/init.scope/memory.high)" != "max" | ||
4906 | 10 | |||
4907 | 8 | # Loose checks to ensure the environment has the necessary features for systemd-oomd | 11 | # Loose checks to ensure the environment has the necessary features for systemd-oomd |
4908 | 9 | [[ -e /proc/pressure ]] || echo "no PSI" >>/skipped | 12 | [[ -e /proc/pressure ]] || echo "no PSI" >>/skipped |
4909 | 10 | cgroup_type="$(stat -fc %T /sys/fs/cgroup/)" | 13 | cgroup_type="$(stat -fc %T /sys/fs/cgroup/)" |
4910 | diff --git a/test/units/testsuite-64.sh b/test/units/testsuite-64.sh | |||
4911 | index 7673036..c4406f3 100755 | |||
4912 | --- a/test/units/testsuite-64.sh | |||
4913 | +++ b/test/units/testsuite-64.sh | |||
4914 | @@ -192,7 +192,7 @@ testcase_nvme_subsystem() { | |||
4915 | 192 | testcase_virtio_scsi_identically_named_partitions() { | 192 | testcase_virtio_scsi_identically_named_partitions() { |
4916 | 193 | local num | 193 | local num |
4917 | 194 | 194 | ||
4919 | 195 | if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then | 195 | if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then |
4920 | 196 | num=$((4 * 4)) | 196 | num=$((4 * 4)) |
4921 | 197 | else | 197 | else |
4922 | 198 | num=$((16 * 8)) | 198 | num=$((16 * 8)) |
4923 | @@ -243,6 +243,7 @@ EOF | |||
4924 | 243 | echo "${FUNCNAME[0]}: test failover" | 243 | echo "${FUNCNAME[0]}: test failover" |
4925 | 244 | local device expected link mpoint part | 244 | local device expected link mpoint part |
4926 | 245 | local -a devices | 245 | local -a devices |
4927 | 246 | mkdir -p /mnt | ||
4928 | 246 | mpoint="$(mktemp -d /mnt/mpathXXX)" | 247 | mpoint="$(mktemp -d /mnt/mpathXXX)" |
4929 | 247 | wwid="deaddeadbeef0000" | 248 | wwid="deaddeadbeef0000" |
4930 | 248 | path="/dev/disk/by-id/wwn-0x$wwid" | 249 | path="/dev/disk/by-id/wwn-0x$wwid" |
4931 | @@ -305,7 +306,7 @@ testcase_simultaneous_events() { | |||
4932 | 305 | local -a devices symlinks | 306 | local -a devices symlinks |
4933 | 306 | local -A running | 307 | local -A running |
4934 | 307 | 308 | ||
4936 | 308 | if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then | 309 | if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then |
4937 | 309 | num_part=2 | 310 | num_part=2 |
4938 | 310 | iterations=10 | 311 | iterations=10 |
4939 | 311 | timeout=240 | 312 | timeout=240 |
4940 | @@ -400,7 +401,7 @@ testcase_lvm_basic() { | |||
4941 | 400 | /dev/disk/by-id/ata-foobar_deadbeeflvm{0..3} | 401 | /dev/disk/by-id/ata-foobar_deadbeeflvm{0..3} |
4942 | 401 | ) | 402 | ) |
4943 | 402 | 403 | ||
4945 | 403 | if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then | 404 | if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then |
4946 | 404 | timeout=180 | 405 | timeout=180 |
4947 | 405 | else | 406 | else |
4948 | 406 | timeout=30 | 407 | timeout=30 |
4949 | @@ -453,7 +454,7 @@ testcase_lvm_basic() { | |||
4950 | 453 | helper_check_device_units | 454 | helper_check_device_units |
4951 | 454 | 455 | ||
4952 | 455 | # Same as above, but now with more "stress" | 456 | # Same as above, but now with more "stress" |
4954 | 456 | if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then | 457 | if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then |
4955 | 457 | iterations=10 | 458 | iterations=10 |
4956 | 458 | else | 459 | else |
4957 | 459 | iterations=50 | 460 | iterations=50 |
4958 | @@ -478,7 +479,7 @@ testcase_lvm_basic() { | |||
4959 | 478 | helper_check_device_units | 479 | helper_check_device_units |
4960 | 479 | 480 | ||
4961 | 480 | # Create & remove LVs in a loop, i.e. with more "stress" | 481 | # Create & remove LVs in a loop, i.e. with more "stress" |
4963 | 481 | if [[ -n "${ASAN_OPTIONS:-}" ]]; then | 482 | if [[ -v ASAN_OPTIONS ]]; then |
4964 | 482 | iterations=8 | 483 | iterations=8 |
4965 | 483 | partitions=16 | 484 | partitions=16 |
4966 | 484 | elif [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then | 485 | elif [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then |
4967 | diff --git a/test/units/testsuite-65.sh b/test/units/testsuite-65.sh | |||
4968 | index 1f34308..ebe1f57 100755 | |||
4969 | --- a/test/units/testsuite-65.sh | |||
4970 | +++ b/test/units/testsuite-65.sh | |||
4971 | @@ -139,6 +139,16 @@ systemd-analyze cat-config systemd/system.conf systemd/journald.conf >/dev/null | |||
4972 | 139 | systemd-analyze cat-config systemd/system.conf foo/bar systemd/journald.conf >/dev/null | 139 | systemd-analyze cat-config systemd/system.conf foo/bar systemd/journald.conf >/dev/null |
4973 | 140 | systemd-analyze cat-config foo/bar | 140 | systemd-analyze cat-config foo/bar |
4974 | 141 | 141 | ||
4975 | 142 | if [[ ! -v ASAN_OPTIONS ]]; then | ||
4976 | 143 | # check that systemd-analyze cat-config paths work in a chroot | ||
4977 | 144 | mkdir -p /tmp/root | ||
4978 | 145 | mount --bind / /tmp/root | ||
4979 | 146 | systemd-analyze cat-config systemd/system-preset >/tmp/out1 | ||
4980 | 147 | chroot /tmp/root systemd-analyze cat-config systemd/system-preset >/tmp/out2 | ||
4981 | 148 | diff /tmp/out{1,2} | ||
4982 | 149 | fi | ||
4983 | 150 | |||
4984 | 151 | # verify | ||
4985 | 142 | mkdir -p /tmp/img/usr/lib/systemd/system/ | 152 | mkdir -p /tmp/img/usr/lib/systemd/system/ |
4986 | 143 | mkdir -p /tmp/img/opt/ | 153 | mkdir -p /tmp/img/opt/ |
4987 | 144 | 154 | ||
4988 | diff --git a/test/units/testsuite-73.sh b/test/units/testsuite-73.sh | |||
4989 | index f9e2dce..4eae0f6 100755 | |||
4990 | --- a/test/units/testsuite-73.sh | |||
4991 | +++ b/test/units/testsuite-73.sh | |||
4992 | @@ -92,6 +92,19 @@ test_locale() { | |||
4993 | 92 | return | 92 | return |
4994 | 93 | fi | 93 | fi |
4995 | 94 | 94 | ||
4996 | 95 | # start with a known default environment and make sure to also give a | ||
4997 | 96 | # default value to LC_CTYPE= since we're about to also set/unset it. We | ||
4998 | 97 | # also reload PID1 configuration to make sure that PID1 environment itself | ||
4999 | 98 | # is updated as it's not always been the case. | ||
5000 | 99 | assert_rc 0 localectl set-locale "LANG=en_US.UTF-8" "LC_CTYPE=C" |
We tried the s390x test again in staging, and it still failed: https:/ /autopkgtest. staging. ubuntu. com/results/ autopkgtest- lunar-enr0n- systemd/ lunar/s390x/ s/systemd/ 20230210_ 182915_ 66bf1@/ log.gz.
I will try again on Canonistack, but if I can't reproduce it maybe we should skip this test on s390x for now.