Allow wildcard SSID to be used with WPA-PSK if bssid is set
This allows the AP to be selected based on the BSSID when WPA-PSK is used with a passphrase. The PSK will be derived from the passphrase after the SSID has been learned from scan results.
This commit is contained in:
parent
a52eba0f44
commit
7d232e23e2
2 changed files with 24 additions and 1 deletions
|
@ -562,6 +562,10 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
}
|
||||
#endif /* CONFIG_WPS */
|
||||
|
||||
if (ssid->bssid_set && ssid->ssid_len == 0 &&
|
||||
os_memcmp(bss->bssid, ssid->bssid, ETH_ALEN) == 0)
|
||||
check_ssid = 0;
|
||||
|
||||
if (check_ssid &&
|
||||
(ssid_len != ssid->ssid_len ||
|
||||
os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "crypto/random.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "eapol_supp/eapol_supp_sm.h"
|
||||
#include "eap_peer/eap.h"
|
||||
#include "eap_server/eap_methods.h"
|
||||
|
@ -1059,8 +1060,20 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
|
|||
|
||||
if (ssid->key_mgmt &
|
||||
(WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_FT_PSK | WPA_KEY_MGMT_PSK_SHA256))
|
||||
{
|
||||
wpa_sm_set_pmk(wpa_s->wpa, ssid->psk, PMK_LEN);
|
||||
else
|
||||
#ifndef CONFIG_NO_PBKDF2
|
||||
if (bss && ssid->bssid_set && ssid->ssid_len == 0 &&
|
||||
ssid->passphrase) {
|
||||
u8 psk[PMK_LEN];
|
||||
pbkdf2_sha1(ssid->passphrase, (char *) bss->ssid,
|
||||
bss->ssid_len, 4096, psk, PMK_LEN);
|
||||
wpa_hexdump_key(MSG_MSGDUMP, "PSK (from passphrase)",
|
||||
psk, PMK_LEN);
|
||||
wpa_sm_set_pmk(wpa_s->wpa, psk, PMK_LEN);
|
||||
}
|
||||
#endif /* CONFIG_NO_PBKDF2 */
|
||||
} else
|
||||
wpa_sm_set_pmk_from_pmksa(wpa_s->wpa);
|
||||
|
||||
return 0;
|
||||
|
@ -1827,6 +1840,12 @@ struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s)
|
|||
os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0))
|
||||
return entry;
|
||||
#endif /* CONFIG_WPS */
|
||||
|
||||
if (!entry->disabled && entry->bssid_set &&
|
||||
entry->ssid_len == 0 &&
|
||||
os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0)
|
||||
return entry;
|
||||
|
||||
entry = entry->next;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue