core: fix NMManager:primary-connection when a VPN has the default route (rh #1031574)

This commit is contained in:
Dan Winship 2014-01-18 11:31:42 -05:00
parent 7fa9195ebf
commit 99fa633396
2 changed files with 102 additions and 1 deletions

View File

@ -19,7 +19,7 @@ Name: NetworkManager
Summary: Network connection manager and user applications
Epoch: 1
Version: 0.9.9.0
Release: 24%{snapshot}%{?dist}
Release: 25%{snapshot}%{?dist}
Group: System Environment/Base
License: GPLv2+
URL: http://www.gnome.org/projects/NetworkManager/
@ -53,6 +53,7 @@ Patch23: rh1048711-bluez-crash.patch
Patch24: vpn-connection-states.patch
Patch25: nmcli-group-dot-field.patch
Patch26: rh1036132-VPN-active-con-info.patch
Patch27: rh1031574-primary-connection.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -202,6 +203,7 @@ deployments.
%patch24 -p1 -b .vpn-connection-states
%patch25 -p1 -b .nmcli-group-dot-field
%patch26 -p1 -b .VPN-active-con-info
%patch27 -p1 -b .primary-connection
%build
@ -400,6 +402,9 @@ fi
%config %{_sysconfdir}/%{name}/conf.d/00-server.conf
%changelog
* Sat Jan 18 2014 Dan Winship <danw@redhat.com> - 0.9.9.0-25.git20131003
- core: fix NMManager:primary-connection when a VPN has the default route (rh #1031574)
* Tue Jan 14 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-24.git20131003
- vpn: fix logging connection states
- core/cli: display proper information for active VPN connections (rh #1036132)

View File

@ -0,0 +1,96 @@
From 00b29b6c61c0b7bff874a1a440f59c782ea7f83d Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Sun, 20 Oct 2013 16:27:46 -0400
Subject: [PATCH] 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
---
src/nm-policy.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/nm-policy.c b/src/nm-policy.c
index d5176ae..22f7c11 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);
--
1.8.4.2