diff options
author | Dan Winship <danw@gnome.org> | 2013-10-20 16:27:46 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2013-10-21 16:18:11 -0400 |
commit | 00b29b6c61c0b7bff874a1a440f59c782ea7f83d (patch) | |
tree | 7edaceb68dee77ca3ada4a178f9b284f9fbe376f | |
parent | 6a8fd3f46980572ba95847df0ab8d7be850a6efb (diff) | |
download | NetworkManager-00b29b6c61c0b7bff874a1a440f59c782ea7f83d.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.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c index d5176ae072..22f7c1171d 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -638,7 +638,7 @@ static void update_ip4_routing (NMPolicy *policy, gboolean force_update) { NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy); - NMDevice *best = NULL; + NMDevice *best = NULL, *default_device; NMConnection *connection = NULL; NMVPNConnection *vpn = NULL; NMActiveConnection *best_ac = NULL; @@ -682,6 +682,8 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update) nm_log_err (LOGD_IP4 | LOGD_VPN, "Failed to set default route."); } } + + default_device = nm_vpn_connection_get_parent_device (vpn); } else { int mss = nm_ip4_config_get_mss (ip4_config); @@ -691,14 +693,16 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update) nm_log_err (LOGD_IP4, "Failed to set default route."); } } + + default_device = best; } update_default_ac (policy, best_ac, nm_active_connection_set_default); - if (best == priv->default_device4) + if (default_device == priv->default_device4) return; - priv->default_device4 = best; + 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); @@ -816,7 +820,7 @@ static void update_ip6_routing (NMPolicy *policy, gboolean force_update) { NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy); - NMDevice *best = NULL; + NMDevice *best = NULL, *default_device6; NMConnection *connection = NULL; NMVPNConnection *vpn = NULL; NMActiveConnection *best_ac = NULL; @@ -870,6 +874,8 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update) nm_log_err (LOGD_IP6 | LOGD_VPN, "Failed to set default route."); } } + + default_device6 = nm_vpn_connection_get_parent_device (vpn); } else { int mss = nm_ip6_config_get_mss (ip6_config); @@ -879,14 +885,16 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update) nm_log_err (LOGD_IP6, "Failed to set default route."); } } + + default_device6 = best; } update_default_ac (policy, best_ac, nm_active_connection_set_default6); - if (best == priv->default_device6) + if (default_device6 == priv->default_device6) return; - priv->default_device6 = best; + 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); |