mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-09 23:40:33 +01:00
core: fix nm_settings_get_connections() result confusion
It used to reference items in the list, but no longer does because that's stupid. Fixes some merge damage and a leak.
This commit is contained in:
parent
3de9332f09
commit
02d942320d
3 changed files with 16 additions and 24 deletions
|
|
@ -992,32 +992,27 @@ manager_hidden_ap_found (NMDeviceInterface *device,
|
|||
|
||||
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
|
||||
if (!s_wireless)
|
||||
goto next;
|
||||
continue;
|
||||
|
||||
num_bssids = nm_setting_wireless_get_num_seen_bssids (s_wireless);
|
||||
if (num_bssids < 1)
|
||||
goto next;
|
||||
continue;
|
||||
|
||||
ssid = nm_setting_wireless_get_ssid (s_wireless);
|
||||
g_assert (ssid);
|
||||
|
||||
for (i = 0; i < num_bssids; i++) {
|
||||
for (i = 0; i < num_bssids && !done; i++) {
|
||||
const char *seen_bssid = nm_setting_wireless_get_seen_bssid (s_wireless, i);
|
||||
struct ether_addr seen_addr;
|
||||
|
||||
if (!ether_aton_r (seen_bssid, &seen_addr))
|
||||
continue;
|
||||
|
||||
if (memcmp (ap_addr, &seen_addr, sizeof (struct ether_addr)))
|
||||
continue;
|
||||
|
||||
/* Copy the SSID from the connection to the AP */
|
||||
nm_ap_set_ssid (ap, ssid);
|
||||
done = TRUE;
|
||||
if (ether_aton_r (seen_bssid, &seen_addr)) {
|
||||
if (memcmp (ap_addr, &seen_addr, sizeof (struct ether_addr))) {
|
||||
/* Copy the SSID from the connection to the AP */
|
||||
nm_ap_set_ssid (ap, ssid);
|
||||
done = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next:
|
||||
g_object_unref (connection);
|
||||
}
|
||||
g_slist_free (connections);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -767,11 +767,9 @@ auto_activate_device (gpointer user_data)
|
|||
if (g_object_get_data (G_OBJECT (iter_connection), INVALID_TAG)) {
|
||||
guint retries = get_connection_auto_retries (iter_connection);
|
||||
|
||||
if (retries == 0) {
|
||||
connections = g_slist_remove_link (connections, iter);
|
||||
g_object_unref (iter_connection);
|
||||
g_slist_free (iter);
|
||||
} else if (retries > 0)
|
||||
if (retries == 0)
|
||||
connections = g_slist_remove (connections, iter_connection);
|
||||
else if (retries > 0)
|
||||
set_connection_auto_retries (iter_connection, retries - 1);
|
||||
} else {
|
||||
/* Set the initial # of retries for auto-connection */
|
||||
|
|
@ -802,7 +800,6 @@ auto_activate_device (gpointer user_data)
|
|||
}
|
||||
}
|
||||
|
||||
g_slist_foreach (connections, (GFunc) g_object_unref, NULL);
|
||||
g_slist_free (connections);
|
||||
|
||||
out:
|
||||
|
|
|
|||
|
|
@ -240,8 +240,8 @@ connection_sort (gconstpointer pa, gconstpointer pb)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Returns a GSList of referenced NMConnection objects, caller must
|
||||
* unref the connections in the list and destroy the list.
|
||||
/* Returns a list of NMSysconfigConnections. Caller must free the list with
|
||||
* g_slist_free().
|
||||
*/
|
||||
GSList *
|
||||
nm_settings_get_connections (NMSettings *self)
|
||||
|
|
@ -255,7 +255,7 @@ nm_settings_get_connections (NMSettings *self)
|
|||
g_hash_table_iter_init (&iter, NM_SETTINGS_GET_PRIVATE (self)->connections);
|
||||
while (g_hash_table_iter_next (&iter, NULL, &data))
|
||||
list = g_slist_insert_sorted (list, data, connection_sort);
|
||||
return g_slist_reverse (list);
|
||||
return list;
|
||||
}
|
||||
|
||||
NMSysconfigConnection *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue