From 09e74f30d3a89e0cd2f54a845671bfebccb53fda Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 18 Nov 2025 17:59:49 +0100 Subject: [PATCH] vpn: clear the l3cd when the plugin reports that IP is disabled Until now, the VPN connection started with no IP configuration, gained it at some point later, and never removed it again. With the next commit, NM will support VPN connections in listening mode. When the remote host connects the IP configuration is added. When it disconnects, it is removed. If the IP configuration is removed, we need to clear the corresponding l3cd. --- src/core/vpn/nm-vpn-connection.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/vpn/nm-vpn-connection.c b/src/core/vpn/nm-vpn-connection.c index 0b36459cf7..0b21a16e74 100644 --- a/src/core/vpn/nm-vpn-connection.c +++ b/src/core/vpn/nm-vpn-connection.c @@ -1919,6 +1919,13 @@ _dbus_signal_config_cb(NMVpnConnection *self, GVariant *dict) priv->ip_data_6.enabled ? "on" : "off", priv->ip_data_6.method_auto ? "auto" : "disabled"); + if (!priv->ip_data_4.enabled) { + _l3cfg_l3cd_set(self, L3CD_TYPE_IP_4, NULL); + } + if (!priv->ip_data_6.enabled) { + _l3cfg_l3cd_set(self, L3CD_TYPE_IP_6, NULL); + } + if (!priv->ip_data_4.method_auto) priv->ip_data_4.enabled = FALSE; if (!priv->ip_data_6.method_auto) @@ -2005,6 +2012,7 @@ _dbus_signal_ip_config_cb(NMVpnConnection *self, int addr_family, GVariant *dict } if (!priv->ip_data_x[IS_IPv4].enabled) { + _l3cfg_l3cd_set(self, L3CD_TYPE_IP_X(IS_IPv4), NULL); _check_complete(self, TRUE); return; }