summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2013-10-20 16:27:46 -0400
committerDan Winship <danw@gnome.org>2014-03-18 11:48:55 -0400
commit797c889e628419b7f43c116447f25c8c2d66fedc (patch)
treee58396de877f13c39b441d8c9ccd1a817a8b9f76
parent076ef5de8000d655989f791b13ec4ee0ec785876 (diff)
downloadNetworkManager-797c889e628419b7f43c116447f25c8c2d66fedc.tar.gz
core: fix NMManager:primary-connection when a VPN has the default route
If a VPN had the default route, :primary-connection would become NULL, which is exactly what it's not supposed to do. Fix it to have the value it's supposed to. https://bugzilla.gnome.org/show_bug.cgi?id=710207
-rw-r--r--src/nm-policy.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c
index e8e7c6069b..c6ce0b5b3e 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -627,7 +627,7 @@ static void
update_ip4_routing (NMPolicy *policy, gboolean force_update)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
- NMDevice *best = NULL, *parent;
+ NMDevice *best = NULL, *parent, *default_device;
NMConnection *connection = NULL;
NMVPNConnection *vpn = NULL;
NMActiveConnection *best_ac = NULL;
@@ -680,15 +680,20 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update)
nm_ip4_config_get_mss (ip4_config),
nm_device_get_ip_ifindex (parent),
parent_mss);
+ default_device = parent;
} else {
nm_system_replace_default_ip4_route (ip_ifindex,
gw_addr,
nm_ip4_config_get_mss (ip4_config));
+ default_device = best;
}
update_default_ac (policy, best_ac, nm_active_connection_set_default);
- priv->default_device4 = best;
+ if (default_device == priv->default_device4)
+ return;
+
+ priv->default_device4 = default_device;
connection = nm_active_connection_get_connection (best_ac);
nm_log_info (LOGD_CORE, "Policy set '%s' (%s) as default for IPv4 routing and DNS.",
nm_connection_get_id (connection), ip_iface);
@@ -806,7 +811,7 @@ static void
update_ip6_routing (NMPolicy *policy, gboolean force_update)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
- NMDevice *best = NULL, *parent;
+ NMDevice *best = NULL, *parent, *default_device6;
NMConnection *connection = NULL;
NMVPNConnection *vpn = NULL;
NMActiveConnection *best_ac = NULL;
@@ -868,16 +873,21 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
nm_ip6_config_get_mss (ip6_config),
nm_device_get_ip_ifindex (parent),
parent_mss);
+ default_device6 = parent;
} else {
if (gw_addr)
nm_system_replace_default_ip6_route (ip_ifindex, gw_addr);
else
nm_log_dbg (LOGD_IP6, "missing default IPv6 gateway");
+ default_device6 = best;
}
update_default_ac (policy, best_ac, nm_active_connection_set_default6);
- priv->default_device6 = best;
+ if (default_device6 == priv->default_device6)
+ return;
+
+ priv->default_device6 = default_device6;
connection = nm_active_connection_get_connection (best_ac);
nm_log_info (LOGD_CORE, "Policy set '%s' (%s) as default for IPv6 routing and DNS.",
nm_connection_get_id (connection), ip_iface);