From 16d0850c37920d01a3d55ddba41325be2e0b719a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 10 Jul 2015 17:47:41 +0200 Subject: [PATCH] default-route-manager: fix handling for absent default routes for VPN When a VPN has no default route, it is wrong to enforce the absence of a default route on that device. Instead, if there is no default route, NMDefaultRouteManager should just forget about the route. This is especially important, because for VPN types like openswan there is no distinct tunnel interface. Instead, it shares the ifindex with the parent-device. Note that devices usually only enforce their default-route for a short time and afterwards switch to non-synced. If that happens and there is a VPN that enforces the absense of the default route on that device, we end up deleting the default route. --- src/nm-default-route-manager.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nm-default-route-manager.c b/src/nm-default-route-manager.c index 0dfe2d52bf..5e7754c72e 100644 --- a/src/nm-default-route-manager.c +++ b/src/nm-default-route-manager.c @@ -789,7 +789,13 @@ _ipx_update_default_route (const VTableIP *vtable, NMDefaultRouteManager *self, } } } - synced = TRUE; + if (nm_vpn_connection_get_ip_ifindex (vpn) > 0) + synced = TRUE; + else { + /* a VPN connection without tunnel device cannot have a non-synced, missing default route. + * Either it has a default route (which is synced), or it has no entry. */ + synced = default_route && !never_default; + } } }