Blame SOURCES/0020-fix-assume-bond-and-infiniband-rh1375558.patch

a85faa
From 73a214a863e902df3df45e426b2eb1ef315461f4 Mon Sep 17 00:00:00 2001
a85faa
From: Thomas Haller <thaller@redhat.com>
a85faa
Date: Wed, 21 Sep 2016 17:07:42 +0200
a85faa
Subject: [PATCH 1/2] device: fix nm_utils_match_connection() for
a85faa
 NMSettingInfiniband:mac-address
a85faa
a85faa
    <debug> [1474469475.3318] Connection 'inf_ib0' differs from candidate 't-inf' in infiniband.mac-address
a85faa
    <debug> [1474469475.3318] manager: (inf_ib0): generated connection 'inf_ib0'
a85faa
a85faa
https://bugzilla.redhat.com/show_bug.cgi?id=1375558
a85faa
(cherry picked from commit 78957c0d399c715969b3989b2678d1e8179983f4)
a85faa
(cherry picked from commit f6c0c2d46e8dcdf42e6a8dc826b34c8e8bbb5856)
a85faa
---
a85faa
 src/NetworkManagerUtils.c | 36 ++++++++++++++++++++++++++++++++++++
a85faa
 1 file changed, 36 insertions(+)
a85faa
a85faa
diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c
a85faa
index 7eb6cf1..7cfe03f 100644
a85faa
--- a/src/NetworkManagerUtils.c
a85faa
+++ b/src/NetworkManagerUtils.c
a85faa
@@ -528,6 +528,39 @@ check_connection_mac_address (NMConnection *orig,
a85faa
 }
a85faa
 
a85faa
 static gboolean
a85faa
+check_connection_infiniband_mac_address (NMConnection *orig,
a85faa
+                                         NMConnection *candidate,
a85faa
+                                         GHashTable *settings)
a85faa
+{
a85faa
+	GHashTable *props;
a85faa
+	const char *orig_mac = NULL, *cand_mac = NULL;
a85faa
+	NMSettingInfiniband *s_infiniband_orig, *s_infiniband_cand;
a85faa
+
a85faa
+	props = check_property_in_hash (settings,
a85faa
+	                                NM_SETTING_INFINIBAND_SETTING_NAME,
a85faa
+	                                NM_SETTING_INFINIBAND_MAC_ADDRESS);
a85faa
+	if (!props)
a85faa
+		return TRUE;
a85faa
+
a85faa
+	/* If one of the MAC addresses is NULL, we accept that connection */
a85faa
+	s_infiniband_orig = nm_connection_get_setting_infiniband (orig);
a85faa
+	if (s_infiniband_orig)
a85faa
+		orig_mac = nm_setting_infiniband_get_mac_address (s_infiniband_orig);
a85faa
+
a85faa
+	s_infiniband_cand = nm_connection_get_setting_infiniband (candidate);
a85faa
+	if (s_infiniband_cand)
a85faa
+		cand_mac = nm_setting_infiniband_get_mac_address (s_infiniband_cand);
a85faa
+
a85faa
+	if (!orig_mac || !cand_mac) {
a85faa
+		remove_from_hash (settings, props,
a85faa
+		                  NM_SETTING_INFINIBAND_SETTING_NAME,
a85faa
+		                  NM_SETTING_INFINIBAND_MAC_ADDRESS);
a85faa
+		return TRUE;
a85faa
+	}
a85faa
+	return FALSE;
a85faa
+}
a85faa
+
a85faa
+static gboolean
a85faa
 check_connection_cloned_mac_address (NMConnection *orig,
a85faa
                                      NMConnection *candidate,
a85faa
                                      GHashTable *settings)
a85faa
@@ -640,6 +673,9 @@ check_possible_match (NMConnection *orig,
a85faa
 	if (!check_connection_mac_address (orig, candidate, settings))
a85faa
 		return NULL;
a85faa
 
a85faa
+	if (!check_connection_infiniband_mac_address (orig, candidate, settings))
a85faa
+		return NULL;
a85faa
+
a85faa
 	if (!check_connection_cloned_mac_address (orig, candidate, settings))
a85faa
 		return NULL;
a85faa
 
a85faa
-- 
a85faa
2.7.4
a85faa
a85faa
a85faa
From ed33ddbdb33da478be62a20c2e4f5286df081969 Mon Sep 17 00:00:00 2001
a85faa
From: Thomas Haller <thaller@redhat.com>
a85faa
Date: Thu, 22 Sep 2016 18:15:19 +0200
a85faa
Subject: [PATCH 2/2] libnm: relax comparison of bond-option for INFERRABLE
a85faa
 match
a85faa
a85faa
When comparing the bond-settings of an activated device against
a85faa
the settings from the connection, some properties might easily
a85faa
differ. Hack them around in NMSettingBond:compare_property().
a85faa
a85faa
For example:
a85faa
a85faa
the setting in the connection has:
a85faa
    [bond]
a85faa
    mode=active-backup
a85faa
a85faa
later, the device gets:
a85faa
    [bond]
a85faa
    active_slave=inf_ib0
a85faa
    fail_over_mac=active
a85faa
    mode=active-backup
a85faa
a85faa
Note that the fail_over_mac changes due to:
a85faa
  kernel: nm-bond: enslaved VLAN challenged slave inf_ib0. Adding VLANs will be blocked as long as inf_ib0 is part of bond nm-bond
a85faa
  kernel: nm-bond: The slave device specified does not support setting the MAC address
a85faa
  kernel: nm-bond: Setting fail_over_mac to active for active-backup mode
a85faa
a85faa
https://bugzilla.redhat.com/show_bug.cgi?id=1375558
a85faa
(cherry picked from commit 0fb723e7205f7c0ba038c463047eb780171e85a2)
a85faa
(cherry picked from commit 8e6a706e20d517645b0201e663659f7b6a2b8b52)
a85faa
---
a85faa
 libnm-core/nm-setting-bond.c | 28 +++++++++++++++++++++++-----
a85faa
 1 file changed, 23 insertions(+), 5 deletions(-)
a85faa
a85faa
diff --git a/libnm-core/nm-setting-bond.c b/libnm-core/nm-setting-bond.c
a85faa
index a82d0d7..0364c49 100644
a85faa
--- a/libnm-core/nm-setting-bond.c
a85faa
+++ b/libnm-core/nm-setting-bond.c
a85faa
@@ -775,13 +775,27 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
a85faa
 }
a85faa
 
a85faa
 static gboolean
a85faa
-options_hash_match (NMSettingBond *s_bond, GHashTable *options1, GHashTable *options2)
a85faa
+options_hash_match (NMSettingBond *s_bond,
a85faa
+                    GHashTable *options1,
a85faa
+                    GHashTable *options2,
a85faa
+                    NMSettingCompareFlags flags)
a85faa
 {
a85faa
 	GHashTableIter iter;
a85faa
 	const char *key, *value, *value2;
a85faa
 
a85faa
 	g_hash_table_iter_init (&iter, options1);
a85faa
 	while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &value)) {
a85faa
+
a85faa
+		if (NM_FLAGS_HAS (flags, NM_SETTING_COMPARE_FLAG_INFERRABLE)) {
a85faa
+			/* when doing an inferrable match, the active-slave should be ignored
a85faa
+			 * as it might be differ from the setting in the connection.
a85faa
+			 *
a85faa
+			 * Also, the fail_over_mac setting can change, see for example
a85faa
+			 * https://bugzilla.redhat.com/show_bug.cgi?id=1375558#c8 */
a85faa
+			if (NM_IN_STRSET (key, "fail_over_mac", "active_slave"))
a85faa
+				continue;
a85faa
+		}
a85faa
+
a85faa
 		value2 = g_hash_table_lookup (options2, key);
a85faa
 
a85faa
 		if (!value2) {
a85faa
@@ -806,10 +820,13 @@ options_hash_match (NMSettingBond *s_bond, GHashTable *options1, GHashTable *opt
a85faa
 }
a85faa
 
a85faa
 static gboolean
a85faa
-options_equal (NMSettingBond *s_bond, GHashTable *options1, GHashTable *options2)
a85faa
+options_equal (NMSettingBond *s_bond,
a85faa
+               GHashTable *options1,
a85faa
+               GHashTable *options2,
a85faa
+               NMSettingCompareFlags flags)
a85faa
 {
a85faa
-	return    options_hash_match (s_bond, options1, options2)
a85faa
-	       && options_hash_match (s_bond, options2, options1);
a85faa
+	return    options_hash_match (s_bond, options1, options2, flags)
a85faa
+	       && options_hash_match (s_bond, options2, options1, flags);
a85faa
 }
a85faa
 
a85faa
 static gboolean
a85faa
@@ -823,7 +840,8 @@ compare_property (NMSetting *setting,
a85faa
 	if (nm_streq0 (prop_spec->name, NM_SETTING_BOND_OPTIONS)) {
a85faa
 		return options_equal (NM_SETTING_BOND (setting),
a85faa
 		                      NM_SETTING_BOND_GET_PRIVATE (setting)->options,
a85faa
-		                      NM_SETTING_BOND_GET_PRIVATE (other)->options);
a85faa
+		                      NM_SETTING_BOND_GET_PRIVATE (other)->options,
a85faa
+		                      flags);
a85faa
 	}
a85faa
 
a85faa
 	/* Otherwise chain up to parent to handle generic compare */
a85faa
-- 
a85faa
2.7.4
a85faa