systemd/.git
15 months agomkfs-util: Make sure we pass non option arguments last
Daan De Meyer [Thu, 5 Sep 2024 14:09:22 +0000 (16:09 +0200)]
mkfs-util: Make sure we pass non option arguments last

POSIX specifies that getopt() stops parsing options when it encounters
a non-option argument, so let's make sure we pass non-option arguments
last.

15 months agomkfs-util: Fix error handling
Daan De Meyer [Thu, 5 Sep 2024 14:08:00 +0000 (16:08 +0200)]
mkfs-util: Fix error handling

15 months agoMerge pull request #34235 from yuwata/firstboot-systemctl-trivial-cleanups
Lennart Poettering [Thu, 5 Sep 2024 07:22:54 +0000 (09:22 +0200)]
Merge pull request #34235 from yuwata/firstboot-systemctl-trivial-cleanups

firstboot,systemctl: trivial cleanups

15 months agoman: ARP=no also disables IPv6 Neighbor Discovery Protocol
Yu Watanabe [Mon, 2 Sep 2024 01:52:54 +0000 (10:52 +0900)]
man: ARP=no also disables IPv6 Neighbor Discovery Protocol

Addresses https://github.com/systemd/systemd/issues/18063#issuecomment-2323410288.

15 months agoMerge pull request #34090 from DaanDeMeyer/cow-fix
Yu Watanabe [Thu, 5 Sep 2024 01:19:49 +0000 (10:19 +0900)]
Merge pull request #34090 from DaanDeMeyer/cow-fix

Rework COW <=> NOCOW copying behavior

15 months agofirstboot: reduce log level of timezone validation
Michael Ferrari [Thu, 6 Jun 2024 14:06:34 +0000 (16:06 +0200)]
firstboot: reduce log level of timezone validation

An error message is already printed directly after, so the user already
knows that the validation failed. This also isn't done for the other
validation functions.

15 months agofirstboot: reduce empty input log level
Michael Ferrari [Wed, 5 Jun 2024 17:40:57 +0000 (19:40 +0200)]
firstboot: reduce empty input log level

The user knows they pressed `Enter`, no need to inform them again about
that they skipped the prompt.

15 months agofirstboot: add newline before key wait
Michael Ferrari [Wed, 5 Jun 2024 17:33:19 +0000 (19:33 +0200)]
firstboot: add newline before key wait

When sd-firstboot is ran during first boot of a new system this missing
newline leads to a bootup message being appended on the same line as the
message instructing to press a key.

15 months agotest: add test cases of "systemctl cat" for nonexistent units
Yu Watanabe [Tue, 3 Sep 2024 02:46:45 +0000 (11:46 +0900)]
test: add test cases of "systemctl cat" for nonexistent units

15 months agosystemctl: cat: do not exit(1) on missing units if `--force`
Ivan Shapovalov [Wed, 17 Jul 2024 08:50:27 +0000 (10:50 +0200)]
systemctl: cat: do not exit(1) on missing units if `--force`

We are eating the error message if `--force` is set, so do not return
a non-zero exit code either.

15 months agoMerge pull request #34212 from YHNdnzj/recvmsg-safe-trunc
Yu Watanabe [Wed, 4 Sep 2024 22:22:28 +0000 (07:22 +0900)]
Merge pull request #34212 from YHNdnzj/recvmsg-safe-trunc

tree-wide: handle MSG_TRUNC with recvmsg_safe()

15 months agocopy: Introduce COPY_NOCOW_AFTER and use it when copying images
Daan De Meyer [Fri, 23 Aug 2024 11:40:40 +0000 (13:40 +0200)]
copy: Introduce COPY_NOCOW_AFTER and use it when copying images

When dealing with copying COW images, we have to make a tradeoff:

- Either we don't touch the NOCOW bit on the copied file COW and get
  an instant copy because we're able to reflink, but we might get
  reduced performance if the source file was COW as COW files and lots
  of random writes don't play well together.
- Or we force NOCOW for the copied file, which means we have to do a
  full copy as reflinking from COW files to NOCOW files or vice versa
  is not supported.

In exec-invoke.c, we've opted for the first option. In nspawn.c and
discover-image.c, we've opted for the second option.

In nspawn, this applies to the --ephemeral option to make ephemeral
copies. In discover-image.c, this applies to cloning images into
/var/lib/machines. Both these features might be used to run many
machines of the same original image. We really don't want to force
a full copy onto users in these scenarios when they're expecting
reflink behavior, leading to them running out of disk space. Instead,
degraded performance in their machines is a much less severe issue,
which they will discover on their own if it affects them, at which
point they can make their original image NOCOW at which point they'll
get both the reflinks and better performance.

Given the above reasoning, let's switch nspawn.c and discover-image.c
to use COPY_NOCOW_AFTER as well instead of enabling NOCOW upfront and
forcing a copy if the original source image is COW.

15 months agocopy: Copy nocow flag by default
Daan De Meyer [Fri, 23 Aug 2024 11:04:33 +0000 (13:04 +0200)]
copy: Copy nocow flag by default

Unless otherwise requested, if we're going to copy a nocow file, make the
target file nocow as well.

Aside from keeping the performance characteristics of the cow or nocow file
intact, reflinking also only works from cow to cow or nocow to nocow files.
Reflinking from cow to nocow or nocow to cow files does not work and can
easily lead to unexpected copies for users, so by keeping the nocow bit
intact across copies by default we also make sure reflinks always work.

15 months agochattr-util: Optimize read_attr_at()
Daan De Meyer [Mon, 26 Aug 2024 12:14:07 +0000 (14:14 +0200)]
chattr-util: Optimize read_attr_at()

Let's make sure we only reopen O_PATH file descriptors.

15 months agosocket-util: make recvmsg_safe() handle MSG_TRUNC too
Mike Yuan [Fri, 30 Aug 2024 22:17:13 +0000 (00:17 +0200)]
socket-util: make recvmsg_safe() handle MSG_TRUNC too

Also, unify MSG_TRUNC handling all across the codebase.

15 months agomachine-dbus: use in_same_namespace() at one more place
Mike Yuan [Sat, 31 Aug 2024 15:16:47 +0000 (17:16 +0200)]
machine-dbus: use in_same_namespace() at one more place

15 months agoudev-ctrl: drop unused next_datagram_size_fd() call
Mike Yuan [Sat, 31 Aug 2024 13:37:36 +0000 (15:37 +0200)]
udev-ctrl: drop unused next_datagram_size_fd() call

15 months agocore/manager: close all cmsg fds where none is expected
Mike Yuan [Mon, 2 Sep 2024 21:43:53 +0000 (23:43 +0200)]
core/manager: close all cmsg fds where none is expected

15 months agoudev-ctrl: add missing size check of received message
Mike Yuan [Mon, 2 Sep 2024 14:24:10 +0000 (16:24 +0200)]
udev-ctrl: add missing size check of received message

While at it, downgrade log level of ignored errors to LOG_WARNING.

15 months agoaudit-util: check correct errno
Mike Yuan [Sat, 31 Aug 2024 13:42:43 +0000 (15:42 +0200)]
audit-util: check correct errno

15 months agosd-varlink: check correct errno
Mike Yuan [Sat, 31 Aug 2024 13:35:45 +0000 (15:35 +0200)]
sd-varlink: check correct errno

'n' can also be assigned from recvmsg_safe(), which is our own
func returning negative errno.

15 months agofd-util: also close pidfd from SCM_PIDFD in cmsg_close_all()
Mike Yuan [Fri, 30 Aug 2024 21:47:48 +0000 (23:47 +0200)]
fd-util: also close pidfd from SCM_PIDFD in cmsg_close_all()

15 months agoRevert "copy: Copy file attributes as well"
Daan De Meyer [Fri, 23 Aug 2024 10:24:16 +0000 (12:24 +0200)]
Revert "copy: Copy file attributes as well"

This reverts commit 2356104efcc599439c887b087da83fbeca1fa9a6.

15 months agoRevert "tree-wide: Don't explicity disable copy-on-write when copying images"
Daan De Meyer [Thu, 22 Aug 2024 15:23:58 +0000 (17:23 +0200)]
Revert "tree-wide: Don't explicity disable copy-on-write when copying images"

Let's still try to disable COW after copying. It won't do much, but
it doesn't hurt either.

See https://github.com/systemd/systemd/pull/33825/files#r1727288871.

This reverts commit 42e9288180ce37abd86c58774950636ebce35432.

15 months agoMerge pull request #34251 from DaanDeMeyer/multiq
Daan De Meyer [Wed, 4 Sep 2024 14:03:32 +0000 (16:03 +0200)]
Merge pull request #34251 from DaanDeMeyer/multiq

network: Add support for multiq qdisc

15 months agonetwork: Add support for mq qdisc
Daan De Meyer [Wed, 4 Sep 2024 11:32:32 +0000 (13:32 +0200)]
network: Add support for mq qdisc

15 months agonetwork: Add support for multiq qdisc
Daan De Meyer [Wed, 4 Sep 2024 10:19:49 +0000 (12:19 +0200)]
network: Add support for multiq qdisc

15 months agoMerge pull request #34205 from yuwata/pretty-print-buffering
Mike Yuan [Wed, 4 Sep 2024 12:34:21 +0000 (14:34 +0200)]
Merge pull request #34205 from yuwata/pretty-print-buffering

pretty-print: introduce WITH_BUFFERED_STDERR macro to enable buffering

15 months agoMerge pull request #34224 from yuwata/network-make-qdisc-reconfigurable
Daan De Meyer [Wed, 4 Sep 2024 10:07:16 +0000 (12:07 +0200)]
Merge pull request #34224 from yuwata/network-make-qdisc-reconfigurable

network: make qdisc reconfigurable

15 months agoMerge pull request #32487 from YHNdnzj/bind-journal-sockets
Daan De Meyer [Wed, 4 Sep 2024 07:26:58 +0000 (09:26 +0200)]
Merge pull request #32487 from YHNdnzj/bind-journal-sockets

core: introduce BindJournalSockets=

15 months agobuild(deps): bump softprops/action-gh-release from 2.0.5 to 2.0.8
dependabot[bot] [Sun, 1 Sep 2024 09:10:21 +0000 (09:10 +0000)]
build(deps): bump softprops/action-gh-release from 2.0.5 to 2.0.8

Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.0.5 to 2.0.8.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/69320dbe05506a9a39fc8ae11030b214ec2d1f87...c062e08bd532815e2082a85e87e3ef29c3e6d191)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
15 months agobuild(deps): bump super-linter/super-linter from 6.6.0 to 7.1.0
dependabot[bot] [Sun, 1 Sep 2024 09:10:23 +0000 (09:10 +0000)]
build(deps): bump super-linter/super-linter from 6.6.0 to 7.1.0

Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 6.6.0 to 7.1.0.
- [Release notes](https://github.com/super-linter/super-linter/releases)
- [Changelog](https://github.com/super-linter/super-linter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/super-linter/super-linter/compare/88ea3923a7e1f89dd485d079f6eb5f5e8f937589...b92721f792f381cedc002ecdbb9847a15ece5bb8)

---
updated-dependencies:
- dependency-name: super-linter/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
15 months agoTEST-50-DISSECT: add explicit coverage for BindJournalSockets=
Mike Yuan [Fri, 26 Apr 2024 09:03:45 +0000 (17:03 +0800)]
TEST-50-DISSECT: add explicit coverage for BindJournalSockets=

15 months agotest: drop unneeded journal socket bind mounts
Mike Yuan [Fri, 26 Apr 2024 08:54:25 +0000 (16:54 +0800)]
test: drop unneeded journal socket bind mounts
(where BindJournalSockets=yes is implied)

15 months agoportable/profile: use BindJournalSockets=
Mike Yuan [Fri, 26 Apr 2024 08:53:41 +0000 (16:53 +0800)]
portable/profile: use BindJournalSockets=

15 months agocore/namespace: create /dev/log only if journal socket is present
Mike Yuan [Thu, 25 Apr 2024 20:47:40 +0000 (04:47 +0800)]
core/namespace: create /dev/log only if journal socket is present

15 months agocore: introduce BindJournalSockets=
Mike Yuan [Thu, 25 Apr 2024 16:43:29 +0000 (00:43 +0800)]
core: introduce BindJournalSockets=

Closes #32478

15 months agobuild(deps): bump systemd/mkosi
dependabot[bot] [Sun, 1 Sep 2024 09:10:17 +0000 (09:10 +0000)]
build(deps): bump systemd/mkosi

Bumps [systemd/mkosi](https://github.com/systemd/mkosi) from 8c2f828701a1bdb3dc9b80d6f2ab979f0430a6b8 to 31b4e756c1484c302435653da5d3b9bdfae38518.
- [Release notes](https://github.com/systemd/mkosi/releases)
- [Changelog](https://github.com/systemd/mkosi/blob/main/NEWS.md)
- [Commits](https://github.com/systemd/mkosi/compare/8c2f828701a1bdb3dc9b80d6f2ab979f0430a6b8...31b4e756c1484c302435653da5d3b9bdfae38518)

---
updated-dependencies:
- dependency-name: systemd/mkosi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
15 months agoMerge pull request #34240 from DaanDeMeyer/mkosi
Daan De Meyer [Tue, 3 Sep 2024 15:52:43 +0000 (17:52 +0200)]
Merge pull request #34240 from DaanDeMeyer/mkosi

mkosi: Rework debian/ubuntu prepare script to install dependencies

15 months agomkosi: Use apt patterns to install dependencies on Debian/Ubuntu
Daan De Meyer [Tue, 3 Sep 2024 13:18:49 +0000 (15:18 +0200)]
mkosi: Use apt patterns to install dependencies on Debian/Ubuntu

Instead of parsing the human readable output of apt-cache, let's
use apt patterns to figure out the dependencies.

We also filter out virtual packages as apt will fail and say we need
to install an implementation of the virtual package even if a package
that provides the virtual package is already installed.

15 months agomkosi: Make systemd package filtering more robust
Daan De Meyer [Tue, 3 Sep 2024 10:53:23 +0000 (12:53 +0200)]
mkosi: Make systemd package filtering more robust

Let's not just filter everything with systemd in the name, but instead
use the same list of volatile packages that we install to do the
filtering.

15 months agoMerge pull request #34236 from DaanDeMeyer/manager-split
Daan De Meyer [Tue, 3 Sep 2024 11:47:53 +0000 (13:47 +0200)]
Merge pull request #34236 from DaanDeMeyer/manager-split

json-util: Add more builders

15 months agojson-util: Add JSON_BUILD_PAIR_UNSIGNED_NOT_EQUAL()
Daan De Meyer [Fri, 23 Aug 2024 12:57:12 +0000 (14:57 +0200)]
json-util: Add JSON_BUILD_PAIR_UNSIGNED_NOT_EQUAL()

15 months agojson-util: Add JSON_BUILD_TRISTATE() and friends
Daan De Meyer [Tue, 13 Aug 2024 14:39:04 +0000 (16:39 +0200)]
json-util: Add JSON_BUILD_TRISTATE() and friends

15 months agojson-util: Add JSON_BUILD_PAIR_BASE64_NON_EMPTY() and friends
Daan De Meyer [Tue, 13 Aug 2024 11:04:06 +0000 (13:04 +0200)]
json-util: Add JSON_BUILD_PAIR_BASE64_NON_EMPTY() and friends

15 months agojson-util: Add JSON_BUILD_PAIR_BYTE_ARRAY_NON_EMPTY()
Daan De Meyer [Sat, 10 Aug 2024 11:42:32 +0000 (13:42 +0200)]
json-util: Add JSON_BUILD_PAIR_BYTE_ARRAY_NON_EMPTY()

15 months agojson-util: Add JSON_BUILD_PAIR_INTEGER_NON_NEGATIVE()
Daan De Meyer [Fri, 9 Aug 2024 14:25:32 +0000 (16:25 +0200)]
json-util: Add JSON_BUILD_PAIR_INTEGER_NON_NEGATIVE()

15 months agojson-util: Add JSON_BUILD_PAIR_INTEGER_NON_ZERO()
Daan De Meyer [Fri, 9 Aug 2024 13:12:22 +0000 (15:12 +0200)]
json-util: Add JSON_BUILD_PAIR_INTEGER_NON_ZERO()

15 months agojson-util: Add JSON_BUILD_PAIR_CALLBACK_NON_NULL()
Daan De Meyer [Fri, 9 Aug 2024 11:40:43 +0000 (13:40 +0200)]
json-util: Add JSON_BUILD_PAIR_CALLBACK_NON_NULL()

Like JSON_BUILD_PAIR_CALLBACK(), but doesn't add anything to the variant
if the callback doesn't put anything in the return argument.

15 months agojson-util: Add JSON_BUILD_PAIR_DUAL_TIMESTAMP_NON_NULL()
Daan De Meyer [Thu, 8 Aug 2024 12:16:01 +0000 (14:16 +0200)]
json-util: Add JSON_BUILD_PAIR_DUAL_TIMESTAMP_NON_NULL()

15 months agojson-util: Add JSON_BUILD_PAIR_DUAL_TIMESTAMP()
Daan De Meyer [Thu, 8 Aug 2024 11:43:05 +0000 (13:43 +0200)]
json-util: Add JSON_BUILD_PAIR_DUAL_TIMESTAMP()

15 months agojson-util: Add JSON_BUILD_RATELIMIT()
Daan De Meyer [Thu, 8 Aug 2024 11:51:30 +0000 (13:51 +0200)]
json-util: Add JSON_BUILD_RATELIMIT()

15 months agojson-util: Add JSON_BUILD_STRING_ORDERED_SET()
Daan De Meyer [Wed, 7 Aug 2024 07:45:44 +0000 (09:45 +0200)]
json-util: Add JSON_BUILD_STRING_ORDERED_SET()

15 months agoMerge pull request #34190 from DaanDeMeyer/repart-compress
Daan De Meyer [Tue, 3 Sep 2024 08:48:39 +0000 (10:48 +0200)]
Merge pull request #34190 from DaanDeMeyer/repart-compress

repart: Add compression support

15 months agoMerge pull request #34228 from poettering/uki-with-many-prep1
Lennart Poettering [Tue, 3 Sep 2024 07:50:37 +0000 (09:50 +0200)]
Merge pull request #34228 from poettering/uki-with-many-prep1

Two preparatory EFI library additions

15 months agorepart: Add compression support
Daan De Meyer [Fri, 30 Aug 2024 12:09:06 +0000 (14:09 +0200)]
repart: Add compression support

Now that mkfs.btrfs is adding support for compressing the generated
filesystem (https://github.com/kdave/btrfs-progs/pull/882), let's
add general support for specifying the compression algorithm and
compression level to use.

We opt to not parse the specified compression algorithm and instead
pass it on as is to the mkfs tool. This has a few benefits:

- We support every compression algorithm supported by every tool
  automatically.
- Users don't need to modify systemd-repart if a mkfs tool learns a
  new compression algorithm in the future
- We don't need to maintain a bunch of tables for filesystem to map
  from our generic compression algorithm enum to the filesystem specific
  names.

We don't add support for btrfs just yet until the corresponding PR
in btrfs-progs is merged.

15 months agoTEST-58-REPART: Only skip part of testcase_minimize() that requires root
Daan De Meyer [Sun, 1 Sep 2024 07:33:00 +0000 (09:33 +0200)]
TEST-58-REPART: Only skip part of testcase_minimize() that requires root

15 months agoTEST-58-REPART: Always run TEST-58-REPART in virtual machine
Daan De Meyer [Sat, 31 Aug 2024 21:05:11 +0000 (23:05 +0200)]
TEST-58-REPART: Always run TEST-58-REPART in virtual machine

Required for various tests in TEST-58-REPART.

15 months agomkosi: Don't create sanitizer wrappers for every mkfs binary
Daan De Meyer [Sun, 1 Sep 2024 07:31:12 +0000 (09:31 +0200)]
mkosi: Don't create sanitizer wrappers for every mkfs binary

mksquashfs for some reason ends up in nss_systemd and mkfs.btrfs
links against libudev. The others don't need a sanitizer wrapper
script.

15 months agoMerge pull request #34149 from DaanDeMeyer/btrfs
Daan De Meyer [Tue, 3 Sep 2024 06:47:50 +0000 (08:47 +0200)]
Merge pull request #34149 from DaanDeMeyer/btrfs

repart: Switch to new mkfs.btrfs subvolume API

15 months agoresolve: fix typo
Yu Watanabe [Tue, 3 Sep 2024 05:00:15 +0000 (14:00 +0900)]
resolve: fix typo

Follow-up for 67d0ce8843d612a2245d0966197d4f528b911b66.

15 months agoresolved: include Varlink error on inconsistent DNS-SD services in introspection...
Lennart Poettering [Fri, 23 Aug 2024 08:43:40 +0000 (10:43 +0200)]
resolved: include Varlink error on inconsistent DNS-SD services in introspection data

Let's also rename the error slightly, since what happens here is that a
a valid service RR name is CNAME'd onto an invalid one. That's an
inconsistency on the server side, which we really should report as such.

Follow-up for: b48ab08732a76b7337628e1e716f11c687000903

15 months agopretty-print: introduce WITH_BUFFERED_STDERR macro to enable buffering
Yu Watanabe [Sat, 31 Aug 2024 06:42:17 +0000 (15:42 +0900)]
pretty-print: introduce WITH_BUFFERED_STDERR macro to enable buffering

Then, the buffer will be flushed and buffering will be disabled on
exiting from the scope.

15 months agopretty-print: rename {draw,clear}_progress_bar_unbuffered() -> {draw,clear}_progress_...
Yu Watanabe [Sun, 1 Sep 2024 07:07:28 +0000 (16:07 +0900)]
pretty-print: rename {draw,clear}_progress_bar_unbuffered() -> {draw,clear}_progress_bar_impl()

Addresses https://github.com/systemd/systemd/pull/34205#discussion_r1739648525.
Follow-ups for 5f9dd9c64d20e7cdf8b509421e28cfebf31b7c32.

15 months agoMerge pull request #34140 from yuwata/conf-parser-log-message
Yu Watanabe [Mon, 2 Sep 2024 23:20:07 +0000 (08:20 +0900)]
Merge pull request #34140 from yuwata/conf-parser-log-message

conf-parser: introduce log_syntax_parse_error() and use it

15 months agoMerge pull request #34202 from AdrianVovk/sysupdated-fixups
Adrian Vovk [Mon, 2 Sep 2024 20:35:02 +0000 (16:35 -0400)]
Merge pull request #34202 from AdrianVovk/sysupdated-fixups

sysupdated: Bugfixes & improvements

15 months agotest: don't install Python scripts from systemd-test RPM
Frantisek Sumsal [Mon, 2 Sep 2024 14:24:35 +0000 (16:24 +0200)]
test: don't install Python scripts from systemd-test RPM

The original regex didn't cover the `run-unit-tests.py` script that
made the old framework pull in Python into the test image, which in turn
allowed the new TEST-69-SHUTDOWN Python script to get executed in the
old framework's image, causing unexpected fails with latest Python on
Rawhide.

15 months agosysupdated: Improve logging about jobs
Adrian Vovk [Sat, 31 Aug 2024 04:42:54 +0000 (00:42 -0400)]
sysupdated: Improve logging about jobs

If someone runs `updatectl update`, sysupdate will be running multiple
update jobs at the same time, which can make reasoning about the output
in the journal quite difficult. Especially if things go wrong: the error
messages didn't mention which job failed. Nor was there any link between
job ID and the PID of the worker process logging to the journal. This
is all fixed here!

15 months agosysupdated: Cleanup handling of notifications
Adrian Vovk [Sat, 31 Aug 2024 04:10:23 +0000 (00:10 -0400)]
sysupdated: Cleanup handling of notifications

Cuts out some `strdup`s, and also avoids a rather weird case of donating
memory to a function. Basically just duplicates the solution I just
implemented for sysupdate's callout handler.

15 months agosysupdate: Don't ignore callout binary failure
Adrian Vovk [Sat, 31 Aug 2024 03:58:19 +0000 (23:58 -0400)]
sysupdate: Don't ignore callout binary failure

Previously, if the callout binary (i.e. sd-pull, sd-import) failed
gracefully, we'd return its exit status from the event loop and thus
from run_callout(). Of course, exit status is a positive number in the
event of failure. Which means that we completely ignore the callout
binary failing, and instead continue using whatever it managed to
download before failing.

This is bad for obvious reasons, not the least of which is installing
a half-downloaded OS. This also means that we would completely ignore
failed signature checks 😬️

15 months agoportable: ensure PORTABLE_FORCE_ATTACH works even when there is a leftover unit
Luca Boccassi [Fri, 30 Aug 2024 16:55:18 +0000 (17:55 +0100)]
portable: ensure PORTABLE_FORCE_ATTACH works even when there is a leftover unit

Force means force, we skip checks with PID1 for existing units, but
then bail out with EEXIST if the files are actually there. Overwrite
everything instead.

15 months agoefi: add file_handle_read() helper that reads from a file handle
Lennart Poettering [Fri, 28 Jun 2024 17:40:27 +0000 (19:40 +0200)]
efi: add file_handle_read() helper that reads from a file handle

15 months agoefi: return pointer to processed string in strtolower8()/strtolower16()
Lennart Poettering [Thu, 4 Jul 2024 15:13:02 +0000 (17:13 +0200)]
efi: return pointer to processed string in strtolower8()/strtolower16()

15 months agonetworkd: Replace existing objects instead of doing nothing if they exist
Daan De Meyer [Thu, 1 Aug 2024 12:38:05 +0000 (14:38 +0200)]
networkd: Replace existing objects instead of doing nothing if they exist

Currently, if for example a traffic control object already exist, networkd
will silently do nothing, even if the settings in the network file for the
traffic control object have changed. Let's instead replace the object if it
already exists so that new settings from the network file are applied as
expected.

Fixes #31226

15 months agonetwork/tclass: do not save tclass to Link before it is configured
Yu Watanabe [Mon, 2 Sep 2024 04:15:49 +0000 (13:15 +0900)]
network/tclass: do not save tclass to Link before it is configured

Otherwise, if the same kind of tclass is already assigned, parameters
configured in .network file will not be used. So, let's first copy the
tclass and put it on Request, then on success generate a new copy based
on the netlink notification and store it to Link.

This is the same as 0a0c2672dbd22dc85d660e5baa7e1bef701beb88,
65f5f581568448d6098358b704cae10a656d09f0, and friends, but for tclass.

15 months agonetwork/qdisc: do not save qdisc to Link before it is configured
Yu Watanabe [Mon, 2 Sep 2024 03:27:04 +0000 (12:27 +0900)]
network/qdisc: do not save qdisc to Link before it is configured

Otherwise, if the same kind of qdisc is already assigned, parameters
configured in .network file will not be used. So, let's first copy the
qdisc and put it on Request, then on success generate a new copy based
on the netlink notification and store it to Link.

This is the same as 0a0c2672dbd22dc85d660e5baa7e1bef701beb88,
65f5f581568448d6098358b704cae10a656d09f0, and friends, but for qdisc.

Preparation for fixing #31226.

15 months agonetwork/tclass: make tclass_drop() static
Yu Watanabe [Mon, 2 Sep 2024 04:22:41 +0000 (13:22 +0900)]
network/tclass: make tclass_drop() static

This also drops unused constant return value.

15 months agonetwork/qdisc: make qdisc_drop() static
Yu Watanabe [Mon, 2 Sep 2024 04:20:59 +0000 (13:20 +0900)]
network/qdisc: make qdisc_drop() static

This also drops unused constant return value.

15 months agonetwork/tclass: skip requesting tclass if it is already requested
Yu Watanabe [Mon, 2 Sep 2024 04:06:54 +0000 (13:06 +0900)]
network/tclass: skip requesting tclass if it is already requested

15 months agonetwork/qdisc: skip requesting qdisc if it is already requested
Yu Watanabe [Mon, 2 Sep 2024 03:55:59 +0000 (12:55 +0900)]
network/qdisc: skip requesting qdisc if it is already requested

15 months agonetwork/neighbor: skip requesting neighbor if it is already requested
Yu Watanabe [Mon, 2 Sep 2024 04:03:09 +0000 (13:03 +0900)]
network/neighbor: skip requesting neighbor if it is already requested

15 months agonetwork/tclass: introduce tclass_ref() and tclass_unref()
Yu Watanabe [Mon, 2 Sep 2024 02:59:51 +0000 (11:59 +0900)]
network/tclass: introduce tclass_ref() and tclass_unref()

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

15 months agonetwork/qdisc: introduce qdisc_ref() and qdisc_unref()
Yu Watanabe [Mon, 2 Sep 2024 02:41:57 +0000 (11:41 +0900)]
network/qdisc: introduce qdisc_ref() and qdisc_unref()

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

15 months agoconf-parser: use log_syntax_parse_error() and friends more
Yu Watanabe [Tue, 27 Aug 2024 01:59:53 +0000 (10:59 +0900)]
conf-parser: use log_syntax_parse_error() and friends more

This also makes all conf parsers defined in conf-parser.c return 1
on success, 0 on non-critical error.
Also, use free_and_strdup_warn() where applicable.

15 months agoconf-parser: several cleanups for DEFINE_CONFIG_PARSE_ENUMV() macro
Yu Watanabe [Sun, 1 Sep 2024 21:11:32 +0000 (06:11 +0900)]
conf-parser: several cleanups for DEFINE_CONFIG_PARSE_ENUMV() macro

- use GREEDY_REALLOC() and FOREACH_ARRAY(),
- do not set an array with only terminating 'invalid' value.

Note, this macro is only used by parsing NamePolicy= and AlternativeNamesPolicy=
in .link files. and udevd correctly handles both an empty array and an
array with only 'invalid'. Hence, this does not change any behavior.

15 months agotree-wide: drop msg argument for DEFINE_CONFIG_PARSE() macro and friends
Yu Watanabe [Tue, 27 Aug 2024 01:20:03 +0000 (10:20 +0900)]
tree-wide: drop msg argument for DEFINE_CONFIG_PARSE() macro and friends

This makes the macros use log_syntax_parse_error(), hopefully which provides
more informative log message in general, and reduces binary size.

15 months agolog: protect errno from log_syntax_invalid_utf8_internal()
Yu Watanabe [Sun, 1 Sep 2024 07:17:08 +0000 (16:17 +0900)]
log: protect errno from log_syntax_invalid_utf8_internal()

Potentially, utf8_escape_invalid() called by
log_syntax_invalid_utf8_internal() may update errno.

15 months agolog: introduce log_syntax_parse_error()
Yu Watanabe [Thu, 22 Aug 2024 05:14:03 +0000 (14:14 +0900)]
log: introduce log_syntax_parse_error()

This provides generic error message for failures in conf parsers.
Currently this is not used, but will be used later.

15 months agotest: modernize test-networkd-conf
Yu Watanabe [Tue, 27 Aug 2024 02:47:35 +0000 (11:47 +0900)]
test: modernize test-networkd-conf

15 months agotest: modernize test-conf-parser.c
Yu Watanabe [Tue, 27 Aug 2024 02:58:25 +0000 (11:58 +0900)]
test: modernize test-conf-parser.c

15 months agoconf-parser: make config_parse_strv() stricter and optionally drop duplicated entries
Yu Watanabe [Sat, 31 Aug 2024 02:22:55 +0000 (11:22 +0900)]
conf-parser: make config_parse_strv() stricter and optionally drop duplicated entries

15 months agoconf-parser: fix memleak in config_parse_calendar()
Yu Watanabe [Tue, 27 Aug 2024 02:17:56 +0000 (11:17 +0900)]
conf-parser: fix memleak in config_parse_calendar()

Fixes a bug introduced by 0e10c3d8724b0a5d07871c9de71565ac91dd55b7 (#25049).

15 months agonetwork/route: fix typo
Yu Watanabe [Sun, 1 Sep 2024 13:03:09 +0000 (22:03 +0900)]
network/route: fix typo

Follow-up for c8dbf9acc10939f2d6c4bdd8cdee1d2ff9a4204e.

15 months agoMerge pull request #34213 from yuwata/network-route-fix-weight
Luca Boccassi [Sun, 1 Sep 2024 10:54:05 +0000 (11:54 +0100)]
Merge pull request #34213 from yuwata/network-route-fix-weight

network/route: fix adjustment of nexthop weight

15 months agonetwork/route: fix adjustment of nexthop weight
Yu Watanabe [Sun, 1 Sep 2024 02:52:12 +0000 (11:52 +0900)]
network/route: fix adjustment of nexthop weight

Fixes #34167.

15 months agonetwork/route: also update source, status, and so on EEXIST
Yu Watanabe [Sun, 1 Sep 2024 01:39:51 +0000 (10:39 +0900)]
network/route: also update source, status, and so on EEXIST

Otherwise, an existing route may be labeled as foreign even after we
reconfigure it.

15 months agonetwork/route: also show weight of gateway in debugging logs
Yu Watanabe [Sun, 1 Sep 2024 02:09:45 +0000 (11:09 +0900)]
network/route: also show weight of gateway in debugging logs

15 months agobasic/raw-clone: refuse CLONE_PIDFD too
Mike Yuan [Wed, 28 Aug 2024 17:15:10 +0000 (19:15 +0200)]
basic/raw-clone: refuse CLONE_PIDFD too

15 months agodocs/UIDS-GIDS: drop obsolete comment about Fedora
Zbigniew Jędrzejewski-Szmek [Sat, 31 Aug 2024 10:58:00 +0000 (13:58 +0300)]
docs/UIDS-GIDS: drop obsolete comment about Fedora

https://fedoraproject.org/wiki/Changes/RenameNobodyUser, 2018:
> Use "nobody:nobody" as the names for the kernel overflow UID:GID pair, and
> retire the old "nfsnobody" name and the old "nobody:nobody" pair with 99:99
> numbers.

15 months agotest-network: use the same MTU bytes for veth interfaces
Yu Watanabe [Sat, 31 Aug 2024 07:28:14 +0000 (16:28 +0900)]
test-network: use the same MTU bytes for veth interfaces

Hopefully fixes #34204.