scan: Print SSID in scan results dump

Add printing of SSID into the "Sorted scan reslts" dump for easy reading
and debugging.

Signed-off-by: xinpeng wang <wangxinpeng@uniontech.com>
This commit is contained in:
xinpeng wang 2022-04-20 17:23:32 +08:00 committed by Jouni Malinen
parent 5a04715793
commit 28c9f29a31

View file

@ -2181,20 +2181,33 @@ static void dump_scan_res(struct wpa_scan_results *scan_res)
for (i = 0; i < scan_res->num; i++) {
struct wpa_scan_res *r = scan_res->res[i];
u8 *pos;
const u8 *ssid_ie, *ssid = NULL;
size_t ssid_len = 0;
ssid_ie = wpa_scan_get_ie(r, WLAN_EID_SSID);
if (ssid_ie) {
ssid = ssid_ie + 2;
ssid_len = ssid_ie[1];
}
if (r->flags & WPA_SCAN_LEVEL_DBM) {
int noise_valid = !(r->flags & WPA_SCAN_NOISE_INVALID);
wpa_printf(MSG_EXCESSIVE, MACSTR " freq=%d qual=%d "
"noise=%d%s level=%d snr=%d%s flags=0x%x age=%u est=%u",
MAC2STR(r->bssid), r->freq, r->qual,
wpa_printf(MSG_EXCESSIVE, MACSTR
" ssid=%s freq=%d qual=%d noise=%d%s level=%d snr=%d%s flags=0x%x age=%u est=%u",
MAC2STR(r->bssid),
wpa_ssid_txt(ssid, ssid_len),
r->freq, r->qual,
r->noise, noise_valid ? "" : "~", r->level,
r->snr, r->snr >= GREAT_SNR ? "*" : "",
r->flags,
r->age, r->est_throughput);
} else {
wpa_printf(MSG_EXCESSIVE, MACSTR " freq=%d qual=%d "
"noise=%d level=%d flags=0x%x age=%u est=%u",
MAC2STR(r->bssid), r->freq, r->qual,
wpa_printf(MSG_EXCESSIVE, MACSTR
" ssid=%s freq=%d qual=%d noise=%d level=%d flags=0x%x age=%u est=%u",
MAC2STR(r->bssid),
wpa_ssid_txt(ssid, ssid_len),
r->freq, r->qual,
r->noise, r->level, r->flags, r->age,
r->est_throughput);
}