1
0
mirror of https://github.com/systemd/systemd synced 2026-04-07 07:34:50 +02:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
15bd1496c9 meson: bump version to 258.2 2025-11-07 13:43:07 +01:00
Nick Rosbrook
710843e562 wait-online: dispatch DNSConfiguration with SD_JSON_ALLOW_EXTENSIONS
Currently if an unknown field is encountered in the JSON, it is a fatal
error. Dispatch with SD_JSON_ALLOW_EXTENSIONS to avoid this.

(cherry picked from commit 5e777155d5b6c7aa86fa13316eb034b8036ac623)
2025-11-07 13:24:42 +01:00
Yu Watanabe
84a4e4affd network: do not restart DHCPv4 client on stopping/restarting networkd
Follow-up for fc35a9f8d1632c4e7a279228f869bfc77d8f5b9c (v255).
Fixes #39299.

(cherry picked from commit b1ba55a8a7a69afb389b1c0791cb3ea49c858694)
2025-11-07 13:24:42 +01:00
Yu Watanabe
6cd25c8ebb network: propagate error in link_carrier_lost()
Follow-up for 07021ed4f5ee5e34b06fcba97cab2c6214f601c9 (v258).

(cherry picked from commit 3f9db926e47b6f8e70a2b8e500403b88f3fa0682)
2025-11-07 13:24:42 +01:00
Yu Watanabe
33528484c4 network/sysctl: logs when per-link IPMasquerade= setting changes the global IPv6Forwarding= setting
All other cases, settings on different interfaces are completely
independent. But IPMasquerade=yes on an interface enables the global
IPv6Forwarding= setting, and hence affects other interfaces.
Let's log about that.

Prompted by https://github.com/systemd/systemd/issues/39304#issuecomment-3430382233.

(cherry picked from commit b5d63191cabc4b60744d743c28bc2f9a2419e711)
2025-11-07 13:24:42 +01:00
Lennart Poettering
2a908e9a93 main: switch explicitly to tty1 on soft-reboot
Fixes: #39462
(cherry picked from commit 6fa83be763f588038c3054cabdf0d3b5b42bc929)
2025-11-07 13:24:42 +01:00
Allison Karlitskaya
d3a4313524 udevadm: flush output after each monitor event
If you're using `udevadm monitor` from a script, without a tty, then
libc defaults to being fully-buffered, and won't flush stdout after
newlines.  This is fine for tools that dump a bunch of data and then
exit immediately.  It's a problem for tools like `udevadm monitor` which
have long pauses: the buffered data can get stuck in the buffer for an
unbounded amount of time.

In the Cockpit project we've been working around this for some time with
`stdbuf` which is a `LD_PRELOAD` hack to change the libc buffering
behaviour, but we'd like to stop doing that.

Let's make sure we flush the buffer after each event.

(cherry picked from commit 516df12af9679ab25c39813d6787b0f044a53990)
2025-11-07 13:24:42 +01:00
8 changed files with 44 additions and 4 deletions

View File

@ -1 +1 @@
258.1
258.2

View File

@ -163,6 +163,8 @@ static inline bool osc_char_is_valid(char c) {
return (unsigned char) c >= 32 && (unsigned char) c < 127;
}
#define VTNR_MAX 63
static inline bool vtnr_is_valid(unsigned n) {
return n >= 1 && n <= 63;
return n >= 1 && n <= VTNR_MAX;
}

View File

@ -3,6 +3,7 @@
#include <fcntl.h>
#include <getopt.h>
#include <linux/oom.h>
#include <linux/vt.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/prctl.h>
@ -1927,6 +1928,32 @@ static void finish_remaining_processes(ManagerObjective objective) {
broadcast_signal(SIGKILL, /* wait_for_exit= */ false, /* send_sighup= */ false, arg_defaults.timeout_stop_usec);
}
static void reduce_vt(ManagerObjective objective) {
int r;
if (objective != MANAGER_SOFT_REBOOT)
return;
/* Switches back to VT 1, and releases all other VTs, in an attempt to return to a situation similar
* to how it was during the original kernel initialization. This is important because if some random
* TTY is in foreground, /dev/console will end up pointing to it, where the future init system will
* then write its status output to, but where it probably shouldn't be writing to. */
r = chvt(1);
if (r < 0)
log_debug_errno(r, "Failed to switch to VT TTY 1, ignoring: %m");
_cleanup_close_ int tty0_fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
if (tty0_fd < 0)
return (void) log_debug_errno(tty0_fd, "Failed to open '/dev/tty0', ignoring: %m");
for (int ttynr = 2; ttynr <= VTNR_MAX; ttynr++)
if (ioctl(tty0_fd, VT_DISALLOCATE, ttynr) < 0)
log_debug_errno(errno, "Failed to disallocate VT TTY %i, ignoring: %m", ttynr);
else
log_debug("Successfully disallocated VT TTY %i.", ttynr);
}
static int do_reexecute(
ManagerObjective objective,
int argc,
@ -1994,6 +2021,7 @@ static int do_reexecute(
(void) setrlimit(RLIMIT_MEMLOCK, saved_rlimit_memlock);
finish_remaining_processes(objective);
reduce_vt(objective);
if (switch_root_dir) {
r = switch_root(/* new_root= */ switch_root_dir,

View File

@ -1762,8 +1762,14 @@ int dhcp4_start_full(Link *link, bool set_ipv6_connectivity) {
int r;
assert(link);
assert(link->manager);
assert(link->network);
/* On stopping/restarting networkd, we may drop IPv6 connectivity (which depends on KeepConfiguration=
* setting). Do not (re)start DHCPv4 client in that case. See issue #39299. */
if (link->manager->state != MANAGER_RUNNING)
return 0;
if (!link->dhcp_client)
return 0;

View File

@ -2225,7 +2225,7 @@ static int link_update_flags(Link *link, sd_netlink_message *message) {
if (!had_carrier && link_has_carrier(link))
r = link_carrier_gained(link);
else if (had_carrier && !link_has_carrier(link))
link_carrier_lost(link);
r = link_carrier_lost(link);
if (r < 0)
return r;

View File

@ -377,6 +377,8 @@ static int link_set_ip_forwarding(Link *link, int family) {
if (FLAGS_SET(link->network->ip_masquerade, AF_TO_ADDRESS_FAMILY(family)) &&
link->manager->ip_forwarding[family == AF_INET6] < 0) {
log_link_notice(link, "IPMasquerade= is enabled on the interface, enabling the global IPv6Forwarding= setting, which may affect NDisc and DHCPv6 client on other interfaces.");
link->manager->ip_forwarding[family == AF_INET6] = true;
manager_set_ip_forwarding(link->manager, family);

View File

@ -198,7 +198,7 @@ static int dispatch_dns_configuration(const char *name, sd_json_variant *variant
}
int dns_configuration_from_json(sd_json_variant *variant, DNSConfiguration **ret) {
return dispatch_dns_configuration(NULL, variant, SD_JSON_LOG, ret);
return dispatch_dns_configuration(NULL, variant, SD_JSON_LOG|SD_JSON_ALLOW_EXTENSIONS, ret);
}
bool dns_is_accessible(DNSConfiguration *c) {

View File

@ -55,6 +55,8 @@ static int device_monitor_handler(sd_device_monitor *monitor, sd_device *device,
printf("\n");
}
fflush(stdout);
return 0;
}