mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 11:28:32 +02:00
vpn: merge branch 'bg/vpn-honor-ip-method'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1456
This commit is contained in:
commit
c19f03a463
1 changed files with 29 additions and 10 deletions
|
|
@ -107,14 +107,15 @@ typedef struct {
|
||||||
NMIPAddr gw_internal;
|
NMIPAddr gw_internal;
|
||||||
NMIPAddr gw_external;
|
NMIPAddr gw_external;
|
||||||
|
|
||||||
/* Whether this address family is enabled. If not, then we won't have a l3cd instance,
|
/* Whether VPN auto-configuration is enabled in the connection profile for
|
||||||
* but the activation for this address family is still complete. */
|
* this address family. */
|
||||||
bool enabled : 1;
|
bool method_auto : 1;
|
||||||
|
|
||||||
/* Whether this address family is ready. This means we received the IP configuration.
|
/* Whether VPN auto-configuration is enabled, in the connection profile AND
|
||||||
* Usually this implies we also have a corresponding l3cd, but that might not be the
|
* in the configuration reported by the VPN. If not, then we won't have a
|
||||||
* case if this address family is disabled. */
|
* l3cd instance, but the activation for this address family is still
|
||||||
bool conf_ready : 1;
|
* complete. */
|
||||||
|
bool enabled : 1;
|
||||||
} IPData;
|
} IPData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -1870,9 +1871,16 @@ _dbus_signal_config_cb(NMVpnConnection *self, GVariant *dict)
|
||||||
else
|
else
|
||||||
priv->ip_data_6.enabled = FALSE;
|
priv->ip_data_6.enabled = FALSE;
|
||||||
|
|
||||||
_LOGD("config: reply received (IPv4:%s, IPv6:%s)",
|
_LOGD("config: reply received (IPv4:%s(%s), IPv6:%s(%s))",
|
||||||
priv->ip_data_4.enabled ? "on" : "off",
|
priv->ip_data_4.enabled ? "on" : "off",
|
||||||
priv->ip_data_6.enabled ? "on" : "off");
|
priv->ip_data_4.method_auto ? "auto" : "disabled",
|
||||||
|
priv->ip_data_4.enabled ? "on" : "off",
|
||||||
|
priv->ip_data_6.method_auto ? "auto" : "disabled");
|
||||||
|
|
||||||
|
if (!priv->ip_data_4.method_auto)
|
||||||
|
priv->ip_data_4.enabled = FALSE;
|
||||||
|
if (!priv->ip_data_6.method_auto)
|
||||||
|
priv->ip_data_6.enabled = FALSE;
|
||||||
|
|
||||||
if (priv->vpn_state == STATE_CONNECT)
|
if (priv->vpn_state == STATE_CONNECT)
|
||||||
_set_vpn_state(self, STATE_IP_CONFIG_GET, NM_ACTIVE_CONNECTION_STATE_REASON_NONE, FALSE);
|
_set_vpn_state(self, STATE_IP_CONFIG_GET, NM_ACTIVE_CONNECTION_STATE_REASON_NONE, FALSE);
|
||||||
|
|
@ -1936,7 +1944,8 @@ _dbus_signal_ip_config_cb(NMVpnConnection *self, int addr_family, GVariant *dict
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->ip_data_4.enabled = TRUE;
|
if (priv->ip_data_4.method_auto)
|
||||||
|
priv->ip_data_4.enabled = TRUE;
|
||||||
priv->ip_data_6.enabled = FALSE;
|
priv->ip_data_6.enabled = FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1953,6 +1962,11 @@ _dbus_signal_ip_config_cb(NMVpnConnection *self, int addr_family, GVariant *dict
|
||||||
_set_vpn_state(self, STATE_IP_CONFIG_GET, NM_ACTIVE_CONNECTION_STATE_REASON_NONE, FALSE);
|
_set_vpn_state(self, STATE_IP_CONFIG_GET, NM_ACTIVE_CONNECTION_STATE_REASON_NONE, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!priv->ip_data_x[IS_IPv4].enabled) {
|
||||||
|
_check_complete(self, TRUE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ip_ifindex = nm_vpn_connection_get_ip_ifindex(self, TRUE);
|
ip_ifindex = nm_vpn_connection_get_ip_ifindex(self, TRUE);
|
||||||
if (ip_ifindex <= 0)
|
if (ip_ifindex <= 0)
|
||||||
g_return_if_reached();
|
g_return_if_reached();
|
||||||
|
|
@ -2758,6 +2772,11 @@ nm_vpn_connection_activate(NMVpnConnection *self, NMVpnPluginInfo *plugin_info)
|
||||||
|
|
||||||
_LOGI("starting %s", nm_vpn_plugin_info_get_name(plugin_info));
|
_LOGI("starting %s", nm_vpn_plugin_info_get_name(plugin_info));
|
||||||
|
|
||||||
|
priv->ip_data_4.method_auto = nm_streq0(nm_utils_get_ip_config_method(connection, AF_INET),
|
||||||
|
NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
||||||
|
priv->ip_data_6.method_auto = nm_streq0(nm_utils_get_ip_config_method(connection, AF_INET6),
|
||||||
|
NM_SETTING_IP6_CONFIG_METHOD_AUTO);
|
||||||
|
|
||||||
priv->connection_can_persist = nm_setting_vpn_get_persistent(s_vpn);
|
priv->connection_can_persist = nm_setting_vpn_get_persistent(s_vpn);
|
||||||
priv->plugin_info = g_object_ref(plugin_info);
|
priv->plugin_info = g_object_ref(plugin_info);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue