From a4ab74d9038c073c0d998658cd480191c519fa67 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 25 Feb 2011 11:58:16 -0600 Subject: [PATCH] core: don't autocomplete non-IPv6-capable connections with IPv6 enabled Mobile broadband and PPPoE don't yet support IPv6, so don't enable IPv6 on these connections when completing them. --- src/NetworkManagerUtils.c | 9 +++++---- src/NetworkManagerUtils.h | 3 ++- src/modem-manager/nm-modem-cdma.c | 3 ++- src/modem-manager/nm-modem-gsm.c | 3 ++- src/nm-device-bt.c | 3 ++- src/nm-device-ethernet.c | 3 ++- src/nm-device-olpc-mesh.c | 3 ++- src/nm-device-wifi.c | 3 ++- src/nm-manager.c | 5 +++-- src/wimax/nm-device-wimax.c | 3 ++- 10 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index ab214ee79d..1a41ef160e 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -785,7 +785,8 @@ nm_utils_complete_generic (NMConnection *connection, const char *ctype, const GSList *existing, const char *format, - const char *preferred) + const char *preferred, + gboolean default_enable_ipv6) { NMSettingConnection *s_con; NMSettingIP4Config *s_ip4; @@ -826,13 +827,13 @@ nm_utils_complete_generic (NMConnection *connection, NULL); } + /* Add an 'auto' IPv6 setting if allowed and not preset */ s_ip6 = (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG); - if (!s_ip6) { + if (!s_ip6 && default_enable_ipv6) { s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); } - method = nm_setting_ip6_config_get_method (s_ip6); - if (!method) { + if (s_ip6 && !nm_setting_ip6_config_get_method (s_ip6)) { g_object_set (G_OBJECT (s_ip6), NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h index 1edd87746f..6f48a78823 100644 --- a/src/NetworkManagerUtils.h +++ b/src/NetworkManagerUtils.h @@ -82,6 +82,7 @@ void nm_utils_complete_generic (NMConnection *connection, const char *ctype, const GSList *existing, const char *format, - const char *preferred); + const char *preferred, + gboolean default_enable_ipv6); #endif /* NETWORK_MANAGER_UTILS_H */ diff --git a/src/modem-manager/nm-modem-cdma.c b/src/modem-manager/nm-modem-cdma.c index ec56c060ba..fd2d2e0e16 100644 --- a/src/modem-manager/nm-modem-cdma.c +++ b/src/modem-manager/nm-modem-cdma.c @@ -292,7 +292,8 @@ real_complete_connection (NMModem *modem, NM_SETTING_CDMA_SETTING_NAME, existing_connections, _("CDMA connection %d"), - NULL); + NULL, + FALSE); /* No IPv6 yet by default */ return TRUE; } diff --git a/src/modem-manager/nm-modem-gsm.c b/src/modem-manager/nm-modem-gsm.c index 9ae1fe4cb4..7f6c4af141 100644 --- a/src/modem-manager/nm-modem-gsm.c +++ b/src/modem-manager/nm-modem-gsm.c @@ -495,7 +495,8 @@ real_complete_connection (NMModem *modem, NM_SETTING_GSM_SETTING_NAME, existing_connections, _("GSM connection %d"), - NULL); + NULL, + FALSE); /* No IPv6 yet by default */ return TRUE; } diff --git a/src/nm-device-bt.c b/src/nm-device-bt.c index e743bed62b..5a0d1fdf4a 100644 --- a/src/nm-device-bt.c +++ b/src/nm-device-bt.c @@ -367,7 +367,8 @@ real_complete_connection (NMDevice *device, NM_SETTING_BLUETOOTH_SETTING_NAME, existing_connections, format, - preferred); + preferred, + is_dun ? FALSE : TRUE); /* No IPv6 yet for DUN */ setting_bdaddr = nm_setting_bluetooth_get_bdaddr (s_bt); if (setting_bdaddr) { diff --git a/src/nm-device-ethernet.c b/src/nm-device-ethernet.c index e847fba5c1..11a94d59a4 100644 --- a/src/nm-device-ethernet.c +++ b/src/nm-device-ethernet.c @@ -1682,7 +1682,8 @@ real_complete_connection (NMDevice *device, s_pppoe ? NM_SETTING_PPPOE_SETTING_NAME : NM_SETTING_CONNECTION_SETTING_NAME, existing_connections, s_pppoe ? _("PPPoE connection %d") : _("Wired connection %d"), - NULL); + NULL, + s_pppoe ? FALSE : TRUE); /* No IPv6 by default yet for PPPoE */ s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED); if (!s_wired) { diff --git a/src/nm-device-olpc-mesh.c b/src/nm-device-olpc-mesh.c index 36b056e8fe..4019a6fd15 100644 --- a/src/nm-device-olpc-mesh.c +++ b/src/nm-device-olpc-mesh.c @@ -420,7 +420,8 @@ real_complete_connection (NMDevice *device, NM_SETTING_OLPC_MESH_SETTING_NAME, existing_connections, _("Mesh %d"), - NULL); + NULL, + FALSE); /* No IPv6 by default */ return TRUE; } diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c index cb04c06296..5711b45bc3 100644 --- a/src/nm-device-wifi.c +++ b/src/nm-device-wifi.c @@ -1470,7 +1470,8 @@ real_complete_connection (NMDevice *device, NM_SETTING_WIRELESS_SETTING_NAME, existing_connections, format, - str_ssid); + str_ssid, + TRUE); g_free (str_ssid); g_free (format); diff --git a/src/nm-manager.c b/src/nm-manager.c index 24a4a218f1..2586fada4e 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -677,8 +677,9 @@ try_complete_vpn (NMConnection *connection, GSList *existing, GError **error) NM_SETTING_VPN_SETTING_NAME, existing, _("VPN connection %d"), - NULL); - + NULL, + FALSE); /* No IPv6 by default for now */ + return TRUE; } diff --git a/src/wimax/nm-device-wimax.c b/src/wimax/nm-device-wimax.c index a3f0b08dfc..b30f94725a 100644 --- a/src/wimax/nm-device-wimax.c +++ b/src/wimax/nm-device-wimax.c @@ -563,7 +563,8 @@ real_complete_connection (NMDevice *device, NM_SETTING_WIMAX_SETTING_NAME, existing_connections, format, - nsp_name); + nsp_name, + TRUE); g_free (format); g_object_set (G_OBJECT (s_wimax), NM_SETTING_WIMAX_NETWORK_NAME, nsp_name, NULL);