diff options
author | Dan Williams <dcbw@redhat.com> | 2014-11-11 16:10:37 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-11-11 16:14:47 -0600 |
commit | 38b6037f3373b2c2ed52a22f6e2f02655c06bdfd (patch) | |
tree | 4cb9d3d944f9b7f5736204636677d88adf10a7c5 | |
parent | b27f87c714d6536f53c49cd8285ba5a110b48754 (diff) | |
download | NetworkManager-38b6037f3373b2c2ed52a22f6e2f02655c06bdfd.tar.gz |
vpn: update DefaultRouteManager before sending state change signal
The DRM now affects DNS too, since it determines the "best" IPv4
and IPv6 configs based on it's idea of the default route. The
Policy is also still updating DNS from a state-change handler for
VPN connections.
This led to a situation where the Policy would remove the VPN's
IP config from the DNS manager in vpn_connection_deactivated() and
call update_ip4_dns(), whereupon get_best_ip4_config() returned
the just-removed VPN IPv4 config as "best" because the VPN connection
hadn't yet told the DefaultRouteManager to remove it.
Which meant VPN nameservers stuck around in resolv.conf for a long
time after the VPN was disconnected.
Fixes: a39a3ae4cd72d695f1b5d10eaa79544f2020a54e
-rw-r--r-- | src/vpn-manager/nm-vpn-connection.c | 8 |
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 |