From 6d86495f71eec283090663a71d4148fa1d59ad57 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sun, 26 Oct 2008 15:48:00 +0000 Subject: [PATCH] 2008-10-26 Dan Williams * src/NetworkManagerPolicy.c - (update_routing_and_dns): ignore host routes when determining whether a VPN connection should own the default route (bgo #552594) git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4212 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 6 ++++++ src/NetworkManagerPolicy.c | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e775dc4a3..0bd9920cfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-10-26 Dan Williams + + * src/NetworkManagerPolicy.c + - (update_routing_and_dns): ignore host routes when determining whether + a VPN connection should own the default route (bgo #552594) + 2008-10-24 Dan Williams * src/nm-gsm-device.c diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c index 5f0970457d..107a8412a2 100644 --- a/src/NetworkManagerPolicy.c +++ b/src/NetworkManagerPolicy.c @@ -503,10 +503,27 @@ update_routing_and_dns (NMPolicy *policy, gboolean force_update) } g_slist_free (vpns); - /* VPNs are the default route only if they don't have custom routes */ + /* VPNs are the default route only if they don't have custom non-host (ie, /32) + * routes. Custom non-host routes are redundant when the VPN is the default + * route because any traffic meant for the custom route would be routed over + * the VPN anyway. + */ if (vpn) { + gboolean have_non_host_routes = FALSE; + int i; + ip4_config = nm_vpn_connection_get_ip4_config (vpn); - if (nm_ip4_config_get_num_routes (ip4_config) == 0) { + for (i = 0; i < nm_ip4_config_get_num_routes (ip4_config); i++) { + const NMSettingIP4Route *route = nm_ip4_config_get_route (ip4_config, i); + + if (route->prefix != 32) { + have_non_host_routes = TRUE; + break; + } + } + + + if (!have_non_host_routes) { NMIP4Config *parent_ip4; NMDevice *parent;