1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-13 00:58:27 +03:00

52197 Commits

Author SHA1 Message Date
Luca Boccassi
4efc556211
network/ndisc: fix removal of unnecessary routes (#35128)
Follow-up for 972f1d17ab461a51142a142609dd3ec50bae8440.

This fixes the logic of removing unnecessary routes configured by the
previously received RAs. Previously, we wrongly handled existing routes
could be updated, and unexpected routes would be kept.
2024-11-13 14:06:21 +00:00
Yu Watanabe
b4dc8b6415
sd-boot/sd-stub: two log message fixes (#35143)
Fixes: #35033
Fixes: #35100
2024-11-13 10:09:05 +09:00
Yu Watanabe
d762b14e38
audit-util: return -ENODATA from audit_{session|loginuid}_from_pid() if invoked in a container (#35072)
The auditing subsystem is still not virtualized for containers, hence
the two values don't really make sense inside them, they will just leak
information from outside into the container. Hence don't make use of the
data if we detect we are run inside of a container.

This has visible effects: logind will no longer try to reuse the
auditing session ids as its own session ids when run inside a container.

While are at it, modernize the calls in more ways:

1. switch to pidref behaviour, all but one of our uses are using pidref
anyway already.
2. use read_virtual_file() + proc_mounted()
3. reasonably distinguish ENOENT errors when reading the process proc
files: distinguish the case where /proc is not mounted, from the case
where the process is already gone, from where auditing is not enabled in
the kernel build.
2024-11-13 10:08:29 +09:00
Lennart Poettering
ead9ef5027 ptyfwd: ellipsize overly long window titles
Apparently some terminal emulators have problems with overly long
titles, hence truncate them at some safe length (128).

Also, when parsing ANSI sequences ourselves accept longer sequences
(192), after all we should be fine when parsing our own title sequences.

Fixes: #35104
2024-11-13 10:07:25 +09:00
Mike Yuan
e2f82f6151 various: check meson feature flag early
Prompted by https://github.com/systemd/systemd/pull/35110#discussion_r1835885340
2024-11-13 08:21:33 +09:00
Lennart Poettering
f2b4f19881 pe: use PE_SECTION_VECTOR_IS_SET() macro where appropriate 2024-11-12 23:45:15 +01:00
Lennart Poettering
557d9fd5d1 pe: remove unnecessary log message about DT/HWID
Fixes: #35100
2024-11-12 23:45:14 +01:00
Lennart Poettering
1991ffa912 efi: don't log if EFI RNG isn't ready
Apparently this happens IRL on some systems, let's handle this
gracefully and don't log.

Fixes: #35033
2024-11-12 23:44:59 +01:00
Lennart Poettering
c892816ceb run0: when changing privileges to non-root, do not show superhero emoji
Let's show an idcard logo instead, to indicate that we changed ids.
2024-11-12 23:09:21 +01:00
Lennart Poettering
4e0bdf950e dbus-manager: add missing word 'unit' to PK message 2024-11-12 23:09:01 +01:00
Lennart Poettering
7bf0149e9b process-util: more gracefully handle oom adjust parsing/setting
Who knows what kind of mount shenanigans people employ, let's gracefully
handle parse failures of proc files, like we alway do otherwsie.
2024-11-12 23:03:40 +01:00
Lennart Poettering
68c554f23a audit-util: modernize use_audit() a bit
Use ERRNO_IS_xyz() macros where appropriate.

Also, reduce indentation a bit by inverted early check.

And log in more error codepaths.
2024-11-12 23:03:40 +01:00
Lennart Poettering
7e02ee98d8 audit-util: return -ENODATA from audit_{session|loginuid}_from_pid() if invoked in a container
The auditing subsystem is still not virtualized for containers, hence the two
values don't really make sense inside them, they will just leak
information from outside into the container. Hence don't make use of the
data if we detect we are run inside of a container.

This has visible effects: logind will no longer try to reuse the
auditing session ids as its own session ids when run inside a container.

While are at it, modernize the calls in more ways:

1. switch to pidref behaviour, all but one of our uses are using pidref
   anyway already.
2. use read_virtual_file() + proc_mounted()
3. reasonable distinguish ENOENT errors when reading the process proc
   files: distinguish the case where /proc is not mounted, from the case
   where the process is already gone, from where auditing is not enabled
   in the kernel build.
2024-11-12 23:03:03 +01:00
Lennart Poettering
4aaabb55c7 nspawn: fix indentation of run_container() parameter list 2024-11-12 18:31:56 +01:00
Lennart Poettering
9c56a3629f mntwork: shorten code 2024-11-12 18:31:56 +01:00
Lennart Poettering
0557f82650 dissect-image: remove dead code 2024-11-12 18:31:56 +01:00
Lennart Poettering
e688097ce3 mountfsd: drop unused variable 2024-11-12 18:31:56 +01:00
Antonio Alvarez Feijoo
2a310c0ad6 sbsign: remove unused --no-pager option 2024-11-12 17:52:48 +01:00
Yu Watanabe
e2060bc124 network/ndisc: restore the original preference and priority before checking if existing route can be updated
Follow-up for 972f1d17ab461a51142a142609dd3ec50bae8440.

This fixes the logic of removing unnecessary routes configured by the
previously received RAs. Previously, we wrongly handled existing routes
could be updated, and unexpected routes would be kept.
2024-11-12 18:08:25 +09:00
Yu Watanabe
74e0b590dd network/ndisc: introduce ndisc_route_prepare() and ndisc_router_route_prepare()
These applies common parameters to the route to be requested or removed.
No functional change, just refactoring and preparation for later
commits.
2024-11-12 18:08:25 +09:00
Yu Watanabe
42d9660f10 network/ndisc: several cleanups for ndisc_remove_route()
- drop unnecessary call of ndisc_set_route_priority() at the beginning,
  as it is called later in the loop below,
- use RET_GATHER() and remove all possible routes even if failed.
2024-11-12 18:08:25 +09:00
Yu Watanabe
2437ebee20 network/ndisc: introduce route_is_bound_to_link() helper function and use it where applicable
No functional change, and preparation for later commits.
2024-11-12 18:08:25 +09:00
Yu Watanabe
3304a029b8
network: forget IPv4 non-local routes when an interface went down (#35099)
Fixes #35047.
2024-11-12 01:07:43 +09:00
Lennart Poettering
67e003d7dd
Introduce systemd-keyutil to do various key/certificate operations (#35095)
Let's gather generic key/certificate operations in a new tool
systemd-keyutil instead of spreading them across various special purpose
tools.

Fixes #35087
2024-11-11 16:09:07 +01:00
Yu Watanabe
688f166972 network/nexthop: also forget IPv4 nexthops when an interface went down
Similar to the previous commit, but for nexthop.
2024-11-11 13:59:41 +00:00
Yu Watanabe
6954c38cf8 network/route: forget IPv4 non-local routes when an interface went down
When an interface went down, IPv4 non-local routes are removed by the
kernel without any notifications. Let's forget the routes in that case.

Fixes #35047.
2024-11-11 13:59:41 +00:00
Yu Watanabe
fd2ea787bd network/nexthop: forget dependent routes without trying to remove
When a nexthop is removed, routes depend on the removed nexthop are
already removed. It is not necessary to remove them, as already
commented. Let's forget them without trying to remove.
2024-11-11 13:59:41 +00:00
Yu Watanabe
1ca180b994 network/nexthop: do not remove depending nexthops when a nexthop is removed
Previously, when a nexthop is removed, depending nexthops were removed, but
that's not necessary, as the kernel keeps them, at least with v6.11.
2024-11-11 13:59:41 +00:00
Yu Watanabe
422e418ab9 network/route: update reference of the route from nexthop
Follow-up for 6f09031e4d04727cc72164fefcbc763e37556493.

The function has been introduced by the commit, but it has never been used...
2024-11-11 13:59:41 +00:00
Luca Boccassi
2e33cd7110
network: further rework for reconfiguring interfaces (#35059)
Follow-ups for #35035.
Split-out of #34989.
Fixes #35092.
2024-11-11 12:59:31 +00:00
Zbigniew Jędrzejewski-Szmek
211d2f972d Rename src/partition to src/repart 2024-11-11 09:17:10 +01:00
Yu Watanabe
82df2e0f04 network: make 'networkctl reconfigure' work safely even when KeepConfiguration=dhcp or yes
Previously, even if KeepConfiguration=dhcp or yes is specified in the
new .network file, dynamic configurations like DHCP address and routes
were dropped when 'networkctl reconfigure INTERFACE' is invoked.

If the setting is specified, let's gracefully handle the dynamic
configurations. Then, 'networkctl reconfigure' can be also used for
an interface that has critical connections.
2024-11-11 11:53:24 +09:00
Yu Watanabe
e8da735ceb network: drop static configs later
Follow-up for dd6d53a8dc58c5e6e310b09ba7f7a22600a87ba9.

Unnecessary static configs will be anyway dropped later in
link_configure() -> link_drop_unmanaged_config(). Hence, even if we are
reconfiguring an interface cleanly, it is not necessary to drop static
configs here.
2024-11-11 11:53:24 +09:00
Yu Watanabe
4e76c57c7f network/dhcp-pd: do not remove unreachable route when reconfiguring non-upstream interface
Unreachable routes are not owned by any interfaces, and its ifindex is
zero. Previously, if a non-upstream interface is reconfigured, all routes
including unreachable routes configured by the upstream interface are
removed.

This makes unreachable routes are always handled by the upstream interface,
and only removed when the delegated prefixes are changed or lost.
2024-11-11 11:53:24 +09:00
Yu Watanabe
42152390da network: reorder dropping dynamic configuration
Follow-up for 451c2baf30f50b95d73e648058c7c2348dbf0c31.
2024-11-11 11:53:24 +09:00
Yu Watanabe
52f46b77d7 network: reset 'configured' flags even if we keep DHCP lease and friends on reconfigure
Follow-up for 451c2baf30f50b95d73e648058c7c2348dbf0c31.

With the commits, reloading .network files does not release previously
acquired DHCP lease and friends if possible. If previously a DHCP client
was configured as not requesting DNS servers or so, then the previously
acquired lease might not contain any DNS servers. In that case, if the
new .network file enables UseDNS=, then the interface should enter the
configured state after a new lease is acquired. To achieve that, we need
to reset the flags.

With this change, the workaround applied to the test by the commit
451c2baf30f50b95d73e648058c7c2348dbf0c31 can be dropped.
2024-11-11 11:53:24 +09:00
Yu Watanabe
525a582ae8 network: drop unnecessary size specifier
It does not save any memory usage but increase code complexity.
2024-11-11 11:53:24 +09:00
Yu Watanabe
ed3bab7a0e netwrok: call link_drop_unmanaged_config() earlier in link_configure()
Otherwise, even if a link enters the configuring state at the beginning
of link_configure(), link_check_ready() may be called before
link_drop_unmanaged_config() is called, and the link may enter the
configured state.

Fixes #35092.
2024-11-11 11:53:24 +09:00
Zbigniew Jędrzejewski-Szmek
a32e1f8896 Move growfs+makefs to src/growfs/
Those two programs are used together and it makes sense to keep them
together. makefs is smaller, so name the directory after growfs.
2024-11-10 14:09:46 +01:00
Yu Watanabe
cf8fd7148c
Various multi-dt fixes and CHID test (#35056)
Part of #34158
2024-11-10 11:19:10 +09:00
12paper
8254755091
login: fix session_kill(..., KILL_LEADER,...) (#35105)
`loginctl kill-session --kill-whom=leader <N>` (or the D-Bus equivalent)
doesn't work because logind ends up calling `KillUnit(..., "main", ...)`
on a scope unit and these don't have a `MainPID` property. Here, I just
make it send a signal to the `Leader` directly.
2024-11-10 11:13:39 +09:00
Valentin David
053452e22b ukify: Fix broken assert when building a signed addon
An assert always expected a kernel when signature key was present in command
line. That prevented building signed addons.

Fixes #35041
2024-11-10 05:44:30 +09:00
Luca Boccassi
6d558e53c9
sysupdate: Bug fixes for target enumeration (#35052)
Fixes a couple of bugs with systemd-sysupdated's target enumeration. See
commit messages for details.











<!-- devel-freezer =
{"comment-id":"2460494553","freezing-tag":"v257-rc1"} -->
2024-11-08 23:21:29 +00:00
Lidong Zhong
2ae79a31b7 udev: skipping empty udev rules file while collecting the stats
To keep align with the logic used in udev_rules_parse_file(), we also
should skip the empty udev rules file while collecting the stats during
manager reload. Otherwise all udev rules files will be parsed again whenever
reloading udev manager with an empty udev rules file. It's time consuming
and the following uevents will fail with timeout.
2024-11-08 23:20:09 +00:00
Lennart Poettering
56933f2073 uid-classification: properly classify *all* container UIDs
A bit confusingly CONTAINER_UID_BASE_MAX is just the maximum *base* UID
for a container. Thus, with the usual 64K UID assignments, the last
actual container UID is CONTAINER_UID_BASE_MAX+0xFFFF.

To make this less confusing define CONTAINER_UID_MIN/MAX that add the
missing extra space.

Also adjust two uses where this was mishandled so far, due to this
confusion.

With this change the UID ranges we default to should properly match what
is documented on https://systemd.io/UIDS-GIDS/.
2024-11-08 23:18:39 +00:00
Daan De Meyer
4b1ad0398e Introduce systemd-keyutil to do various key/certificate operations
Let's gather generic key/certificate operations in a new tool
systemd-keyutil instead of spreading them across various special
purpose tools.

Fixes #35087
2024-11-08 15:00:21 +01:00
Yu Watanabe
5261c521e3 mount-util: make path_get_mount_info() work arbitrary inode
Follow-up for d49d95df0a260aaca9a3fdd1e6ce535592a53bca.
Replaces 9a032ec55a9820a0424309670fe551c99203e5f1.
Fixes #35075.
2024-11-08 13:25:17 +01:00
Lennart Poettering
af3baf174a fs-util: add comment about XO_NOCOW 2024-11-08 09:21:25 +01:00
anonymix007
310997d5b4 fundamental: Fix buffer size in get_chid
NUL byte should not be hashed
2024-11-08 00:53:26 +03:00
anonymix007
9f9c847609 fundamental: Fix iteration count in chid_calculate 2024-11-08 00:53:26 +03:00