merge: follow supplicant's AP list instead of managing lifetime internally (bgo #748593)
This commit is contained in:
@@ -127,10 +127,11 @@ struct _NMDeviceWifiPrivate {
|
||||
guint32 rate;
|
||||
gboolean enabled; /* rfkilled or not */
|
||||
|
||||
gint32 last_scan;
|
||||
gint32 scheduled_scan_time;
|
||||
guint8 scan_interval; /* seconds */
|
||||
guint pending_scan_id;
|
||||
guint scanlist_cull_id;
|
||||
guint ap_dump_id;
|
||||
gboolean requested_scan;
|
||||
|
||||
NMSupplicantManager *sup_mgr;
|
||||
@@ -188,8 +189,6 @@ static void supplicant_iface_notify_current_bss (NMSupplicantInterface *iface,
|
||||
GParamSpec *pspec,
|
||||
NMDeviceWifi *self);
|
||||
|
||||
static void schedule_scanlist_cull (NMDeviceWifi *self);
|
||||
|
||||
static gboolean request_wireless_scan (gpointer user_data);
|
||||
|
||||
static void emit_ap_added_removed (NMDeviceWifi *self,
|
||||
@@ -304,10 +303,7 @@ supplicant_interface_release (NMDeviceWifi *self)
|
||||
_LOGD (LOGD_WIFI_SCAN, "reset scanning interval to %d seconds",
|
||||
priv->scan_interval);
|
||||
|
||||
if (priv->scanlist_cull_id) {
|
||||
g_source_remove (priv->scanlist_cull_id);
|
||||
priv->scanlist_cull_id = 0;
|
||||
}
|
||||
nm_clear_g_source (&priv->ap_dump_id);
|
||||
|
||||
if (priv->sup_iface) {
|
||||
remove_supplicant_interface_error_handler (self);
|
||||
@@ -1021,24 +1017,6 @@ get_sorted_ap_list (NMDeviceWifi *self)
|
||||
return g_slist_sort (sorted, (GCompareFunc) ap_id_compare);
|
||||
}
|
||||
|
||||
static void
|
||||
ap_list_dump (NMDeviceWifi *self)
|
||||
{
|
||||
GSList *sorted, *iter;
|
||||
|
||||
g_return_if_fail (NM_IS_DEVICE_WIFI (self));
|
||||
|
||||
if (!nm_logging_enabled (LOGL_DEBUG, LOGD_WIFI_SCAN))
|
||||
return;
|
||||
|
||||
_LOGD (LOGD_WIFI_SCAN, "Current AP list:");
|
||||
sorted = get_sorted_ap_list (self);
|
||||
for (iter = sorted; iter; iter = iter->next)
|
||||
nm_ap_dump (NM_AP (iter->data), "List AP: ");
|
||||
g_slist_free (sorted);
|
||||
_LOGD (LOGD_WIFI_SCAN, "Current AP list: done");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
impl_device_get_access_points (NMDeviceWifi *self,
|
||||
GPtrArray **aps,
|
||||
@@ -1434,13 +1412,9 @@ supplicant_iface_scan_done_cb (NMSupplicantInterface *iface,
|
||||
|
||||
_LOGD (LOGD_WIFI_SCAN, "scan %s", success ? "successful" : "failed");
|
||||
|
||||
priv->last_scan = nm_utils_get_monotonic_timestamp_s ();
|
||||
schedule_scan (self, success);
|
||||
|
||||
/* Ensure that old APs get removed, which otherwise only
|
||||
* happens when there are new BSSes.
|
||||
*/
|
||||
schedule_scanlist_cull (self);
|
||||
|
||||
if (priv->requested_scan) {
|
||||
priv->requested_scan = FALSE;
|
||||
nm_device_remove_pending_action (NM_DEVICE (self), "scan", TRUE);
|
||||
@@ -1452,7 +1426,35 @@ supplicant_iface_scan_done_cb (NMSupplicantInterface *iface,
|
||||
*
|
||||
*/
|
||||
|
||||
#define WPAS_REMOVED_TAG "supplicant-removed"
|
||||
static gboolean
|
||||
ap_list_dump (gpointer user_data)
|
||||
{
|
||||
NMDeviceWifi *self = NM_DEVICE_WIFI (user_data);
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
GSList *sorted, *iter;
|
||||
|
||||
priv->ap_dump_id = 0;
|
||||
_LOGD (LOGD_WIFI_SCAN, "APs: [now:%u last:%u next:%u]",
|
||||
nm_utils_get_monotonic_timestamp_s (),
|
||||
priv->last_scan,
|
||||
priv->scheduled_scan_time);
|
||||
sorted = get_sorted_ap_list (self);
|
||||
for (iter = sorted; iter; iter = iter->next)
|
||||
nm_ap_dump (NM_AP (iter->data), " ", nm_device_get_iface (NM_DEVICE (self)));
|
||||
g_slist_free (sorted);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
schedule_ap_list_dump (NMDeviceWifi *self)
|
||||
{
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
|
||||
if (!nm_logging_enabled (LOGL_DEBUG, LOGD_WIFI_SCAN))
|
||||
return;
|
||||
nm_clear_g_source (&priv->ap_dump_id);
|
||||
priv->ap_dump_id = g_timeout_add_seconds (1, ap_list_dump, self);
|
||||
}
|
||||
|
||||
static void
|
||||
try_fill_ssid_for_hidden_ap (NMAccessPoint *ap)
|
||||
@@ -1486,137 +1488,6 @@ try_fill_ssid_for_hidden_ap (NMAccessPoint *ap)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
merge_scanned_ap (NMDeviceWifi *self,
|
||||
NMAccessPoint *merge_ap,
|
||||
const char *supplicant_path,
|
||||
GVariant *properties)
|
||||
{
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
NMAccessPoint *found_ap = NULL;
|
||||
const GByteArray *ssid;
|
||||
const char *bssid;
|
||||
|
||||
/* Let the manager try to fill in the SSID from seen-bssids lists */
|
||||
bssid = nm_ap_get_address (merge_ap);
|
||||
ssid = nm_ap_get_ssid (merge_ap);
|
||||
if (!ssid || nm_utils_is_empty_ssid (ssid->data, ssid->len)) {
|
||||
/* Try to fill the SSID from the AP database */
|
||||
try_fill_ssid_for_hidden_ap (merge_ap);
|
||||
|
||||
ssid = nm_ap_get_ssid (merge_ap);
|
||||
if (ssid && (nm_utils_is_empty_ssid (ssid->data, ssid->len) == FALSE)) {
|
||||
/* Yay, matched it, no longer treat as hidden */
|
||||
_LOGD (LOGD_WIFI_SCAN, "matched hidden AP %s => '%s'",
|
||||
str_if_set (bssid, "(none)"), nm_utils_escape_ssid (ssid->data, ssid->len));
|
||||
} else {
|
||||
/* Didn't have an entry for this AP in the database */
|
||||
_LOGD (LOGD_WIFI_SCAN, "failed to match hidden AP %s",
|
||||
str_if_set (bssid, "(none)"));
|
||||
}
|
||||
}
|
||||
|
||||
found_ap = get_ap_by_supplicant_path (self, supplicant_path);
|
||||
if (!found_ap)
|
||||
found_ap = nm_ap_match_in_hash (merge_ap, priv->aps);
|
||||
if (found_ap) {
|
||||
_LOGD (LOGD_WIFI_SCAN, "merging AP '%s' %s (%p) with existing (%p)",
|
||||
ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(none)",
|
||||
str_if_set (bssid, "(none)"),
|
||||
merge_ap,
|
||||
found_ap);
|
||||
|
||||
nm_ap_update_from_properties (found_ap, supplicant_path, properties);
|
||||
nm_ap_set_fake (found_ap, FALSE);
|
||||
g_object_set_data (G_OBJECT (found_ap), WPAS_REMOVED_TAG, NULL);
|
||||
} else {
|
||||
/* New entry in the list */
|
||||
_LOGD (LOGD_WIFI_SCAN, "adding new AP '%s' %s (%p)",
|
||||
ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(none)",
|
||||
str_if_set (bssid, "(none)"), merge_ap);
|
||||
|
||||
g_object_ref (merge_ap);
|
||||
nm_ap_export_to_dbus (merge_ap);
|
||||
g_hash_table_insert (priv->aps, (gpointer) nm_ap_get_dbus_path (merge_ap), merge_ap);
|
||||
emit_ap_added_removed (self, ACCESS_POINT_ADDED, merge_ap, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
cull_scan_list (NMDeviceWifi *self)
|
||||
{
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
gint32 now = nm_utils_get_monotonic_timestamp_s ();
|
||||
guint32 removed = 0, total = 0;
|
||||
GHashTableIter iter;
|
||||
NMAccessPoint *ap;
|
||||
|
||||
priv->scanlist_cull_id = 0;
|
||||
|
||||
_LOGD (LOGD_WIFI_SCAN, "checking scan list for outdated APs");
|
||||
|
||||
/* Walk the access point list and remove any access points older than
|
||||
* three times the inactive scan interval.
|
||||
*/
|
||||
g_hash_table_iter_init (&iter, priv->aps);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &ap)) {
|
||||
const guint prune_interval_s = SCAN_INTERVAL_MAX * 3;
|
||||
gint32 last_seen;
|
||||
|
||||
/* Don't cull the associated AP or manually created APs */
|
||||
if (ap == priv->current_ap)
|
||||
continue;
|
||||
g_assert (!nm_ap_get_fake (ap)); /* only the current_ap can be fake */
|
||||
|
||||
/* Don't cull APs still known to the supplicant. Since the supplicant
|
||||
* doesn't yet emit property updates for "last seen" we have to rely
|
||||
* on changing signal strength for updating "last seen". But if the
|
||||
* AP's strength doesn't change we won't get any updates for the AP,
|
||||
* and we'll end up here even if the AP was still found by the
|
||||
* supplicant in the last scan.
|
||||
*/
|
||||
if ( nm_ap_get_supplicant_path (ap)
|
||||
&& g_object_get_data (G_OBJECT (ap), WPAS_REMOVED_TAG) == NULL)
|
||||
continue;
|
||||
|
||||
last_seen = nm_ap_get_last_seen (ap);
|
||||
if (!last_seen || last_seen + prune_interval_s < now) {
|
||||
const GByteArray *ssid = nm_ap_get_ssid (ap);
|
||||
|
||||
_LOGD (LOGD_WIFI_SCAN,
|
||||
" removing %s (%s%s%s)",
|
||||
str_if_set (nm_ap_get_address (ap), "(none)"),
|
||||
ssid ? "'" : "",
|
||||
ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(none)",
|
||||
ssid ? "'" : "");
|
||||
emit_ap_added_removed (self, ACCESS_POINT_REMOVED, ap, FALSE);
|
||||
g_hash_table_iter_remove (&iter);
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
|
||||
_LOGD (LOGD_WIFI_SCAN, "removed %d APs (of %d)",
|
||||
removed, total);
|
||||
|
||||
ap_list_dump (self);
|
||||
|
||||
if(removed > 0)
|
||||
nm_device_recheck_available_connections (NM_DEVICE (self));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
schedule_scanlist_cull (NMDeviceWifi *self)
|
||||
{
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
|
||||
/* Cull the scan list after the last request for it has come in */
|
||||
if (priv->scanlist_cull_id)
|
||||
g_source_remove (priv->scanlist_cull_id);
|
||||
priv->scanlist_cull_id = g_timeout_add_seconds (4, (GSourceFunc) cull_scan_list, self);
|
||||
}
|
||||
|
||||
static void
|
||||
supplicant_iface_new_bss_cb (NMSupplicantInterface *iface,
|
||||
const char *object_path,
|
||||
@@ -1626,6 +1497,9 @@ supplicant_iface_new_bss_cb (NMSupplicantInterface *iface,
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
NMDeviceState state;
|
||||
NMAccessPoint *ap;
|
||||
NMAccessPoint *found_ap = NULL;
|
||||
const GByteArray *ssid;
|
||||
const char *bssid;
|
||||
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (properties != NULL);
|
||||
@@ -1639,11 +1513,43 @@ supplicant_iface_new_bss_cb (NMSupplicantInterface *iface,
|
||||
return;
|
||||
|
||||
ap = nm_ap_new_from_properties (object_path, properties);
|
||||
if (ap) {
|
||||
nm_ap_dump (ap, "New AP: ");
|
||||
if (!ap) {
|
||||
_LOGW (LOGD_WIFI_SCAN, "invalid AP properties received");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Let the manager try to fill in the SSID from seen-bssids lists */
|
||||
bssid = nm_ap_get_address (ap);
|
||||
ssid = nm_ap_get_ssid (ap);
|
||||
if (!ssid || nm_utils_is_empty_ssid (ssid->data, ssid->len)) {
|
||||
/* Try to fill the SSID from the AP database */
|
||||
try_fill_ssid_for_hidden_ap (ap);
|
||||
|
||||
ssid = nm_ap_get_ssid (ap);
|
||||
if (ssid && (nm_utils_is_empty_ssid (ssid->data, ssid->len) == FALSE)) {
|
||||
/* Yay, matched it, no longer treat as hidden */
|
||||
_LOGD (LOGD_WIFI_SCAN, "matched hidden AP %s => '%s'",
|
||||
str_if_set (bssid, "(none)"), nm_utils_escape_ssid (ssid->data, ssid->len));
|
||||
} else {
|
||||
/* Didn't have an entry for this AP in the database */
|
||||
_LOGD (LOGD_WIFI_SCAN, "failed to match hidden AP %s",
|
||||
str_if_set (bssid, "(none)"));
|
||||
}
|
||||
}
|
||||
|
||||
found_ap = get_ap_by_supplicant_path (self, object_path);
|
||||
if (found_ap) {
|
||||
nm_ap_dump (ap, "updated ", nm_device_get_iface (NM_DEVICE (self)));
|
||||
nm_ap_update_from_properties (found_ap, object_path, properties);
|
||||
} else {
|
||||
nm_ap_dump (ap, "added ", nm_device_get_iface (NM_DEVICE (self)));
|
||||
nm_ap_export_to_dbus (ap);
|
||||
g_hash_table_insert (priv->aps,
|
||||
(gpointer) nm_ap_get_dbus_path (ap),
|
||||
g_object_ref (ap));
|
||||
emit_ap_added_removed (self, ACCESS_POINT_ADDED, ap, TRUE);
|
||||
}
|
||||
|
||||
/* Add the AP to the device's AP list */
|
||||
merge_scanned_ap (self, ap, object_path, properties);
|
||||
g_object_unref (ap);
|
||||
|
||||
/* Update the current AP if the supplicant notified a current BSS change
|
||||
@@ -1651,11 +1557,8 @@ supplicant_iface_new_bss_cb (NMSupplicantInterface *iface,
|
||||
*/
|
||||
if (g_strcmp0 (nm_supplicant_interface_get_current_bss (iface), object_path) == 0)
|
||||
supplicant_iface_notify_current_bss (priv->sup_iface, NULL, self);
|
||||
} else
|
||||
_LOGW (LOGD_WIFI_SCAN, "invalid AP properties received");
|
||||
|
||||
/* Remove outdated access points */
|
||||
schedule_scanlist_cull (self);
|
||||
schedule_ap_list_dump (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1676,13 +1579,12 @@ supplicant_iface_bss_updated_cb (NMSupplicantInterface *iface,
|
||||
if (state <= NM_DEVICE_STATE_UNAVAILABLE)
|
||||
return;
|
||||
|
||||
/* Update the AP's last-seen property */
|
||||
ap = get_ap_by_supplicant_path (self, object_path);
|
||||
if (ap)
|
||||
if (ap) {
|
||||
nm_ap_dump (ap, "updated ", nm_device_get_iface (NM_DEVICE (self)));
|
||||
nm_ap_update_from_properties (ap, object_path, properties);
|
||||
|
||||
/* Remove outdated access points */
|
||||
schedule_scanlist_cull (self);
|
||||
schedule_ap_list_dump (self);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1690,27 +1592,28 @@ supplicant_iface_bss_removed_cb (NMSupplicantInterface *iface,
|
||||
const char *object_path,
|
||||
NMDeviceWifi *self)
|
||||
{
|
||||
NMDeviceWifiPrivate *priv;
|
||||
NMAccessPoint *ap;
|
||||
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (object_path != NULL);
|
||||
|
||||
priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
ap = get_ap_by_supplicant_path (self, object_path);
|
||||
if (ap) {
|
||||
gint32 now = nm_utils_get_monotonic_timestamp_s ();
|
||||
gint32 last_seen = nm_ap_get_last_seen (ap);
|
||||
|
||||
/* We don't know when the supplicant last saw the AP's beacons,
|
||||
* it could be two minutes or it could be 2 seconds. Because the
|
||||
* supplicant doesn't send property change notifications if the
|
||||
* AP's other properties don't change, our last-seen time may be
|
||||
* much older the supplicant's, and the AP would be immediately
|
||||
* removed from the list on the next cleanup. So update the
|
||||
* last-seen time to ensure the AP sticks around for at least
|
||||
* one more periodic scan.
|
||||
if (ap == priv->current_ap) {
|
||||
/* The current AP cannot be removed (to prevent NM indicating that
|
||||
* it is connected, but to nothing), but it must be removed later
|
||||
* when the current AP is changed or cleared. Set 'fake' to
|
||||
* indicate that this AP is now unknown to the supplicant.
|
||||
*/
|
||||
nm_ap_set_last_seen (ap, MAX (last_seen, now - SCAN_INTERVAL_MAX));
|
||||
g_object_set_data (G_OBJECT (ap), WPAS_REMOVED_TAG, GUINT_TO_POINTER (TRUE));
|
||||
nm_ap_set_fake (ap, TRUE);
|
||||
} else {
|
||||
nm_ap_dump (ap, "removed ", nm_device_get_iface (NM_DEVICE (self)));
|
||||
emit_ap_added_removed (self, ACCESS_POINT_REMOVED, ap, TRUE);
|
||||
g_hash_table_remove (priv->aps, nm_ap_get_dbus_path (ap));
|
||||
schedule_ap_list_dump (self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -65,49 +65,6 @@ 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);
|
||||
void nm_ap_set_supplicant_path (NMAccessPoint *ap,
|
||||
const char *path);
|
||||
|
||||
guint32 nm_ap_get_id (NMAccessPoint *ap);
|
||||
|
||||
const GByteArray *nm_ap_get_ssid (const NMAccessPoint * ap);
|
||||
void nm_ap_set_ssid (NMAccessPoint * ap, const guint8 * ssid, gsize len);
|
||||
|
||||
NM80211ApFlags nm_ap_get_flags (NMAccessPoint *ap);
|
||||
void nm_ap_set_flags (NMAccessPoint *ap, NM80211ApFlags flags);
|
||||
|
||||
NM80211ApSecurityFlags nm_ap_get_wpa_flags (NMAccessPoint *ap);
|
||||
void nm_ap_set_wpa_flags (NMAccessPoint *ap, NM80211ApSecurityFlags flags);
|
||||
|
||||
NM80211ApSecurityFlags nm_ap_get_rsn_flags (NMAccessPoint *ap);
|
||||
void nm_ap_set_rsn_flags (NMAccessPoint *ap, NM80211ApSecurityFlags flags);
|
||||
|
||||
const char *nm_ap_get_address (const NMAccessPoint *ap);
|
||||
void nm_ap_set_address (NMAccessPoint *ap, const char *addr);
|
||||
|
||||
NM80211Mode nm_ap_get_mode (NMAccessPoint *ap);
|
||||
void nm_ap_set_mode (NMAccessPoint *ap, const NM80211Mode mode);
|
||||
|
||||
gboolean nm_ap_is_hotspot (NMAccessPoint *ap);
|
||||
|
||||
gint8 nm_ap_get_strength (NMAccessPoint *ap);
|
||||
void nm_ap_set_strength (NMAccessPoint *ap, gint8 strength);
|
||||
|
||||
guint32 nm_ap_get_freq (NMAccessPoint *ap);
|
||||
void nm_ap_set_freq (NMAccessPoint *ap, guint32 freq);
|
||||
|
||||
guint32 nm_ap_get_max_bitrate (NMAccessPoint *ap);
|
||||
void nm_ap_set_max_bitrate (NMAccessPoint *ap, guint32 bitrate);
|
||||
|
||||
gboolean nm_ap_get_fake (const NMAccessPoint *ap);
|
||||
void nm_ap_set_fake (NMAccessPoint *ap, gboolean fake);
|
||||
|
||||
gint32 nm_ap_get_last_seen (const NMAccessPoint *ap);
|
||||
void nm_ap_set_last_seen (NMAccessPoint *ap, gint32 last_seen);
|
||||
|
||||
gboolean nm_ap_check_compatible (NMAccessPoint *self,
|
||||
NMConnection *connection);
|
||||
|
||||
@@ -116,8 +73,33 @@ gboolean nm_ap_complete_connection (NMAccessPoint *self,
|
||||
gboolean lock_bssid,
|
||||
GError **error);
|
||||
|
||||
NMAccessPoint * nm_ap_match_in_hash (NMAccessPoint *find_ap, GHashTable *hash);
|
||||
const char * nm_ap_get_dbus_path (NMAccessPoint *ap);
|
||||
const char * nm_ap_get_supplicant_path (NMAccessPoint *ap);
|
||||
guint32 nm_ap_get_id (NMAccessPoint *ap);
|
||||
const GByteArray *nm_ap_get_ssid (const NMAccessPoint *ap);
|
||||
void nm_ap_set_ssid (NMAccessPoint *ap,
|
||||
const guint8 *ssid,
|
||||
gsize len);
|
||||
const char * nm_ap_get_address (const NMAccessPoint *ap);
|
||||
void nm_ap_set_address (NMAccessPoint *ap,
|
||||
const char *addr);
|
||||
NM80211Mode nm_ap_get_mode (NMAccessPoint *ap);
|
||||
gboolean nm_ap_is_hotspot (NMAccessPoint *ap);
|
||||
gint8 nm_ap_get_strength (NMAccessPoint *ap);
|
||||
void nm_ap_set_strength (NMAccessPoint *ap,
|
||||
gint8 strength);
|
||||
guint32 nm_ap_get_freq (NMAccessPoint *ap);
|
||||
void nm_ap_set_freq (NMAccessPoint *ap,
|
||||
guint32 freq);
|
||||
guint32 nm_ap_get_max_bitrate (NMAccessPoint *ap);
|
||||
void nm_ap_set_max_bitrate (NMAccessPoint *ap,
|
||||
guint32 bitrate);
|
||||
gboolean nm_ap_get_fake (const NMAccessPoint *ap);
|
||||
void nm_ap_set_fake (NMAccessPoint *ap,
|
||||
gboolean fake);
|
||||
|
||||
void nm_ap_dump (NMAccessPoint *ap, const char *prefix);
|
||||
void nm_ap_dump (NMAccessPoint *self,
|
||||
const char *prefix,
|
||||
const char *ifname);
|
||||
|
||||
#endif /* __NETWORKMANAGER_ACCESS_POINT_H__ */
|
||||
|
@@ -3444,16 +3444,6 @@ wifi_get_bssid (NMPlatform *platform, int ifindex, guint8 *bssid)
|
||||
return wifi_utils_get_bssid (wifi_data, bssid);
|
||||
}
|
||||
|
||||
static GByteArray *
|
||||
wifi_get_ssid (NMPlatform *platform, int ifindex)
|
||||
{
|
||||
WifiData *wifi_data = wifi_get_wifi_data (platform, ifindex);
|
||||
|
||||
if (!wifi_data)
|
||||
return NULL;
|
||||
return wifi_utils_get_ssid (wifi_data);
|
||||
}
|
||||
|
||||
static guint32
|
||||
wifi_get_frequency (NMPlatform *platform, int ifindex)
|
||||
{
|
||||
@@ -4722,7 +4712,6 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
|
||||
|
||||
platform_class->wifi_get_capabilities = wifi_get_capabilities;
|
||||
platform_class->wifi_get_bssid = wifi_get_bssid;
|
||||
platform_class->wifi_get_ssid = wifi_get_ssid;
|
||||
platform_class->wifi_get_frequency = wifi_get_frequency;
|
||||
platform_class->wifi_get_quality = wifi_get_quality;
|
||||
platform_class->wifi_get_rate = wifi_get_rate;
|
||||
|
@@ -1556,17 +1556,6 @@ nm_platform_wifi_get_bssid (NMPlatform *self, int ifindex, guint8 *bssid)
|
||||
return klass->wifi_get_bssid (self, ifindex, bssid);
|
||||
}
|
||||
|
||||
GByteArray *
|
||||
nm_platform_wifi_get_ssid (NMPlatform *self, int ifindex)
|
||||
{
|
||||
_CHECK_SELF (self, klass, NULL);
|
||||
reset_error (self);
|
||||
|
||||
g_return_val_if_fail (ifindex > 0, NULL);
|
||||
|
||||
return klass->wifi_get_ssid (self, ifindex);
|
||||
}
|
||||
|
||||
guint32
|
||||
nm_platform_wifi_get_frequency (NMPlatform *self, int ifindex)
|
||||
{
|
||||
|
@@ -590,7 +590,6 @@ gboolean nm_platform_gre_get_properties (NMPlatform *self, int ifindex,
|
||||
|
||||
gboolean nm_platform_wifi_get_capabilities (NMPlatform *self, int ifindex, NMDeviceWifiCapabilities *caps);
|
||||
gboolean nm_platform_wifi_get_bssid (NMPlatform *self, int ifindex, guint8 *bssid);
|
||||
GByteArray *nm_platform_wifi_get_ssid (NMPlatform *self, int ifindex);
|
||||
guint32 nm_platform_wifi_get_frequency (NMPlatform *self, int ifindex);
|
||||
int nm_platform_wifi_get_quality (NMPlatform *self, int ifindex);
|
||||
guint32 nm_platform_wifi_get_rate (NMPlatform *self, int ifindex);
|
||||
|
@@ -442,24 +442,6 @@ wifi_nl80211_find_freq (WifiData *data, const guint32 *freqs)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GByteArray *
|
||||
wifi_nl80211_get_ssid (WifiData *data)
|
||||
{
|
||||
WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) data;
|
||||
GByteArray *array = NULL;
|
||||
struct nl80211_bss_info bss_info;
|
||||
|
||||
nl80211_get_bss_info (nl80211, &bss_info);
|
||||
|
||||
if (bss_info.valid) {
|
||||
array = g_byte_array_sized_new (bss_info.ssid_len);
|
||||
g_byte_array_append (array, (const guint8 *) bss_info.ssid,
|
||||
bss_info.ssid_len);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wifi_nl80211_get_bssid (WifiData *data, guint8 *out_bssid)
|
||||
{
|
||||
@@ -874,7 +856,6 @@ wifi_nl80211_init (const char *iface, int ifindex)
|
||||
nl80211->parent.set_powersave = wifi_nl80211_set_powersave;
|
||||
nl80211->parent.get_freq = wifi_nl80211_get_freq;
|
||||
nl80211->parent.find_freq = wifi_nl80211_find_freq;
|
||||
nl80211->parent.get_ssid = wifi_nl80211_get_ssid;
|
||||
nl80211->parent.get_bssid = wifi_nl80211_get_bssid;
|
||||
nl80211->parent.get_rate = wifi_nl80211_get_rate;
|
||||
nl80211->parent.get_qual = wifi_nl80211_get_qual;
|
||||
|
@@ -44,9 +44,6 @@ struct WifiData {
|
||||
/* Return first supported frequency in the zero-terminated list */
|
||||
guint32 (*find_freq) (WifiData *data, const guint32 *freqs);
|
||||
|
||||
/* If SSID is empty/blank (zero-length or all \0s) return NULL */
|
||||
GByteArray * (*get_ssid) (WifiData *data);
|
||||
|
||||
/* Return current bitrate in Kbps */
|
||||
guint32 (*get_rate) (WifiData *data);
|
||||
|
||||
|
@@ -223,36 +223,6 @@ wifi_wext_find_freq (WifiData *data, const guint32 *freqs)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GByteArray *
|
||||
wifi_wext_get_ssid (WifiData *data)
|
||||
{
|
||||
WifiDataWext *wext = (WifiDataWext *) data;
|
||||
struct iwreq wrq;
|
||||
char ssid[IW_ESSID_MAX_SIZE + 2];
|
||||
guint32 len;
|
||||
GByteArray *array = NULL;
|
||||
|
||||
memset (ssid, 0, sizeof (ssid));
|
||||
wrq.u.essid.pointer = (caddr_t) &ssid;
|
||||
wrq.u.essid.length = sizeof (ssid);
|
||||
wrq.u.essid.flags = 0;
|
||||
strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ);
|
||||
|
||||
if (ioctl (wext->fd, SIOCGIWESSID, &wrq) < 0) {
|
||||
nm_log_err (LOGD_HW | LOGD_WIFI, "(%s): couldn't get SSID: %d",
|
||||
wext->parent.iface, errno);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
len = wrq.u.essid.length;
|
||||
if (nm_utils_is_empty_ssid ((guint8 *) ssid, len) == FALSE) {
|
||||
array = g_byte_array_sized_new (len);
|
||||
g_byte_array_append (array, (const guint8 *) ssid, len);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wifi_wext_get_bssid (WifiData *data, guint8 *out_bssid)
|
||||
{
|
||||
@@ -601,7 +571,6 @@ wifi_wext_init (const char *iface, int ifindex, gboolean check_scan)
|
||||
wext->parent.set_powersave = wifi_wext_set_powersave;
|
||||
wext->parent.get_freq = wifi_wext_get_freq;
|
||||
wext->parent.find_freq = wifi_wext_find_freq;
|
||||
wext->parent.get_ssid = wifi_wext_get_ssid;
|
||||
wext->parent.get_bssid = wifi_wext_get_bssid;
|
||||
wext->parent.get_rate = wifi_wext_get_rate;
|
||||
wext->parent.get_qual = wifi_wext_get_qual;
|
||||
|
@@ -121,13 +121,6 @@ wifi_utils_find_freq (WifiData *data, const guint32 *freqs)
|
||||
return data->find_freq (data, freqs);
|
||||
}
|
||||
|
||||
GByteArray *
|
||||
wifi_utils_get_ssid (WifiData *data)
|
||||
{
|
||||
g_return_val_if_fail (data != NULL, NULL);
|
||||
return data->get_ssid (data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
wifi_utils_get_bssid (WifiData *data, guint8 *out_bssid)
|
||||
{
|
||||
|
@@ -48,9 +48,6 @@ guint32 wifi_utils_get_freq (WifiData *data);
|
||||
* Frequencies are specified in MHz. */
|
||||
guint32 wifi_utils_find_freq (WifiData *data, const guint32 *freqs);
|
||||
|
||||
/* Caller must free returned byte array */
|
||||
GByteArray *wifi_utils_get_ssid (WifiData *data);
|
||||
|
||||
/* out_bssid must be ETH_ALEN bytes */
|
||||
gboolean wifi_utils_get_bssid (WifiData *data, guint8 *out_bssid);
|
||||
|
||||
|
@@ -645,6 +645,30 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_
|
||||
_nm_dbus_signal_connect (priv->iface_proxy, "NetworkRequest", G_VARIANT_TYPE ("(oss)"),
|
||||
G_CALLBACK (wpas_iface_network_request), self);
|
||||
|
||||
/* Scan result aging parameters */
|
||||
g_dbus_proxy_call (priv->iface_proxy,
|
||||
"org.freedesktop.DBus.Properties.Set",
|
||||
g_variant_new ("(ssv)",
|
||||
WPAS_DBUS_IFACE_INTERFACE,
|
||||
"BSSExpireAge",
|
||||
g_variant_new_uint32 (250)),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
priv->init_cancellable,
|
||||
NULL,
|
||||
NULL);
|
||||
g_dbus_proxy_call (priv->iface_proxy,
|
||||
"org.freedesktop.DBus.Properties.Set",
|
||||
g_variant_new ("(ssv)",
|
||||
WPAS_DBUS_IFACE_INTERFACE,
|
||||
"BSSExpireCount",
|
||||
g_variant_new_uint32 (2)),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
priv->init_cancellable,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
/* Check whether NetworkReply and AP mode are supported */
|
||||
priv->ready_count = 1;
|
||||
g_dbus_proxy_call (priv->iface_proxy,
|
||||
|
Reference in New Issue
Block a user