summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vpn-manager/nm-vpn-connection.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index fe5d812791..c581874880 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -325,6 +325,11 @@ _set_vpn_state (NMVpnConnection *connection,
dispatcher_cleanup (connection);
+ if (vpn_state >= STATE_DISCONNECTED && vpn_state <= STATE_FAILED) {
+ nm_default_route_manager_ip4_remove_default_route (nm_default_route_manager_get (), connection);
+ nm_default_route_manager_ip6_remove_default_route (nm_default_route_manager_get (), connection);
+ }
+
/* The connection gets destroyed by the VPN manager when it enters the
* disconnected/failed state, but we need to keep it around for a bit
* to send out signals and handle the dispatcher. So ref it.
@@ -342,9 +347,6 @@ _set_vpn_state (NMVpnConnection *connection,
g_object_notify (G_OBJECT (connection), NM_VPN_CONNECTION_VPN_STATE);
}
- nm_default_route_manager_ip4_update_default_route (nm_default_route_manager_get (), connection);
- nm_default_route_manager_ip6_update_default_route (nm_default_route_manager_get (), connection);
-
switch (vpn_state) {
case STATE_NEED_AUTH:
/* Do nothing; not part of 'default' because we don't want to touch