summaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-06-12 08:16:47 +0200
committerThomas Haller <thaller@redhat.com>2017-07-05 14:22:10 +0200
commit89385bd9683c521fbc85b5e452459c3d46d4528d (patch)
treeda17fc6be4d612d37dc3cd225269c1f7eb09bbae /src/vpn
parent6d9c3eab385fa809996a41bceb923e353addab37 (diff)
downloadNetworkManager-89385bd9683c521fbc85b5e452459c3d46d4528d.tar.gz
core: pass NMDedupMultiIndex instance to NMIP4Config and other
NMIP4Config, NMIP6Config, and NMPlatform shall share one NMDedupMultiIndex instance. For that, pass an NMDedupMultiIndex instance to NMPlatform and NMNetns. NMNetns than passes it on to NMDevice, NMDhcpClient, NMIP4Config and NMIP6Config. So currently NMNetns is the access point to the shared NMDedupMultiIndex instance, and it gets it from it's NMPlatform instance. The NMDedupMultiIndex instance is really a singleton, we don't want multiple instances of it. However, for testing, instead of adding a singleton instance, pass the instance explicitly around.
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/nm-vpn-connection.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c
index ecc820685c..9a0de7ebfe 100644
--- a/src/vpn/nm-vpn-connection.c
+++ b/src/vpn/nm-vpn-connection.c
@@ -1046,10 +1046,14 @@ apply_parent_device_config (NMVpnConnection *self)
NMIP6Config *vpn6_parent_config = NULL;
if (priv->ip_ifindex > 0) {
- if (priv->ip4_config)
- vpn4_parent_config = nm_ip4_config_new (priv->ip_ifindex);
- if (priv->ip6_config)
- vpn6_parent_config = nm_ip6_config_new (priv->ip_ifindex);
+ if (priv->ip4_config) {
+ vpn4_parent_config = nm_ip4_config_new (nm_netns_get_multi_idx (priv->netns),
+ priv->ip_ifindex);
+ }
+ if (priv->ip6_config) {
+ vpn6_parent_config = nm_ip6_config_new (nm_netns_get_multi_idx (priv->netns),
+ priv->ip_ifindex);
+ }
} else {
int ifindex;
@@ -1063,11 +1067,13 @@ apply_parent_device_config (NMVpnConnection *self)
* default route. */
ifindex = nm_device_get_ip_ifindex (parent_dev);
if (priv->ip4_config) {
- vpn4_parent_config = nm_ip4_config_new (ifindex);
+ vpn4_parent_config = nm_ip4_config_new (nm_netns_get_multi_idx (priv->netns),
+ ifindex);
nm_ip4_config_merge (vpn4_parent_config, priv->ip4_config, NM_IP_CONFIG_MERGE_NO_DNS);
}
if (priv->ip6_config) {
- vpn6_parent_config = nm_ip6_config_new (ifindex);
+ vpn6_parent_config = nm_ip6_config_new (nm_netns_get_multi_idx (priv->netns),
+ ifindex);
nm_ip6_config_merge (vpn6_parent_config, priv->ip6_config, NM_IP_CONFIG_MERGE_NO_DNS);
nm_ip6_config_set_gateway (vpn6_parent_config, NULL);
}
@@ -1436,7 +1442,8 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
if (ip_ifindex <= 0)
g_return_if_reached ();
- config = nm_ip4_config_new (ip_ifindex);
+ config = nm_ip4_config_new (nm_netns_get_multi_idx (priv->netns),
+ ip_ifindex);
nm_ip4_config_set_dns_priority (config, NM_DNS_PRIORITY_DEFAULT_VPN);
memset (&address, 0, sizeof (address));
@@ -1595,7 +1602,8 @@ nm_vpn_connection_ip6_config_get (NMVpnConnection *self, GVariant *dict)
if (ip_ifindex <= 0)
g_return_if_reached ();
- config = nm_ip6_config_new (ip_ifindex);
+ config = nm_ip6_config_new (nm_netns_get_multi_idx (priv->netns),
+ ip_ifindex);
nm_ip6_config_set_dns_priority (config, NM_DNS_PRIORITY_DEFAULT_VPN);
memset (&address, 0, sizeof (address));