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.
This commit is contained in:
Dan Williams 2011-02-25 11:58:16 -06:00
parent bf854ebaca
commit a4ab74d903
10 changed files with 24 additions and 14 deletions

View file

@ -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,

View file

@ -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 */

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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;
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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);