mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 13:20:08 +01:00
vpn: allow overwriting default gateway by connection configuration
It is wrong to only consider internal_gateway of the VPN connection. Instead, we must first set the gateway of NMIP4Config and then overwrite it with the connection settings.
This commit is contained in:
parent
1465c1d326
commit
691ebbdc43
2 changed files with 6 additions and 3 deletions
|
|
@ -767,7 +767,7 @@ _ipx_update_default_route (const VTableIP *vtable, NMDefaultRouteManager *self,
|
|||
never_default = nm_ip4_config_get_never_default (vpn_config);
|
||||
rt.r4.ifindex = ip_ifindex;
|
||||
rt.r4.source = NM_IP_CONFIG_SOURCE_VPN;
|
||||
rt.r4.gateway = nm_vpn_connection_get_ip4_internal_gateway (vpn);
|
||||
rt.r4.gateway = nm_ip4_config_get_gateway (vpn_config);
|
||||
rt.r4.metric = nm_vpn_connection_get_ip4_route_metric (vpn);
|
||||
rt.r4.mss = nm_ip4_config_get_mss (vpn_config);
|
||||
default_route = &rt.rx;
|
||||
|
|
@ -777,7 +777,7 @@ _ipx_update_default_route (const VTableIP *vtable, NMDefaultRouteManager *self,
|
|||
|
||||
vpn_config = nm_vpn_connection_get_ip6_config (vpn);
|
||||
if (vpn_config) {
|
||||
const struct in6_addr *int_gw = nm_vpn_connection_get_ip6_internal_gateway (vpn);
|
||||
const struct in6_addr *int_gw = nm_ip6_config_get_gateway (vpn_config);
|
||||
|
||||
never_default = nm_ip6_config_get_never_default (vpn_config);
|
||||
rt.r6.ifindex = ip_ifindex;
|
||||
|
|
|
|||
|
|
@ -1191,8 +1191,10 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
|
|||
address.plen = 24;
|
||||
|
||||
/* Internal address of the VPN subnet's gateway */
|
||||
if (g_variant_lookup (dict, NM_VPN_PLUGIN_IP4_CONFIG_INT_GATEWAY, "u", &u32))
|
||||
if (g_variant_lookup (dict, NM_VPN_PLUGIN_IP4_CONFIG_INT_GATEWAY, "u", &u32)) {
|
||||
priv->ip4_internal_gw = u32;
|
||||
nm_ip4_config_set_gateway (config, priv->ip4_internal_gw);
|
||||
}
|
||||
|
||||
if (g_variant_lookup (dict, NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS, "u", &u32))
|
||||
address.address = u32;
|
||||
|
|
@ -1318,6 +1320,7 @@ nm_vpn_connection_ip6_config_get (NMVpnConnection *self, GVariant *dict)
|
|||
g_clear_pointer (&priv->ip6_internal_gw, g_free);
|
||||
if (g_variant_lookup (dict, NM_VPN_PLUGIN_IP6_CONFIG_INT_GATEWAY, "@ay", &v)) {
|
||||
priv->ip6_internal_gw = ip6_addr_dup_from_variant (v);
|
||||
nm_ip6_config_set_gateway (config, priv->ip6_internal_gw);
|
||||
g_variant_unref (v);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue