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.
This commit is contained in:
Beniamino Galvani 2025-11-18 17:59:49 +01:00
parent bfbb8235bd
commit 09e74f30d3

View file

@ -1919,6 +1919,13 @@ _dbus_signal_config_cb(NMVpnConnection *self, GVariant *dict)
priv->ip_data_6.enabled ? "on" : "off", priv->ip_data_6.enabled ? "on" : "off",
priv->ip_data_6.method_auto ? "auto" : "disabled"); 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) if (!priv->ip_data_4.method_auto)
priv->ip_data_4.enabled = FALSE; priv->ip_data_4.enabled = FALSE;
if (!priv->ip_data_6.method_auto) 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) { if (!priv->ip_data_x[IS_IPv4].enabled) {
_l3cfg_l3cd_set(self, L3CD_TYPE_IP_X(IS_IPv4), NULL);
_check_complete(self, TRUE); _check_complete(self, TRUE);
return; return;
} }