mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 18:40:09 +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.
(cherry picked from commit 691ebbdc43)
This commit is contained in:
parent
81945215c6
commit
38bf2cb0e2
2 changed files with 8 additions and 4 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;
|
||||
|
|
|
|||
|
|
@ -1204,8 +1204,10 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
|
|||
|
||||
/* Internal address of the VPN subnet's gateway */
|
||||
val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_IP4_CONFIG_INT_GATEWAY);
|
||||
if (val)
|
||||
if (val) {
|
||||
priv->ip4_internal_gw = g_value_get_uint (val);
|
||||
nm_ip4_config_set_gateway (config, priv->ip4_internal_gw);
|
||||
}
|
||||
|
||||
val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS);
|
||||
if (val)
|
||||
|
|
@ -1351,8 +1353,10 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy,
|
|||
if (val) {
|
||||
GByteArray *ba = g_value_get_boxed (val);
|
||||
|
||||
if (ba->len == sizeof (struct in6_addr))
|
||||
if (ba->len == sizeof (struct in6_addr)) {
|
||||
priv->ip6_internal_gw = g_memdup (ba->data, ba->len);
|
||||
nm_ip6_config_set_gateway (config, priv->ip6_internal_gw);
|
||||
}
|
||||
}
|
||||
|
||||
val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_IP6_CONFIG_ADDRESS);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue