mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
ANQP: Add support to specify frequency in ANQP_GET command
Previously, wpa_supplicant fetched BSS channel info from scan results to send ANQP Query frames. If the scan results for the specified BSS are not available, the ANQP_GET command request was getting rejected. Add support to send ANQP Query frame on the specified frequency without requiring the scan results to be available. The control interface command format: - ANQP_GET <dst_addr> [freq=<freq in MHz>] <Query ID1>[,<Query ID2>,..] Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
This commit is contained in:
parent
43106e122b
commit
170775232d
@ -7466,7 +7466,7 @@ static int ctrl_interworking_connect(struct wpa_supplicant *wpa_s, char *dst,
|
|||||||
static int get_anqp(struct wpa_supplicant *wpa_s, char *dst)
|
static int get_anqp(struct wpa_supplicant *wpa_s, char *dst)
|
||||||
{
|
{
|
||||||
u8 dst_addr[ETH_ALEN];
|
u8 dst_addr[ETH_ALEN];
|
||||||
int used;
|
int used, freq = 0;
|
||||||
char *pos;
|
char *pos;
|
||||||
#define MAX_ANQP_INFO_ID 100
|
#define MAX_ANQP_INFO_ID 100
|
||||||
u16 id[MAX_ANQP_INFO_ID];
|
u16 id[MAX_ANQP_INFO_ID];
|
||||||
@ -7480,6 +7480,15 @@ static int get_anqp(struct wpa_supplicant *wpa_s, char *dst)
|
|||||||
pos = dst + used;
|
pos = dst + used;
|
||||||
if (*pos == ' ')
|
if (*pos == ' ')
|
||||||
pos++;
|
pos++;
|
||||||
|
|
||||||
|
if (os_strncmp(pos, "freq=", 5) == 0) {
|
||||||
|
freq = atoi(pos + 5);
|
||||||
|
pos = os_strchr(pos, ' ');
|
||||||
|
if (!pos)
|
||||||
|
return -1;
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
|
||||||
while (num_id < MAX_ANQP_INFO_ID) {
|
while (num_id < MAX_ANQP_INFO_ID) {
|
||||||
if (os_strncmp(pos, "hs20:", 5) == 0) {
|
if (os_strncmp(pos, "hs20:", 5) == 0) {
|
||||||
#ifdef CONFIG_HS20
|
#ifdef CONFIG_HS20
|
||||||
@ -7514,7 +7523,7 @@ static int get_anqp(struct wpa_supplicant *wpa_s, char *dst)
|
|||||||
if (num_id == 0 && !subtypes && !mbo_subtypes)
|
if (num_id == 0 && !subtypes && !mbo_subtypes)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return anqp_send_req(wpa_s, dst_addr, id, num_id, subtypes,
|
return anqp_send_req(wpa_s, dst_addr, freq, id, num_id, subtypes,
|
||||||
mbo_subtypes);
|
mbo_subtypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2750,27 +2750,27 @@ void interworking_stop_fetch_anqp(struct wpa_supplicant *wpa_s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst,
|
int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst, int freq,
|
||||||
u16 info_ids[], size_t num_ids, u32 subtypes,
|
u16 info_ids[], size_t num_ids, u32 subtypes,
|
||||||
u32 mbo_subtypes)
|
u32 mbo_subtypes)
|
||||||
{
|
{
|
||||||
struct wpabuf *buf;
|
struct wpabuf *buf;
|
||||||
struct wpabuf *extra_buf = NULL;
|
struct wpabuf *extra_buf = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int freq;
|
|
||||||
struct wpa_bss *bss;
|
struct wpa_bss *bss;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
bss = wpa_bss_get_bssid(wpa_s, dst);
|
bss = wpa_bss_get_bssid(wpa_s, dst);
|
||||||
if (!bss) {
|
if (!bss && !freq) {
|
||||||
wpa_printf(MSG_WARNING,
|
wpa_printf(MSG_WARNING,
|
||||||
"ANQP: Cannot send query to unknown BSS "
|
"ANQP: Cannot send query without BSS freq info");
|
||||||
MACSTR, MAC2STR(dst));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
wpa_bss_anqp_unshare_alloc(bss);
|
if (bss)
|
||||||
freq = bss->freq;
|
wpa_bss_anqp_unshare_alloc(bss);
|
||||||
|
if (bss && !freq)
|
||||||
|
freq = bss->freq;
|
||||||
|
|
||||||
wpa_msg(wpa_s, MSG_DEBUG,
|
wpa_msg(wpa_s, MSG_DEBUG,
|
||||||
"ANQP: Query Request to " MACSTR " for %u id(s)",
|
"ANQP: Query Request to " MACSTR " for %u id(s)",
|
||||||
@ -2789,6 +2789,13 @@ int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst,
|
|||||||
if (mbo_subtypes) {
|
if (mbo_subtypes) {
|
||||||
struct wpabuf *mbo;
|
struct wpabuf *mbo;
|
||||||
|
|
||||||
|
if (!bss) {
|
||||||
|
wpa_printf(MSG_WARNING,
|
||||||
|
"ANQP: Cannot send MBO query to unknown BSS "
|
||||||
|
MACSTR, MAC2STR(dst));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
mbo = mbo_build_anqp_buf(wpa_s, bss, mbo_subtypes);
|
mbo = mbo_build_anqp_buf(wpa_s, bss, mbo_subtypes);
|
||||||
if (mbo) {
|
if (mbo) {
|
||||||
if (wpabuf_resize(&extra_buf, wpabuf_len(mbo))) {
|
if (wpabuf_resize(&extra_buf, wpabuf_len(mbo))) {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
enum gas_query_result;
|
enum gas_query_result;
|
||||||
|
|
||||||
int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst,
|
int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst, int freq,
|
||||||
u16 info_ids[], size_t num_ids, u32 subtypes,
|
u16 info_ids[], size_t num_ids, u32 subtypes,
|
||||||
u32 mbo_subtypes);
|
u32 mbo_subtypes);
|
||||||
void anqp_resp_cb(void *ctx, const u8 *dst, u8 dialog_token,
|
void anqp_resp_cb(void *ctx, const u8 *dst, u8 dialog_token,
|
||||||
|
Loading…
Reference in New Issue
Block a user