summary refs log tree commit diff
path: root/src/NetworkManagerUtils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/NetworkManagerUtils.c')
-rw-r--r--src/NetworkManagerUtils.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c
index 7eb6cf16..7cfe03f1 100644
--- a/src/NetworkManagerUtils.c
+++ b/src/NetworkManagerUtils.c
@@ -528,6 +528,39 @@ check_connection_mac_address (NMConnection *orig,
 }
 
 static gboolean
+check_connection_infiniband_mac_address (NMConnection *orig,
+                                         NMConnection *candidate,
+                                         GHashTable *settings)
+{
+	GHashTable *props;
+	const char *orig_mac = NULL, *cand_mac = NULL;
+	NMSettingInfiniband *s_infiniband_orig, *s_infiniband_cand;
+
+	props = check_property_in_hash (settings,
+	                                NM_SETTING_INFINIBAND_SETTING_NAME,
+	                                NM_SETTING_INFINIBAND_MAC_ADDRESS);
+	if (!props)
+		return TRUE;
+
+	/* If one of the MAC addresses is NULL, we accept that connection */
+	s_infiniband_orig = nm_connection_get_setting_infiniband (orig);
+	if (s_infiniband_orig)
+		orig_mac = nm_setting_infiniband_get_mac_address (s_infiniband_orig);
+
+	s_infiniband_cand = nm_connection_get_setting_infiniband (candidate);
+	if (s_infiniband_cand)
+		cand_mac = nm_setting_infiniband_get_mac_address (s_infiniband_cand);
+
+	if (!orig_mac || !cand_mac) {
+		remove_from_hash (settings, props,
+		                  NM_SETTING_INFINIBAND_SETTING_NAME,
+		                  NM_SETTING_INFINIBAND_MAC_ADDRESS);
+		return TRUE;
+	}
+	return FALSE;
+}
+
+static gboolean
 check_connection_cloned_mac_address (NMConnection *orig,
                                      NMConnection *candidate,
                                      GHashTable *settings)
@@ -640,6 +673,9 @@ check_possible_match (NMConnection *orig,
 	if (!check_connection_mac_address (orig, candidate, settings))
 		return NULL;
 
+	if (!check_connection_infiniband_mac_address (orig, candidate, settings))
+		return NULL;
+
 	if (!check_connection_cloned_mac_address (orig, candidate, settings))
 		return NULL;