diff --git a/man/NetworkManager.conf.xml.in b/man/NetworkManager.conf.xml.in index ae4ba88fd6..79db1a2de2 100644 --- a/man/NetworkManager.conf.xml.in +++ b/man/NetworkManager.conf.xml.in @@ -208,6 +208,20 @@ no-auto-default=* + + assume-ipv6ll-only + + + Specify devices for which NetworkManager will try to + generate a connection based on initial configuration when + the device only has an IPv6 link-local address. + + See for the syntax how to + specify a device. + + + + configure-and-quit diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 620f733029..34b73d065c 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2110,6 +2110,20 @@ nm_device_generate_connection (NMDevice *self, NMDevice *master) connection = NULL; } + /* Ignore any IPv6LL-only, not master connections without slaves, + * unless they are in the assume-ipv6ll-only list. + */ + if ( connection + && g_strcmp0 (ip4_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0 + && g_strcmp0 (ip6_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0 + && !nm_setting_connection_get_master (NM_SETTING_CONNECTION (s_con)) + && !priv->slaves + && !nm_config_data_get_assume_ipv6ll_only (nm_config_get_data (nm_config_get ()), self)) { + _LOGD (LOGD_DEVICE, "ignoring generated connection (IPv6LL-only and not in master-slave relationship)"); + g_object_unref (connection); + connection = NULL; + } + return connection; } diff --git a/src/nm-config-data.c b/src/nm-config-data.c index 5cff076af3..0c4545d87f 100644 --- a/src/nm-config-data.c +++ b/src/nm-config-data.c @@ -46,6 +46,7 @@ typedef struct { } no_auto_default; GSList *ignore_carrier; + GSList *assume_ipv6ll_only; char *dns_mode; } NMConfigDataPrivate; @@ -151,6 +152,15 @@ nm_config_data_get_ignore_carrier (const NMConfigData *self, NMDevice *device) return nm_device_spec_match_list (device, NM_CONFIG_DATA_GET_PRIVATE (self)->ignore_carrier); } +gboolean +nm_config_data_get_assume_ipv6ll_only (const NMConfigData *self, NMDevice *device) +{ + g_return_val_if_fail (NM_IS_CONFIG_DATA (self), FALSE); + g_return_val_if_fail (NM_IS_DEVICE (device), FALSE); + + return nm_device_spec_match_list (device, NM_CONFIG_DATA_GET_PRIVATE (self)->assume_ipv6ll_only); +} + /************************************************************************/ static gboolean @@ -315,6 +325,7 @@ finalize (GObject *gobject) g_free (priv->dns_mode); g_slist_free_full (priv->ignore_carrier, g_free); + g_slist_free_full (priv->assume_ipv6ll_only, g_free); g_key_file_unref (priv->keyfile); @@ -347,6 +358,7 @@ constructed (GObject *object) priv->dns_mode = g_key_file_get_value (priv->keyfile, "main", "dns", NULL); priv->ignore_carrier = nm_config_get_device_match_spec (priv->keyfile, "main", "ignore-carrier"); + priv->assume_ipv6ll_only = nm_config_get_device_match_spec (priv->keyfile, "main", "assume-ipv6ll-only"); G_OBJECT_CLASS (nm_config_data_parent_class)->constructed (object); } diff --git a/src/nm-config-data.h b/src/nm-config-data.h index 4141b56815..0c3e3d1455 100644 --- a/src/nm-config-data.h +++ b/src/nm-config-data.h @@ -90,6 +90,7 @@ const GSList * nm_config_data_get_no_auto_default_list (const NMConfigData *c const char *nm_config_data_get_dns_mode (const NMConfigData *self); gboolean nm_config_data_get_ignore_carrier (const NMConfigData *self, NMDevice *device); +gboolean nm_config_data_get_assume_ipv6ll_only (const NMConfigData *self, NMDevice *device); G_END_DECLS