aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wpa_supplicant/bss.c3
-rw-r--r--wpa_supplicant/dbus/dbus_new_handlers.c9
-rw-r--r--wpa_supplicant/events.c11
-rw-r--r--wpa_supplicant/sme.c2
-rw-r--r--wpa_supplicant/wpa_supplicant.c4
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h1
6 files changed, 22 insertions, 8 deletions
diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c
index a981f89..62086a4 100644
--- a/wpa_supplicant/bss.c
+++ b/wpa_supplicant/bss.c
@@ -271,7 +271,8 @@ static void wpa_bss_timeout(void *eloop_ctx, void *timeout_ctx)
t.sec -= WPA_BSS_EXPIRATION_AGE;
dl_list_for_each_safe(bss, n, &wpa_s->bss, struct wpa_bss, list) {
- if (os_memcmp(bss->bssid, wpa_s->bssid, ETH_ALEN) == 0 ||
+ if (bss == wpa_s->current_bss ||
+ os_memcmp(bss->bssid, wpa_s->bssid, ETH_ALEN) == 0 ||
os_memcmp(bss->bssid, wpa_s->pending_bssid, ETH_ALEN) == 0)
continue; /* do not expire BSSes that are in use */
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index ea2e5cb..315caec 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -2086,20 +2086,15 @@ DBusMessage * wpas_dbus_getter_current_bss(DBusMessage *message,
{
DBusMessage *reply = NULL;
char *bss_obj_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
- struct wpa_bss *bss = NULL;
if (bss_obj_path == NULL)
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
NULL);
- /* TODO: store current BSS or BSS id in wpa_s */
- if (!is_zero_ether_addr(wpa_s->bssid))
- bss = wpa_bss_get_bssid(wpa_s, wpa_s->bssid);
-
- if (bss)
+ if (wpa_s->current_bss)
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
- wpa_s->dbus_new_path, bss->id);
+ wpa_s->dbus_new_path, wpa_s->current_bss->id);
else
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 7a9b557..3c2010c 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1037,6 +1037,17 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
wpa_s, WLAN_REASON_DEAUTH_LEAVING);
return;
}
+ if (wpa_s->current_ssid) {
+ struct wpa_bss *bss = NULL;
+ struct wpa_ssid *ssid = wpa_s->current_ssid;
+ if (ssid->ssid_len > 0)
+ bss = wpa_bss_get(wpa_s, bssid,
+ ssid->ssid, ssid->ssid_len);
+ if (!bss)
+ bss = wpa_bss_get_bssid(wpa_s, bssid);
+ if (bss)
+ wpa_s->current_bss = bss;
+ }
}
#ifdef CONFIG_SME
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 5ed95eb..580ed2a 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -47,6 +47,8 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
return;
}
+ wpa_s->current_bss = bss;
+
os_memset(&params, 0, sizeof(params));
wpa_s->reassociate = 0;
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 8a38b26..fd8a19f 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -998,6 +998,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
return;
}
wpa_supplicant_create_ap(wpa_s, ssid);
+ wpa_s->current_bss = bss;
#else /* CONFIG_AP */
wpa_printf(MSG_ERROR, "AP mode support not included in the "
"build");
@@ -1291,6 +1292,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
}
old_ssid = wpa_s->current_ssid;
wpa_s->current_ssid = ssid;
+ wpa_s->current_bss = bss;
wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
wpa_supplicant_initiate_eapol(wpa_s);
if (old_ssid != wpa_s->current_ssid)
@@ -1323,6 +1325,7 @@ void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
wpa_supplicant_mark_disassoc(wpa_s);
old_ssid = wpa_s->current_ssid;
wpa_s->current_ssid = NULL;
+ wpa_s->current_bss = NULL;
wpa_sm_set_config(wpa_s->wpa, NULL);
eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
if (old_ssid != wpa_s->current_ssid)
@@ -1356,6 +1359,7 @@ void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
wpa_supplicant_mark_disassoc(wpa_s);
old_ssid = wpa_s->current_ssid;
wpa_s->current_ssid = NULL;
+ wpa_s->current_bss = NULL;
wpa_sm_set_config(wpa_s->wpa, NULL);
eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
if (old_ssid != wpa_s->current_ssid)
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 707fac4..f86a172 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -323,6 +323,7 @@ struct wpa_supplicant {
int disconnected; /* all connections disabled; i.e., do no reassociate
* before this has been cleared */
struct wpa_ssid *current_ssid;
+ struct wpa_bss *current_bss;
int ap_ies_from_associnfo;
unsigned int assoc_freq;