mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 03:32:42 +01:00
core: Find WPA BSS from scan results
Parse vendor specific IE and BSS scan results, find it AP has WPA security details.
This commit is contained in:
parent
29a89d2a8b
commit
02b501b4f0
20
src/wiphy.c
20
src/wiphy.c
@ -65,6 +65,7 @@ struct bss {
|
|||||||
int32_t signal_strength;
|
int32_t signal_strength;
|
||||||
uint16_t capability;
|
uint16_t capability;
|
||||||
uint8_t *rsne;
|
uint8_t *rsne;
|
||||||
|
uint8_t *wpa;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct netdev {
|
struct netdev {
|
||||||
@ -394,6 +395,7 @@ static void bss_free(void *data)
|
|||||||
bss->addr[0], bss->addr[1], bss->addr[2],
|
bss->addr[0], bss->addr[1], bss->addr[2],
|
||||||
bss->addr[3], bss->addr[4], bss->addr[5]);
|
bss->addr[3], bss->addr[4], bss->addr[5]);
|
||||||
l_free(bss->rsne);
|
l_free(bss->rsne);
|
||||||
|
l_free(bss->wpa);
|
||||||
l_free(bss);
|
l_free(bss);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -939,6 +941,12 @@ static bool parse_ie(struct bss *bss, const uint8_t **ssid, int *ssid_len,
|
|||||||
bss->rsne = l_memdup(iter.data - 2,
|
bss->rsne = l_memdup(iter.data - 2,
|
||||||
iter.len + 2);
|
iter.len + 2);
|
||||||
break;
|
break;
|
||||||
|
case IE_TYPE_VENDOR_SPECIFIC:
|
||||||
|
/* Interested only in WPA IE from Vendor data */
|
||||||
|
if (!bss->wpa && is_ie_wpa_ie(iter.data, iter.len))
|
||||||
|
bss->wpa = l_memdup(iter.data - 2,
|
||||||
|
iter.len + 2);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1040,6 +1048,18 @@ static void parse_bss(struct netdev *netdev, struct l_genl_attr *attr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssid_security = scan_get_ssid_security(bss->capability, &rsne);
|
ssid_security = scan_get_ssid_security(bss->capability, &rsne);
|
||||||
|
} else if (bss->wpa) {
|
||||||
|
struct ie_rsn_info wpa;
|
||||||
|
int res = ie_parse_wpa_from_data(bss->wpa, bss->wpa[1] + 2,
|
||||||
|
&wpa);
|
||||||
|
if (res < 0) {
|
||||||
|
l_debug("Cannot parse WPA IE %s (%d, %s)",
|
||||||
|
util_ssid_to_utf8(ssid_len, ssid),
|
||||||
|
res, strerror(-res));
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssid_security = scan_get_ssid_security(bss->capability, &wpa);
|
||||||
} else
|
} else
|
||||||
ssid_security = scan_get_ssid_security(bss->capability, NULL);
|
ssid_security = scan_get_ssid_security(bss->capability, NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user