mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-11 06:20:16 +01:00
wifi: update AP properties from supplicant signals
This commit is contained in:
parent
37760fdc83
commit
0bdee17402
3 changed files with 37 additions and 17 deletions
|
|
@ -1709,7 +1709,7 @@ supplicant_iface_bss_updated_cb (NMSupplicantInterface *iface,
|
|||
/* Update the AP's last-seen property */
|
||||
ap = get_ap_by_supplicant_path (self, object_path);
|
||||
if (ap)
|
||||
nm_ap_set_last_seen (ap, nm_utils_get_monotonic_timestamp_s ());
|
||||
nm_ap_update_from_properties (ap, object_path, properties);
|
||||
|
||||
/* Remove outdated access points */
|
||||
schedule_scanlist_cull (self);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "nm-setting-wireless.h"
|
||||
#include "nm-glib-compat.h"
|
||||
#include "gsystem-local-alloc.h"
|
||||
|
||||
#include "nm-access-point-glue.h"
|
||||
|
||||
|
|
@ -370,14 +371,13 @@ security_from_vardict (GVariant *security)
|
|||
return flags;
|
||||
}
|
||||
|
||||
NMAccessPoint *
|
||||
nm_ap_new_from_properties (const char *supplicant_path, GVariant *properties)
|
||||
void
|
||||
nm_ap_update_from_properties (NMAccessPoint *ap,
|
||||
const char *supplicant_path,
|
||||
GVariant *properties)
|
||||
{
|
||||
const char bad_bssid1[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
const char bad_bssid2[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
const char *addr;
|
||||
const guint8 *bytes;
|
||||
NMAccessPoint *ap;
|
||||
GVariant *v;
|
||||
gsize len;
|
||||
gboolean b = FALSE;
|
||||
|
|
@ -385,9 +385,8 @@ nm_ap_new_from_properties (const char *supplicant_path, GVariant *properties)
|
|||
gint16 i16;
|
||||
guint16 u16;
|
||||
|
||||
g_return_val_if_fail (properties != NULL, NULL);
|
||||
|
||||
ap = nm_ap_new ();
|
||||
g_return_if_fail (ap != NULL);
|
||||
g_return_if_fail (properties != NULL);
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (ap));
|
||||
|
||||
|
|
@ -421,6 +420,9 @@ nm_ap_new_from_properties (const char *supplicant_path, GVariant *properties)
|
|||
g_variant_unref (v);
|
||||
}
|
||||
|
||||
if (!nm_ap_get_ssid (ap))
|
||||
nm_ap_set_broadcast (ap, FALSE);
|
||||
|
||||
v = g_variant_lookup_value (properties, "BSSID", G_VARIANT_TYPE_BYTESTRING);
|
||||
if (v) {
|
||||
bytes = g_variant_get_fixed_array (v, &len, 1);
|
||||
|
|
@ -459,7 +461,28 @@ nm_ap_new_from_properties (const char *supplicant_path, GVariant *properties)
|
|||
g_variant_unref (v);
|
||||
}
|
||||
|
||||
nm_ap_set_supplicant_path (ap, supplicant_path);
|
||||
if (!nm_ap_get_supplicant_path (ap))
|
||||
nm_ap_set_supplicant_path (ap, supplicant_path);
|
||||
|
||||
nm_ap_set_last_seen (ap, nm_utils_get_monotonic_timestamp_s ());
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (ap));
|
||||
}
|
||||
|
||||
NMAccessPoint *
|
||||
nm_ap_new_from_properties (const char *supplicant_path, GVariant *properties)
|
||||
{
|
||||
const char bad_bssid1[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
const char bad_bssid2[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
NMAccessPoint *ap;
|
||||
const char *addr;
|
||||
|
||||
g_return_val_if_fail (supplicant_path != NULL, NULL);
|
||||
g_return_val_if_fail (properties != NULL, NULL);
|
||||
|
||||
ap = nm_ap_new ();
|
||||
|
||||
nm_ap_update_from_properties (ap, supplicant_path, properties);
|
||||
|
||||
/* ignore APs with invalid BSSIDs */
|
||||
addr = nm_ap_get_address (ap);
|
||||
|
|
@ -469,13 +492,6 @@ nm_ap_new_from_properties (const char *supplicant_path, GVariant *properties)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
nm_ap_set_last_seen (ap, nm_utils_get_monotonic_timestamp_s ());
|
||||
|
||||
if (!nm_ap_get_ssid (ap))
|
||||
nm_ap_set_broadcast (ap, FALSE);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (ap));
|
||||
|
||||
return ap;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,10 @@ NMAccessPoint * nm_ap_new_from_properties (const char *supplicant_path,
|
|||
NMAccessPoint * nm_ap_new_fake_from_connection (NMConnection *connection);
|
||||
void nm_ap_export_to_dbus (NMAccessPoint *ap);
|
||||
|
||||
void nm_ap_update_from_properties (NMAccessPoint *ap,
|
||||
const char *supplicant_path,
|
||||
GVariant *properties);
|
||||
|
||||
const char *nm_ap_get_dbus_path (NMAccessPoint *ap);
|
||||
|
||||
const char *nm_ap_get_supplicant_path (NMAccessPoint *ap);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue