diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2015-05-20 11:36:37 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2015-06-02 14:04:54 +0200 |
commit | 3bc097b084bcabfc682b532991dd05cbe8e3161a (patch) | |
tree | 9ad46942eec5eae127787211c89ca5e27bc2f5a3 | |
parent | 231e9e3968ac10b411b48db045adb1804160ded9 (diff) |
device: don't assume by default IPv6LL-only connections
Add the new configuration option 'assume-ipv6ll-only' which specifies
the devices for which NM will try to assume an existing IPv6LL-only
configuration.
The new default behavior is to ignore such configurations since IPv6LL
addresses are automatically assigned by the kernel when the device is
brought up and thus the presence of an IPv6LL address doesn't mean
that the device was configured by the administrator.
The previous behavior was to always assume IPv6LL-only configurations
but this often had the unwanted effect of preventing other on-disk
configurations to be activated. To preserve the old behavior the
option must be set to '*'.
https://bugzilla.redhat.com/show_bug.cgi?id=1138426
-rw-r--r-- | man/NetworkManager.conf.xml.in | 14 | ||||
-rw-r--r-- | src/devices/nm-device.c | 14 | ||||
-rw-r--r-- | src/nm-config-data.c | 12 | ||||
-rw-r--r-- | src/nm-config-data.h | 1 |
4 files changed, 41 insertions, 0 deletions
diff --git a/man/NetworkManager.conf.xml.in b/man/NetworkManager.conf.xml.in index 054f84202b..3de964023e 100644 --- a/man/NetworkManager.conf.xml.in +++ b/man/NetworkManager.conf.xml.in @@ -209,6 +209,20 @@ no-auto-default=* </varlistentry> <varlistentry> + <term><varname>assume-ipv6ll-only</varname></term> + <listitem> + <para> + 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. + </para> + <para>See <xref linkend="device-spec"/> for the syntax how to + specify a device. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><varname>configure-and-quit</varname></term> <listitem> <para> diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 35418ccb17..97e2c847a8 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2172,6 +2172,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 2142670ba5..41995a043f 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; char *rc_manager; @@ -160,6 +161,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 @@ -328,6 +338,7 @@ finalize (GObject *gobject) g_free (priv->rc_manager); 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); @@ -361,6 +372,7 @@ constructed (GObject *object) priv->rc_manager = g_key_file_get_value (priv->keyfile, "main", "rc-manager", 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 ea99931cf8..a8182f2839 100644 --- a/src/nm-config-data.h +++ b/src/nm-config-data.h @@ -92,6 +92,7 @@ const char *nm_config_data_get_dns_mode (const NMConfigData *self); const char *nm_config_data_get_rc_manager (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 |