summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2014-03-07 10:33:12 +0100
committerJiří Klimeš <jklimes@redhat.com>2014-03-07 10:56:32 +0100
commitd0e1bf21c6d017bc9d9c9c3f3d227655c8379178 (patch)
treea2a698d92d2fa7238e35d29a49fbab367ccb569a
parentbdb44ba39a71a6e4fe47c3b3abcc762aae70b010 (diff)
downloadNetworkManager-jk/match-ipv6-link-local-ignore.tar.gz
core: allow matching IPv6 'link-local' method to 'ignore' (rh #1073824)jk/match-ipv6-link-local-ignore
When an existing connection profile has IPv6 method 'ignore', NM doesn't simply care about IPv6. Thus we should allow matching such a profile to devices with just a link-local address. The example can be a simple configuration like this: /etc/sysconfig/network-scripts/ifcfg-ens3: DEVICE="ens3" ONBOOT=yes NETBOOT=yes UUID="aa17d688-a38d-481d-888d-6d69cca781b8" BOOTPROTO=dhcp HWADDR="52:54:00:32:77:59" TYPE=Ethernet NAME="ens3" https://bugzilla.redhat.com/show_bug.cgi?id=1073824
-rw-r--r--src/NetworkManagerUtils.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c
index ae6bc504cc..c5823e80c3 100644
--- a/src/NetworkManagerUtils.c
+++ b/src/NetworkManagerUtils.c
@@ -686,6 +686,37 @@ check_ip6_method_link_local_auto (NMConnection *orig,
}
static gboolean
+check_ip6_method_link_local_ignore (NMConnection *orig,
+ NMConnection *candidate,
+ GHashTable *settings)
+{
+ GHashTable *props;
+ const char *orig_ip6_method, *candidate_ip6_method;
+
+ props = g_hash_table_lookup (settings, NM_SETTING_IP6_CONFIG_SETTING_NAME);
+ if ( !props
+ || (g_hash_table_size (props) != 1)
+ || !g_hash_table_lookup (props, NM_SETTING_IP6_CONFIG_METHOD)) {
+ /* We only handle ipv6 'method' here */
+ return FALSE;
+ }
+
+ /* If the original connection method is 'link-local' and the candidate method
+ * is 'ignore' we can take the connection, because NM didn't simply take care
+ * of IPv6.
+ */
+ orig_ip6_method = nm_utils_get_ip_config_method (orig, NM_TYPE_SETTING_IP6_CONFIG);
+ candidate_ip6_method = nm_utils_get_ip_config_method (candidate, NM_TYPE_SETTING_IP6_CONFIG);
+
+ if ( strcmp (orig_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0
+ && strcmp (candidate_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
check_ip4_method_disabled_auto (NMConnection *orig,
NMConnection *candidate,
GHashTable *settings,
@@ -733,6 +764,9 @@ check_possible_match (NMConnection *orig,
if (check_ip6_method_link_local_auto (orig, candidate, settings))
return candidate;
+ if (check_ip6_method_link_local_ignore (orig, candidate, settings))
+ return candidate;
+
if (check_ip4_method_disabled_auto (orig, candidate, settings, device_has_carrier))
return candidate;