diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index 7eb6cf1607..7cfe03f1df 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -527,6 +527,39 @@ check_connection_mac_address (NMConnection *orig, return FALSE; } +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, @@ -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;