1
0
mirror of https://github.com/systemd/systemd synced 2025-10-05 16:03:15 +02:00

network: fix segfault in setting bridge vlan (#38519)

This commit is contained in:
Luca Boccassi
2025-08-08 15:04:33 +01:00
committed by GitHub
2 changed files with 19 additions and 5 deletions

View File

@@ -245,7 +245,7 @@ int bridge_vlan_set_message(Link *link, sd_netlink_message *m, bool is_set) {
if (r < 0)
return r;
if (link->master_ifindex <= 0 || streq(link->kind, "bridge")) {
if (link->master_ifindex <= 0 || streq_ptr(link->kind, "bridge")) {
/* If the setting is requested in a .network file for a bridge master (or a physical master)
* interface, then BRIDGE_FLAGS_SELF flag needs to be set. */
r = sd_netlink_message_append_u16(m, IFLA_BRIDGE_FLAGS, BRIDGE_FLAGS_SELF);

View File

@@ -427,6 +427,8 @@ def save_active_units():
'systemd-networkd.socket',
'systemd-networkd-varlink.socket',
'systemd-networkd.service',
'systemd-resolved-monitor.socket',
'systemd-resolved-varlink.socket',
'systemd-resolved.service',
'systemd-timesyncd.service',
'firewalld.service'
@@ -436,19 +438,31 @@ def save_active_units():
active_units.append(u)
def restore_active_units():
has_socket = False
has_network_socket = False
has_resolve_socket = False
if 'systemd-networkd.socket' in active_units:
call('systemctl stop systemd-networkd.socket')
has_socket = True
has_network_socket = True
if 'systemd-networkd-varlink.socket' in active_units:
call('systemctl stop systemd-networkd-varlink.socket')
has_socket = True
has_network_socket = True
if has_socket:
if 'systemd-resolved-monitor.socket' in active_units:
call('systemctl stop systemd-resolved-monitor.socket')
has_resolve_socket = True
if 'systemd-resolved-varlink.socket' in active_units:
call('systemctl stop systemd-resolved-varlink.socket')
has_resolve_socket = True
if has_network_socket:
call('systemctl stop systemd-networkd.service')
if has_resolve_socket:
call('systemctl stop systemd-resolved.service')
for u in active_units:
call(f'systemctl restart {u}')