mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-08 08:00:34 +01:00
settings: update seen-bssids property in 802-11-wireless setting for GetSettings
https://bugzilla.gnome.org/show_bug.cgi?id=672501
This commit is contained in:
parent
dd42da51a8
commit
65029e0f89
2 changed files with 42 additions and 0 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include <nm-setting-connection.h>
|
||||
#include <nm-setting-vpn.h>
|
||||
#include <nm-setting-wireless.h>
|
||||
#include <nm-utils.h>
|
||||
|
||||
#include "nm-settings-connection.h"
|
||||
|
|
@ -1062,7 +1063,9 @@ get_settings_auth_cb (NMSettingsConnection *self,
|
|||
GHashTable *settings;
|
||||
NMConnection *dupl_con;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWireless *s_wifi;
|
||||
guint64 timestamp = 0;
|
||||
GSList *bssid_list;
|
||||
|
||||
dupl_con = nm_connection_duplicate (NM_CONNECTION (self));
|
||||
g_assert (dupl_con);
|
||||
|
|
@ -1079,6 +1082,16 @@ get_settings_auth_cb (NMSettingsConnection *self,
|
|||
g_assert (s_con);
|
||||
g_object_set (s_con, NM_SETTING_CONNECTION_TIMESTAMP, timestamp, NULL);
|
||||
}
|
||||
/* Seen BSSIDs are not updated in 802-11-wireless 'seen-bssids' property
|
||||
* from the same reason as timestamp. Thus we put it here to GetSettings()
|
||||
* return settings too.
|
||||
*/
|
||||
bssid_list = nm_settings_connection_get_seen_bssids (self);
|
||||
s_wifi = nm_connection_get_setting_wireless (NM_CONNECTION (dupl_con));
|
||||
if (bssid_list && s_wifi) {
|
||||
g_object_set (s_wifi, NM_SETTING_WIRELESS_SEEN_BSSIDS, bssid_list, NULL);
|
||||
nm_utils_slist_free (bssid_list, g_free);
|
||||
}
|
||||
|
||||
/* Secrets should *never* be returned by the GetSettings method, they
|
||||
* get returned by the GetSecrets method which can be better
|
||||
|
|
@ -1544,6 +1557,33 @@ mac_dup (const struct ether_addr *old)
|
|||
return new;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_settings_connection_get_seen_bssids:
|
||||
* @connection: the #NMSettingsConnection
|
||||
*
|
||||
* Returns current list of seen BSSIDs for the connection.
|
||||
*
|
||||
* Returns: (transfer full) list of seen BSSIDs (in the standard hex-digits-and-colons notation).
|
||||
* The caller is responsible for freeing the list.
|
||||
**/
|
||||
GSList *
|
||||
nm_settings_connection_get_seen_bssids (NMSettingsConnection *connection)
|
||||
{
|
||||
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
|
||||
GHashTableIter iter;
|
||||
char *bssid_str;
|
||||
GSList *bssid_list = NULL;
|
||||
|
||||
g_return_val_if_fail (connection != NULL, 0);
|
||||
g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), NULL);
|
||||
|
||||
g_hash_table_iter_init (&iter, priv->seen_bssids);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &bssid_str))
|
||||
bssid_list = g_slist_prepend (bssid_list, g_strdup (bssid_str));
|
||||
|
||||
return bssid_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_settings_connection_has_seen_bssid:
|
||||
* @connection: the #NMSettingsConnection
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ void nm_settings_connection_update_timestamp (NMSettingsConnection *connection,
|
|||
|
||||
void nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *connection);
|
||||
|
||||
GSList *nm_settings_connection_get_seen_bssids (NMSettingsConnection *connection);
|
||||
|
||||
gboolean nm_settings_connection_has_seen_bssid (NMSettingsConnection *connection,
|
||||
const struct ether_addr *bssid);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue