Debug print scan results matching the currently selected network
This provides more details on BSS selection process in the debug log. Previously, the BSSs that were not either the current or the selected one were not necessarily printed at all. Now all BSSs that match the currently selected network are listed with their frequency and signal strength details. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
8d1e693186
commit
e65a87b399
3 changed files with 206 additions and 112 deletions
|
@ -503,7 +503,7 @@ static int wpa_supplicant_match_privacy(struct wpa_bss *bss,
|
|||
|
||||
static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
struct wpa_bss *bss)
|
||||
struct wpa_bss *bss, int debug_print)
|
||||
{
|
||||
struct wpa_ie_data ie;
|
||||
int proto_match = 0;
|
||||
|
@ -526,40 +526,46 @@ static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
|
|||
proto_match++;
|
||||
|
||||
if (wpa_parse_wpa_ie(rsn_ie, 2 + rsn_ie[1], &ie)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - parse "
|
||||
"failed");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip RSN IE - parse failed");
|
||||
break;
|
||||
}
|
||||
|
||||
if (wep_ok &&
|
||||
(ie.group_cipher & (WPA_CIPHER_WEP40 | WPA_CIPHER_WEP104)))
|
||||
{
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " selected based on TSN "
|
||||
"in RSN IE");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" selected based on TSN in RSN IE");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!(ie.proto & ssid->proto)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - proto "
|
||||
"mismatch");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip RSN IE - proto mismatch");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - PTK "
|
||||
"cipher mismatch");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip RSN IE - PTK cipher mismatch");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(ie.group_cipher & ssid->group_cipher)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - GTK "
|
||||
"cipher mismatch");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip RSN IE - GTK cipher mismatch");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(ie.key_mgmt & ssid->key_mgmt)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - key mgmt "
|
||||
"mismatch");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip RSN IE - key mgmt mismatch");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -567,14 +573,16 @@ static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
|
|||
if (!(ie.capabilities & WPA_CAPABILITY_MFPC) &&
|
||||
wpas_get_ssid_pmf(wpa_s, ssid) ==
|
||||
MGMT_FRAME_PROTECTION_REQUIRED) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - no mgmt "
|
||||
"frame protection");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip RSN IE - no mgmt frame protection");
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211W */
|
||||
if ((ie.capabilities & WPA_CAPABILITY_MFPR) &&
|
||||
wpas_get_ssid_pmf(wpa_s, ssid) ==
|
||||
NO_MGMT_FRAME_PROTECTION) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip RSN IE - no mgmt frame protection enabled but AP requires it");
|
||||
break;
|
||||
|
@ -584,18 +592,22 @@ static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
|
|||
wpas_mbo_get_bss_attr(bss, MBO_ATTR_ID_AP_CAPA_IND) &&
|
||||
wpas_get_ssid_pmf(wpa_s, ssid) !=
|
||||
NO_MGMT_FRAME_PROTECTION) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip RSN IE - no mgmt frame protection enabled on MBO AP");
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_MBO */
|
||||
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " selected based on RSN IE");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" selected based on RSN IE");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IEEE80211W
|
||||
if (wpas_get_ssid_pmf(wpa_s, ssid) == MGMT_FRAME_PROTECTION_REQUIRED) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - MFP Required but network not MFP Capable");
|
||||
return 0;
|
||||
|
@ -607,72 +619,87 @@ static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
|
|||
proto_match++;
|
||||
|
||||
if (wpa_parse_wpa_ie(wpa_ie, 2 + wpa_ie[1], &ie)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - parse "
|
||||
"failed");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip WPA IE - parse failed");
|
||||
break;
|
||||
}
|
||||
|
||||
if (wep_ok &&
|
||||
(ie.group_cipher & (WPA_CIPHER_WEP40 | WPA_CIPHER_WEP104)))
|
||||
{
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " selected based on TSN "
|
||||
"in WPA IE");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" selected based on TSN in WPA IE");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!(ie.proto & ssid->proto)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - proto "
|
||||
"mismatch");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip WPA IE - proto mismatch");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - PTK "
|
||||
"cipher mismatch");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip WPA IE - PTK cipher mismatch");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(ie.group_cipher & ssid->group_cipher)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - GTK "
|
||||
"cipher mismatch");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip WPA IE - GTK cipher mismatch");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(ie.key_mgmt & ssid->key_mgmt)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - key mgmt "
|
||||
"mismatch");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip WPA IE - key mgmt mismatch");
|
||||
break;
|
||||
}
|
||||
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " selected based on WPA IE");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" selected based on WPA IE");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) && !wpa_ie &&
|
||||
!rsn_ie) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " allow for non-WPA IEEE 802.1X");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" allow for non-WPA IEEE 802.1X");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((ssid->proto & (WPA_PROTO_WPA | WPA_PROTO_RSN)) &&
|
||||
wpa_key_mgmt_wpa(ssid->key_mgmt) && proto_match == 0) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - no WPA/RSN proto match");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - no WPA/RSN proto match");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((ssid->key_mgmt & WPA_KEY_MGMT_OSEN) &&
|
||||
wpa_bss_get_vendor_ie(bss, OSEN_IE_VENDOR_TYPE)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " allow in OSEN");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!wpa_key_mgmt_wpa(ssid->key_mgmt)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " allow in non-WPA/WPA2");
|
||||
return 1;
|
||||
}
|
||||
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " reject due to mismatch with "
|
||||
"WPA/WPA2");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" reject due to mismatch with WPA/WPA2");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -692,7 +719,8 @@ static int freq_allowed(int *freqs, int freq)
|
|||
}
|
||||
|
||||
|
||||
static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
|
||||
static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
|
||||
int debug_print)
|
||||
{
|
||||
const struct hostapd_hw_modes *mode = NULL, *modes;
|
||||
const u8 scan_ie[2] = { WLAN_EID_SUPP_RATES, WLAN_EID_EXT_SUPP_RATES };
|
||||
|
@ -749,9 +777,9 @@ static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
|
|||
if (flagged && ((rate_ie[j] & 0x7f) ==
|
||||
BSS_MEMBERSHIP_SELECTOR_HT_PHY)) {
|
||||
if (!ht_supported(mode)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" hardware does not support "
|
||||
"HT PHY");
|
||||
" hardware does not support HT PHY");
|
||||
return 0;
|
||||
}
|
||||
continue;
|
||||
|
@ -761,9 +789,9 @@ static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
|
|||
if (flagged && ((rate_ie[j] & 0x7f) ==
|
||||
BSS_MEMBERSHIP_SELECTOR_VHT_PHY)) {
|
||||
if (!vht_supported(mode)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" hardware does not support "
|
||||
"VHT PHY");
|
||||
" hardware does not support VHT PHY");
|
||||
return 0;
|
||||
}
|
||||
continue;
|
||||
|
@ -783,6 +811,7 @@ static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
|
|||
* order to join a BSS all required rates
|
||||
* have to be supported by the hardware.
|
||||
*/
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" hardware does not support required rate %d.%d Mbps (freq=%d mode==%d num_rates=%d)",
|
||||
r / 10, r % 10,
|
||||
|
@ -842,7 +871,7 @@ static int addr_in_list(const u8 *addr, const u8 *list, size_t num)
|
|||
struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
||||
int i, struct wpa_bss *bss,
|
||||
struct wpa_ssid *group,
|
||||
int only_first_ssid)
|
||||
int only_first_ssid, int debug_print)
|
||||
{
|
||||
u8 wpa_ie_len, rsn_ie_len;
|
||||
int wpa;
|
||||
|
@ -863,15 +892,20 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
ie = wpa_bss_get_vendor_ie(bss, OSEN_IE_VENDOR_TYPE);
|
||||
osen = ie != NULL;
|
||||
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "%d: " MACSTR " ssid='%s' "
|
||||
"wpa_ie_len=%u rsn_ie_len=%u caps=0x%x level=%d freq=%d %s%s%s",
|
||||
i, MAC2STR(bss->bssid), wpa_ssid_txt(bss->ssid, bss->ssid_len),
|
||||
wpa_ie_len, rsn_ie_len, bss->caps, bss->level, bss->freq,
|
||||
wpa_bss_get_vendor_ie(bss, WPS_IE_VENDOR_TYPE) ? " wps" : "",
|
||||
if (debug_print) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "%d: " MACSTR
|
||||
" ssid='%s' wpa_ie_len=%u rsn_ie_len=%u caps=0x%x level=%d freq=%d %s%s%s",
|
||||
i, MAC2STR(bss->bssid),
|
||||
wpa_ssid_txt(bss->ssid, bss->ssid_len),
|
||||
wpa_ie_len, rsn_ie_len, bss->caps, bss->level,
|
||||
bss->freq,
|
||||
wpa_bss_get_vendor_ie(bss, WPS_IE_VENDOR_TYPE) ?
|
||||
" wps" : "",
|
||||
(wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE) ||
|
||||
wpa_bss_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE)) ?
|
||||
" p2p" : "",
|
||||
wpa_bss_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE))
|
||||
? " p2p" : "",
|
||||
osen ? " osen=1" : "");
|
||||
}
|
||||
|
||||
e = wpa_blacklist_get(wpa_s, bss->bssid);
|
||||
if (e) {
|
||||
|
@ -888,23 +922,29 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
limit = 0;
|
||||
}
|
||||
if (e->count > limit) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - blacklisted "
|
||||
"(count=%d limit=%d)", e->count, limit);
|
||||
if (debug_print) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - blacklisted (count=%d limit=%d)",
|
||||
e->count, limit);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (bss->ssid_len == 0) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID not known");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (disallowed_bssid(wpa_s, bss->bssid)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - BSSID disallowed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (disallowed_ssid(wpa_s, bss->ssid, bss->ssid_len)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID disallowed");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -916,21 +956,25 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
int res;
|
||||
|
||||
if (wpas_network_disabled(wpa_s, ssid)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - disabled");
|
||||
continue;
|
||||
}
|
||||
|
||||
res = wpas_temp_disabled(wpa_s, ssid);
|
||||
if (res > 0) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - disabled "
|
||||
"temporarily for %d second(s)", res);
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - disabled temporarily for %d second(s)",
|
||||
res);
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_WPS
|
||||
if ((ssid->key_mgmt & WPA_KEY_MGMT_WPS) && e && e->count > 0) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - blacklisted "
|
||||
"(WPS)");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - blacklisted (WPS)");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -956,13 +1000,17 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
if (check_ssid &&
|
||||
(bss->ssid_len != ssid->ssid_len ||
|
||||
os_memcmp(bss->ssid, ssid->ssid, bss->ssid_len) != 0)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID mismatch");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - SSID mismatch");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ssid->bssid_set &&
|
||||
os_memcmp(bss->bssid, ssid->bssid, ETH_ALEN) != 0) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - BSSID mismatch");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - BSSID mismatch");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -970,6 +1018,7 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
if (ssid->num_bssid_blacklist &&
|
||||
addr_in_list(bss->bssid, ssid->bssid_blacklist,
|
||||
ssid->num_bssid_blacklist)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - BSSID blacklisted");
|
||||
continue;
|
||||
|
@ -979,71 +1028,85 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
if (ssid->num_bssid_whitelist &&
|
||||
!addr_in_list(bss->bssid, ssid->bssid_whitelist,
|
||||
ssid->num_bssid_whitelist)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - BSSID not in whitelist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!wpa_supplicant_ssid_bss_match(wpa_s, ssid, bss))
|
||||
if (!wpa_supplicant_ssid_bss_match(wpa_s, ssid, bss,
|
||||
debug_print))
|
||||
continue;
|
||||
|
||||
if (!osen && !wpa &&
|
||||
!(ssid->key_mgmt & WPA_KEY_MGMT_NONE) &&
|
||||
!(ssid->key_mgmt & WPA_KEY_MGMT_WPS) &&
|
||||
!(ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - non-WPA network "
|
||||
"not allowed");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - non-WPA network not allowed");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wpa && !wpa_key_mgmt_wpa(ssid->key_mgmt) &&
|
||||
has_wep_key(ssid)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - ignore WPA/WPA2 AP for WEP network block");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - ignore WPA/WPA2 AP for WEP network block");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((ssid->key_mgmt & WPA_KEY_MGMT_OSEN) && !osen) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - non-OSEN network "
|
||||
"not allowed");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - non-OSEN network not allowed");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!wpa_supplicant_match_privacy(bss, ssid)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - privacy "
|
||||
"mismatch");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - privacy mismatch");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ssid->mode != IEEE80211_MODE_MESH && !bss_is_ess(bss) &&
|
||||
!bss_is_pbss(bss)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - not ESS, PBSS, or MBSS");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ssid->pbss != 2 && ssid->pbss != bss_is_pbss(bss)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - PBSS mismatch (ssid %d bss %d)",
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - PBSS mismatch (ssid %d bss %d)",
|
||||
ssid->pbss, bss_is_pbss(bss));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!freq_allowed(ssid->freq_list, bss->freq)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - frequency not "
|
||||
"allowed");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - frequency not allowed");
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MESH
|
||||
if (ssid->mode == IEEE80211_MODE_MESH && ssid->frequency > 0 &&
|
||||
ssid->frequency != bss->freq) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - frequency not allowed (mesh)");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - frequency not allowed (mesh)");
|
||||
continue;
|
||||
}
|
||||
#endif /* CONFIG_MESH */
|
||||
|
||||
if (!rate_match(wpa_s, bss)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - rate sets do "
|
||||
"not match");
|
||||
if (!rate_match(wpa_s, bss, debug_print)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - rate sets do not match");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1051,6 +1114,7 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
if (ssid->mode == WPAS_MODE_IBSS &&
|
||||
!(ssid->key_mgmt & (WPA_KEY_MGMT_NONE |
|
||||
WPA_KEY_MGMT_WPA_NONE))) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - IBSS RSN not supported in the build");
|
||||
continue;
|
||||
|
@ -1061,7 +1125,9 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
if (ssid->p2p_group &&
|
||||
!wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE) &&
|
||||
!wpa_bss_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - no P2P IE seen");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - no P2P IE seen");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1071,20 +1137,26 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
|
||||
ie = wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE);
|
||||
if (ie == NULL) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - no P2P element");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - no P2P element");
|
||||
continue;
|
||||
}
|
||||
p2p_ie = wpa_bss_get_vendor_ie_multi(
|
||||
bss, P2P_IE_VENDOR_TYPE);
|
||||
if (p2p_ie == NULL) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - could not fetch P2P element");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - could not fetch P2P element");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p2p_parse_dev_addr_in_p2p_ie(p2p_ie, dev_addr) < 0
|
||||
|| os_memcmp(dev_addr, ssid->go_p2p_dev_addr,
|
||||
ETH_ALEN) != 0) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " skip - no matching GO P2P Device Address in P2P element");
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - no matching GO P2P Device Address in P2P element");
|
||||
wpabuf_free(p2p_ie);
|
||||
continue;
|
||||
}
|
||||
|
@ -1104,6 +1176,7 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
|
||||
os_reltime_sub(&wpa_s->scan_min_time,
|
||||
&bss->last_update, &diff);
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - scan result not recent enough (%u.%06u seconds too old)",
|
||||
(unsigned int) diff.sec,
|
||||
|
@ -1118,6 +1191,7 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
assoc_disallow = wpas_mbo_get_bss_attr(
|
||||
bss, MBO_ATTR_ID_ASSOC_DISALLOW);
|
||||
if (assoc_disallow && assoc_disallow[1] >= 1) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - MBO association disallowed (reason %u)",
|
||||
assoc_disallow[2]);
|
||||
|
@ -1125,6 +1199,7 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||
}
|
||||
|
||||
if (wpa_is_bss_tmp_disallowed(wpa_s, bss->bssid)) {
|
||||
if (debug_print)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
" skip - MBO retry delay has not passed yet");
|
||||
continue;
|
||||
|
@ -1151,6 +1226,25 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s,
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
if (wpa_s->current_ssid) {
|
||||
struct wpa_ssid *ssid;
|
||||
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
"Scan results matching the currently selected network");
|
||||
for (i = 0; i < wpa_s->last_scan_res_used; i++) {
|
||||
struct wpa_bss *bss = wpa_s->last_scan_res[i];
|
||||
|
||||
ssid = wpa_scan_res_match(wpa_s, i, bss, group,
|
||||
only_first_ssid, 0);
|
||||
if (ssid != wpa_s->current_ssid)
|
||||
continue;
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "%u: " MACSTR
|
||||
" freq=%d level=%d snr=%d est_throughput=%u",
|
||||
i, MAC2STR(bss->bssid), bss->freq, bss->level,
|
||||
bss->snr, bss->est_throughput);
|
||||
}
|
||||
}
|
||||
|
||||
if (only_first_ssid)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "Try to find BSS matching pre-selected network id=%d",
|
||||
group->id);
|
||||
|
@ -1161,7 +1255,7 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s,
|
|||
for (i = 0; i < wpa_s->last_scan_res_used; i++) {
|
||||
struct wpa_bss *bss = wpa_s->last_scan_res[i];
|
||||
*selected_ssid = wpa_scan_res_match(wpa_s, i, bss, group,
|
||||
only_first_ssid);
|
||||
only_first_ssid, 1);
|
||||
if (!*selected_ssid)
|
||||
continue;
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, " selected BSS " MACSTR
|
||||
|
|
|
@ -562,7 +562,7 @@ compare_scan_neighbor_results(struct wpa_supplicant *wpa_s, os_time_t age_secs)
|
|||
|
||||
if (wpa_s->current_ssid &&
|
||||
!wpa_scan_res_match(wpa_s, 0, target, wpa_s->current_ssid,
|
||||
1)) {
|
||||
1, 0)) {
|
||||
wpa_printf(MSG_DEBUG, "Candidate BSS " MACSTR
|
||||
" (pref %d) does not match the current network profile",
|
||||
MAC2STR(nei->bssid),
|
||||
|
@ -756,7 +756,7 @@ static int wnm_add_cand_list(struct wpa_supplicant *wpa_s, u8 *buf, size_t len)
|
|||
struct wpa_bss *bss = wpa_s->last_scan_res[i];
|
||||
int res;
|
||||
|
||||
if (wpa_scan_res_match(wpa_s, i, bss, ssid, 1)) {
|
||||
if (wpa_scan_res_match(wpa_s, i, bss, ssid, 1, 0)) {
|
||||
res = wnm_nei_rep_add_bss(wpa_s, bss, pos, len, pref--);
|
||||
if (res == -2)
|
||||
continue; /* could not build entry for BSS */
|
||||
|
|
|
@ -1296,6 +1296,6 @@ int wpa_is_bss_tmp_disallowed(struct wpa_supplicant *wpa_s, const u8 *bssid);
|
|||
struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
||||
int i, struct wpa_bss *bss,
|
||||
struct wpa_ssid *group,
|
||||
int only_first_ssid);
|
||||
int only_first_ssid, int debug_print);
|
||||
|
||||
#endif /* WPA_SUPPLICANT_I_H */
|
||||
|
|
Loading…
Reference in a new issue