1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-27 03:21:32 +03:00
Commit Graph

60205 Commits

Author SHA1 Message Date
Thomas Hebb
2ccada8dc4 network: don't forget old RAs when a new one arrives
IPv6 Neighbor Discovery lets us autoconfigure a link's IPv6 addresses,
routes, DNS servers, and DNS search domains by listening for Router
Advertisement (RA) packets broadcast by one or more routers on the link.
Each RA can contain zero or more "options," each describing one piece of
configuration (e.g. a single route).

Currently, when we receive an RA from a router, we delete any addresses,
routes, etc. that originated from that router's previous RAs unless
they're also present as options in the new RA.

That behavior is a violation of RFC 4861[1]. In Section 9, the RFC
states that

    Senders MAY send a subset of options in different packets. ... Thus,
    a receiver MUST NOT associate any action with the absence of an
    option in a particular packet. This protocol specifies that
    receivers should only act on the expiration of timers and on the
    information that is received in the packets.

Several other passages in the RFC reiterate this. Section 6.2.3:

    A router MAY choose not to include some or all options when sending
    unsolicited Router Advertisements.

Section 6.3.4:

    Hosts accept the union of all received information; the receipt of a
    Router Advertisement MUST NOT invalidate all information received in
    a previous advertisement or from another source.

At least one consumer router in production today, the Google Nest Wifi,
often sends RAs that omit its global IPv6 prefix. When current versions
of systemd-networkd receive those RAs, they immediately delete the
interface's global IPv6 address, which breaks IPv6 connectivity.

Fix the issue by removing the invalidation logic entirely. It's not
needed at all, since we already invalidate addresses, routes, and DNS
configuration when the interface goes down or their lifetimes expire.

This fix does have the side effect of preventing changes to the .network
file (e.g. denylisted prefixes, whether to add routes from RAs) from
taking effect as soon as a new RA arrives. Instead, a full interface
reconfiguration is needed. But triggering those changes on RA receipt
was already rather arbitrary and out of the administrator's control, so
I think this change is fine.

commit 69203fba70 ("network: ndisc: remove old addresses and routes
after at least one SLAAC address becomes ready") introduced this
behavior. commit 50550722e3 fixed it partially, by preventing one
router's RAs from invalidating another router's configuration.

[1] https://www.rfc-editor.org/rfc/rfc4861

Fixes: 69203fba70 ("network: ndisc: remove old addresses and routes after at least one SLAAC address becomes ready")
2022-10-03 09:59:37 +09:00
Yu Watanabe
64ebc0da03 resolve: fix typo 2022-10-03 09:23:37 +09:00
Daan De Meyer
f0e6cb196e repart: Take --root into account in read only filesystems shortcut 2022-10-03 08:00:07 +09:00
Yu Watanabe
59fde24c60
Merge pull request #24897 from mrc0mmand/TEST-64-sanitiers-open-scsi
test: pre-load ASan's DSO for iscsi-init.service
2022-10-03 07:51:50 +09:00
Frantisek Sumsal
326425fb4d test: pre-load ASan's DSO for iscsi-init.service
The iscsi-init.service calls `sh` which might, in certain circumstances,
pull in instrumented systemd NSS modules causing `sh` to fail. Let's mitigate
this by pulling in an env file crafted by `create_asan_wrapper()` that
(among others) pre-loads ASan's DSO.
2022-10-02 22:53:26 +02:00
Frantisek Sumsal
25213e16f7 test: introduce a simple environment file for test service 2022-10-02 22:44:32 +02:00
Daan De Meyer
8e52ed024d repart: Don't fail on missing verity sig partition
Also, provide a proper error message when we fail to find a verity
sibling partition.
2022-10-02 14:08:34 +01:00
Frantisek Sumsal
9caab7b559 test: expand the expression in cleanup_initdir()
Otherwise we might unexpectedly return 1 if the `get_bool` call fails.

If the `get_bool` part in `get_bool "$TEST_SETUP_CLEANUP_ROOTDIR" &&  _umount_dir "${initdir:?}"`
fails, the whole expression will short-circuit evaluate to 1, and since it's
the last expression in the function it's also it's return value, which doesn't
reflect the original intent of the expression:

```
# BUILD_DIR=$PWD/build make -C test/TEST-64-UDEV-STORAGE/ setup run TESTCASES=testcase_always_skip
make: Entering directory '/home/fsumsal/repos/@systemd/systemd/test/TEST-64-UDEV-STORAGE'
TEST-64-UDEV-STORAGE SETUP: systemd-udev storage tests
Reusing existing image /var/tmp/systemd-test.uPbJZ9/default.img → /var/tmp/systemd-test.uPbJZ9/default.img
TEST-64-UDEV-STORAGE RUN: systemd-udev storage tests
------ testcase_always_skip: BEGIN ------
Skipping...
------ testcase_always_skip: END (SKIP) ------
Passed tests: 0
    *
Skipped tests: 1
    * testcase_always_skip
Failed tests: 0
    *
TEST-64-UDEV-STORAGE RUN: systemd-udev storage tests [OK]
make: Leaving directory '/home/fsumsal/repos/@systemd/systemd/test/TEST-64-UDEV-STORAGE'

# BUILD_DIR=$PWD/build make -C test/TEST-64-UDEV-STORAGE/ setup run TESTCASES=testcase_always_skip
make: Entering directory '/home/fsumsal/repos/@systemd/systemd/test/TEST-64-UDEV-STORAGE'
TEST-64-UDEV-STORAGE SETUP: systemd-udev storage tests
Reusing existing image /var/tmp/systemd-test.uPbJZ9/default.img → /var/tmp/systemd-test.uPbJZ9/default.img
make: *** [Makefile:4: setup] Error 1
make: Leaving directory '/home/fsumsal/repos/@systemd/systemd/test/TEST-64-UDEV-STORAGE'
```
2022-10-02 00:27:13 +01:00
Frantisek Sumsal
3d0c1256b4 test: drop the explicit bus assignment for the pci-bridge
as it doesn't work with the Q35 chipset due to a different topology.
Auto-assignment seems to work with both Q35 and i440FX chipsets.
2022-10-02 00:09:54 +02:00
Luca Boccassi
3cd1b8f403
Merge pull request #24878 from keszybz/condition-first-boot
Tweak condition first boot to use the same logic in pid1 and units
2022-10-01 19:30:21 +01:00
Maxim Mikityanskiy
2eb3f79c8a hwdb: Add Fn+F12 on HP Dragonfly G2 and mute extra rfkill keys
Add new key mappings for the HP Elite Dragonfly G2 laptop:

1. Map Fn+F12 (HP Programmable Key) to prog1.

2. Unmap Fn+F11 (Airplane mode) from atkbd and Intel HID events, as this
   key is also reported by HP Wireless hotkeys.
2022-10-01 19:28:47 +01:00
Clyde Byrd III
f63e259bb6 man: Update systemd.killMode docs 2022-10-01 16:58:48 +02:00
dependabot[bot]
8ef866ace4 build(deps): bump ninja from 1.10.2.3 to 1.10.2.4 in /.github/workflows
Bumps [ninja](https://github.com/ninja-build/ninja) from 1.10.2.3 to 1.10.2.4.
- [Release notes](https://github.com/ninja-build/ninja/releases)
- [Commits](https://github.com/ninja-build/ninja/commits)

---
updated-dependencies:
- dependency-name: ninja
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-01 14:36:48 +02:00
Frantisek Sumsal
f00fe51b9c ci: pin stefanbuck/github-issue-parser to a tagged release
Since [0] got resolved ([1]) we can finally pin the action to a tagged
release (v2.0.4 ATTOW) and let Dependabot to do its job by updating it
to the latest tagged release when it becomes available.

Replaces: #24886

[0] https://github.com/stefanbuck/github-issue-parser/issues/23
[1] https://github.com/stefanbuck/github-issue-parser/pull/39
2022-10-01 14:35:41 +02:00
dependabot[bot]
e316ab5747 build(deps): bump actions/labeler from 4.0.0 to 4.0.1
Bumps [actions/labeler](https://github.com/actions/labeler) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](9fd24f1f9d...e54e5b338f)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-01 13:04:34 +02:00
dependabot[bot]
254c049ccb build(deps): bump redhat-plumbers-in-action/differential-shellcheck
Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 3.0.1 to 3.1.1.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/CHANGELOG.md)
- [Commits](a14889568f...1b1b75e42f)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-01 13:04:15 +02:00
dependabot[bot]
5d4ba4e534 build(deps): bump meson from 0.63.1 to 0.63.2 in /.github/workflows
Bumps [meson](https://github.com/mesonbuild/meson) from 0.63.1 to 0.63.2.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/0.63.1...0.63.2)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-01 13:00:45 +02:00
Zbigniew Jędrzejewski-Szmek
bfa769d185 man: add cross-links about preset operations 2022-10-01 11:35:46 +02:00
Zbigniew Jędrzejewski-Szmek
7cd43e34c5 manager: fix/change evaluation of ConditionFirstBoot
The code to evaluate the kernel command line option was busted because it
was doing 'return b == !!r' at a point where 'r > 0'. Thus we'd return "true"
in both cases:

$ SYSTEMD_PROC_CMDLINE=systemd.condition-first-boot build/systemd-analyze condition 'ConditionFirstBoot=true'
test.service: ConditionFirstBoot=true succeeded.
Conditions succeeded.
$ SYSTEMD_PROC_CMDLINE=systemd.condition-first-boot build/systemd-analyze condition 'ConditionFirstBoot=false'
test.service: ConditionFirstBoot=false succeeded.
Conditions succeeded.

We only use 'ConditionFirstBoot=true' in units, so this wasn't noticed.

But I think the logic is broken in general: the condition should evaluate as
true only during initial boot. If we rerun the units at later points, we should
not consider ConditionFirstBoot to be true.

Also, the first boot logic is also used in pid1 itself. AFAICT, for two
things: in first boot machine-id is initialized transiently (this allows
first-boot operations to be restarted if boot fails), and preset-all is
executed. But this logic was different and separate from the logic to
evaluate ConditionFirstBoot. The distinction is abolished, and the operations
in pid1 now use the same logic as ConditionFirstBoot, which means that the
kernel command line option is checked, and condition_test_first_boot()
just tests whether pid1 thinks we're in first boot.

This makes things easier to grok for the user: there's just one condition for
"first boot" and it applies to both pid1 and units.
2022-10-01 11:35:46 +02:00
Zbigniew Jędrzejewski-Szmek
868e6ce65c docs/CONTRIBUTING: strenghten language about ABI stability, fix links, other tweaks
The text made it sound like breaking ABI in libsystemd is allowed with good reasons.
In fact, we plan never to do this, so make the language stronger.

Also remind people about distro forums for reporting bugs. Those are probably a
better place than systemd-devel for new users.

Also, add some missing articles and apostrophes, fix URLs, remove repeated phrases,
etc.
2022-10-01 11:29:24 +02:00
James Hilliard
0d73603b25 Revert "bpf: fix is_allow_list section"
GCC was modified to use the same default section as LLVM, as such
this is no longer required.

Details:
a0aafbc324

This reverts commit e8b1e9cf10.
2022-10-01 13:24:50 +09:00
James Hilliard
b88323e4e0 meson: set minimum libbpf/bpftool versions for bpf-gcc
We need the following libbpf commits for bpf-gcc compatibility:
 - 3d484ca473
 - b31ca3fa0e

These are first present in libbpf 1.0.0 and bpftool 7.0.0.
2022-10-01 13:24:37 +09:00
Luca Boccassi
7b8e0c3e9f
Merge pull request #24829 from yuwata/blockdev-new-from-fd
blockdev-util: introduce block_device_new_from_fd() and _path()
2022-09-30 20:07:49 +01:00
Luca Boccassi
e2ee0c0327
Merge pull request #24749 from yuwata/dissect-image-file
dissect-image: introduce dissect_image_file() which works for regular file instead of block device
2022-09-30 20:02:19 +01:00
Jacek Migacz
1ca3600120 resolve: unsupported DNSSEC algorithms are considered INSECURE; not BOGUS
Resolves: #19824
2022-09-30 18:46:08 +01:00
Zbigniew Jędrzejewski-Szmek
f4e5569190
Merge pull request #24639 from yuwata/test-mountpoint-util
test-mountpoint-util: support running on a mount namespace with another mount on /proc
2022-09-30 17:34:21 +02:00
Luca Boccassi
697f082697
Merge pull request #24853 from poettering/resolved-monitor-fixes
resolved: various monitor fixes
2022-09-30 15:46:13 +01:00
Luca Boccassi
e69e3830c3
Merge pull request #24739 from keszybz/coredump-formatting
Improve formatting of package metadata in coredumps
2022-09-30 15:42:15 +01:00
Zbigniew Jędrzejewski-Szmek
eb650ffedf firstboot: add debug logging
$ SYSTEMD_LOG_LEVEL=debug build/systemd-firstboot --prompt-root-password
Found container virtualization systemd-nspawn.
Found /etc/locale.conf, assuming locale information has been configured.
Failed to read credential firstboot.keymap, ignoring: No such device or address
Prompting for keymap was not requested.
Found /etc/localtime, assuming timezone has been configured.
Prompting for hostname was not requested.
Found /etc/machine-id, assuming machine-id has been configured.
Found /etc/passwd and /etc/shadow, assuming root account has been initialized.
Creation of /etc/kernel/cmdline was not requested, skipping.
2022-09-30 16:09:56 +02:00
Christian Hesse
e879434df5 systemctl: color ignored exit status in yellow, not red
If the executable path is prefixed with "-", an exit code of the command
normally considered a failure (i.e. non-zero exit status or abnormal exit
due to signal) is recorded, but has no further effect and is considered
equivalent to success.

Let's honor this with `systemctl status`, and color ignored exit status
in yellow, not red.
2022-09-30 15:02:50 +01:00
Jonas Kümmerlin
1355672437 generator: skip fsck if fsck command is missing
This is useful for systems which don't have any fsck.

We already skip emitting the fsck dependency when the fsck.$fstype helper
is missing, but fstab-generator doesn't necessarily know the fstype when
handling the root= parameter.

Previously, systemd-fsck was started for these mounts and then exited
immediately because it couldn't find the fsck.$fstype helper.
2022-09-30 15:01:41 +01:00
Luca Boccassi
ace212f577 portablectl: add --force attach/detach
Allows to skip check that ensures units must not be running.

I have a use case that would use reattach, except the orchestrator
is using a non-standard versioning scheme, so image matching cannot
work. As a workaround, need to be able to detach and then attach
manually, without stopping the units to avoid extended downtimes
and loss of FD store.
2022-09-30 13:25:31 +01:00
Lennart Poettering
de76643b3f update TODO 2022-09-30 14:25:13 +02:00
Lennart Poettering
b968890a87 test: rework resolved monitoring test
Let's remove some sleep loops, and instead:

1. Use Type=notify to wait until "resolvectl monitor" successfully
   installed its monitor, so that we know that queries enqueued later
   will definitely be seen.

2. Use "grep -m1" to watch "journalctl -f" output to wait precisely for
   the RR data we want to see, and immediately exit.

This shortens code quite a bit, and should make it more robust.
2022-09-30 14:24:41 +02:00
Lennart Poettering
fffbf1dc99 resolvectl: add new "monitor" verb 2022-09-30 14:24:08 +02:00
Franck Bui
e638a062e8
Merge pull request #24831 from poettering/dbus-dump-doc
man: clarify that D-Bus Dump() call is a debugging interface with no guarantees
2022-09-30 14:23:59 +02:00
Lennart Poettering
72c2d39ecb resolved: beef up monitor protocol, include full query info 2022-09-30 14:23:30 +02:00
Lennart Poettering
4d593fb151 resolved: add dns_question_merge() helper
Very similar to dns_answer_merge(), but for DnsQuestion objects instead
of DnsAnswer.
2022-09-30 14:22:53 +02:00
Lennart Poettering
1482c86a50 resolved: add generic formatters for RRs into JSON
For now we can use it to send broken-down records of JSON via the
monitor logic, but one day we can certainly reuse for dumping the
caches, or to implement a ResolveRecord() varlink call one day.
2022-09-30 14:22:15 +02:00
Lennart Poettering
ab26cdf730 resolved: split out helper for allocating DnsResourceRecord object from raw data
No change in behaviour, just some refactoring.
2022-09-30 14:21:38 +02:00
Lennart Poettering
b497a958d6 resolved: split out main server listening code from manager_varlink_init()
Just some minor refactoring, to make binding the two sockets (main +
minitor) symmetric
2022-09-30 14:21:05 +02:00
Lennart Poettering
b25d819aee resolved: don't make monitoring optional
The socket is only accessible to privileged clients anyway, no need to
add another (user unfriendly) restriction via opt-in setting. let's just
allow this for privileged clients, mirroring "busctl monitor", or
"tcpdump" and similar, which all just work if you have privs.

(This does not break API, since we never did a release witht the
"Monitor" dbus property or config setting in place, i.e. with
cb456374e0)
2022-09-30 14:20:28 +02:00
Lennart Poettering
227e127943 resolved: rename 'notification' → 'monitor'
We expose this externally already as "monitor", name it internally the
same way. (Which is nice since it mirrors busctl monitor)
2022-09-30 14:19:50 +02:00
Lennart Poettering
baf3fdec27 sd-event: add helper for exiting event loop on SIGTERM/SIGINT
In many (most?) of our event loops we want to exit once SIGTERM/SIGINT
is seen. Add a common helper for that, that does the right things in a
single call.
2022-09-30 14:18:43 +02:00
Lennart Poettering
897448bd37 sd-event: if signal nr has high bit set sd_event_add_signal() auto-block it via sigprocmask()
So far we expected callers to block the signals manually. Which is
usually a good idea, since they should do that before forking off
threads and similar. But let's add a mode where we automatically block
it for the caller, to simplify things.
2022-09-30 14:17:46 +02:00
Lennart Poettering
0b8218b901 json: explicitly support offsets relative to NULL when dispatching
Let's trick out UndefinedBehaviourSanitizer:

https://github.com/systemd/systemd/pull/24853#issuecomment-1263380745
2022-09-30 14:17:15 +02:00
Lennart Poettering
84738d864b json: add helper for json builder for octescape/base32hex
These encodings for binary data are mandated by DNS RFCs, so let's give
make them nice and easy to use with json builder logic.
2022-09-30 14:16:23 +02:00
Lennart Poettering
e085625f09 json: add dispatchers for 16bit integers 2022-09-30 14:15:37 +02:00
Lennart Poettering
24fe5e9807 glyph-util: add left arrow special glyph entry 2022-09-30 14:14:48 +02:00
Yu Watanabe
a78049fc0e resolve: do not cache mDNS goodbye packet
Fixes #24842.
2022-09-30 18:50:56 +09:00