diff options
Diffstat (limited to 'src/vpn-manager/nm-vpn-connection.c')
-rw-r--r-- | src/vpn-manager/nm-vpn-connection.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index eee181ef01..cf844992c0 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -44,7 +44,7 @@ #include "nm-properties-changed-signal.h" #include "nm-dbus-glib-types.h" #include "NetworkManagerUtils.h" -#include "nm-named-manager.h" +#include "nm-dns-manager.h" #include "nm-netlink-monitor.h" #include "nm-glib-compat.h" @@ -119,6 +119,7 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection, NMVPNConnectionPrivate *priv; NMActiveConnectionState new_ac_state; NMVPNConnectionState old_vpn_state; + char *ip_iface; g_return_if_fail (NM_IS_VPN_CONNECTION (connection)); @@ -130,6 +131,11 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection, old_vpn_state = priv->vpn_state; priv->vpn_state = vpn_state; + /* Save ip_iface since when the VPN goes down it may get freed + * before we're done with it. + */ + ip_iface = g_strdup (priv->ip_iface); + /* Set the NMActiveConnection state based on VPN state */ switch (vpn_state) { case NM_VPN_CONNECTION_STATE_PREPARE: @@ -166,7 +172,7 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection, nm_utils_call_dispatcher ("vpn-up", priv->connection, priv->parent_dev, - priv->ip_iface); + ip_iface); break; case NM_VPN_CONNECTION_STATE_FAILED: case NM_VPN_CONNECTION_STATE_DISCONNECTED: @@ -174,13 +180,14 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection, nm_utils_call_dispatcher ("vpn-down", priv->connection, priv->parent_dev, - priv->ip_iface); + ip_iface); } break; default: break; } + g_free (ip_iface); g_object_unref (connection); } @@ -375,6 +382,9 @@ print_vpn_config (NMIP4Config *config, ip_address_to_string (nm_ip4_route_get_next_hop (route))); } + nm_log_info (LOGD_VPN, "Forbid Default Route: %s", + nm_ip4_config_get_never_default (config) ? "yes" : "no"); + num = nm_ip4_config_get_num_nameservers (config); for (i = 0; i < num; i++) { nm_log_info (LOGD_VPN, "Internal IP4 DNS: %s", @@ -520,6 +530,10 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy, g_slist_free (routes); } + val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_IP4_CONFIG_NEVER_DEFAULT); + if (val && G_VALUE_HOLDS_BOOLEAN (val)) + nm_ip4_config_set_never_default (config, g_value_get_boolean (val)); + print_vpn_config (config, priv->ip4_internal_gw, priv->ip_iface, priv->banner); /* Merge in user overrides from the NMConnection's IPv4 setting */ @@ -529,15 +543,15 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy, nm_system_device_set_up_down_with_iface (priv->ip_iface, TRUE, NULL); if (nm_system_apply_ip4_config (priv->ip_iface, config, 0, NM_IP4_COMPARE_FLAG_ALL)) { - NMNamedManager *named_mgr; + NMDnsManager *dns_mgr; /* Add any explicit route to the VPN gateway through the parent device */ priv->gw_route = nm_system_add_ip4_vpn_gateway_route (priv->parent_dev, config); /* Add the VPN to DNS */ - named_mgr = nm_named_manager_get (); - nm_named_manager_add_ip4_config (named_mgr, priv->ip_iface, config, NM_NAMED_IP_CONFIG_TYPE_VPN); - g_object_unref (named_mgr); + dns_mgr = nm_dns_manager_get (NULL); + nm_dns_manager_add_ip4_config (dns_mgr, priv->ip_iface, config, NM_DNS_IP_CONFIG_TYPE_VPN); + g_object_unref (dns_mgr); priv->ip4_config = config; @@ -885,12 +899,12 @@ vpn_cleanup (NMVPNConnection *connection) if (priv->ip4_config) { NMIP4Config *parent_config; - NMNamedManager *named_mgr; + NMDnsManager *dns_mgr; /* Remove attributes of the VPN's IP4 Config */ - named_mgr = nm_named_manager_get (); - nm_named_manager_remove_ip4_config (named_mgr, priv->ip_iface, priv->ip4_config); - g_object_unref (named_mgr); + dns_mgr = nm_dns_manager_get (NULL); + nm_dns_manager_remove_ip4_config (dns_mgr, priv->ip_iface, priv->ip4_config); + g_object_unref (dns_mgr); /* Remove any previously added VPN gateway host route */ if (priv->gw_route) |