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
3 changed files with 26 additions and 10 deletions
|
@ -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)
|
||||
{
|
||||
u8 dst_addr[ETH_ALEN];
|
||||
int used;
|
||||
int used, freq = 0;
|
||||
char *pos;
|
||||
#define MAX_ANQP_INFO_ID 100
|
||||
u16 id[MAX_ANQP_INFO_ID];
|
||||
|
@ -7480,6 +7480,15 @@ static int get_anqp(struct wpa_supplicant *wpa_s, char *dst)
|
|||
pos = dst + used;
|
||||
if (*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) {
|
||||
if (os_strncmp(pos, "hs20:", 5) == 0) {
|
||||
#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)
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
u32 mbo_subtypes)
|
||||
{
|
||||
struct wpabuf *buf;
|
||||
struct wpabuf *extra_buf = NULL;
|
||||
int ret = 0;
|
||||
int freq;
|
||||
struct wpa_bss *bss;
|
||||
int res;
|
||||
|
||||
bss = wpa_bss_get_bssid(wpa_s, dst);
|
||||
if (!bss) {
|
||||
if (!bss && !freq) {
|
||||
wpa_printf(MSG_WARNING,
|
||||
"ANQP: Cannot send query to unknown BSS "
|
||||
MACSTR, MAC2STR(dst));
|
||||
"ANQP: Cannot send query without BSS freq info");
|
||||
return -1;
|
||||
}
|
||||
|
||||
wpa_bss_anqp_unshare_alloc(bss);
|
||||
freq = bss->freq;
|
||||
if (bss)
|
||||
wpa_bss_anqp_unshare_alloc(bss);
|
||||
if (bss && !freq)
|
||||
freq = bss->freq;
|
||||
|
||||
wpa_msg(wpa_s, MSG_DEBUG,
|
||||
"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) {
|
||||
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);
|
||||
if (mbo) {
|
||||
if (wpabuf_resize(&extra_buf, wpabuf_len(mbo))) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
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,
|
||||
u32 mbo_subtypes);
|
||||
void anqp_resp_cb(void *ctx, const u8 *dst, u8 dialog_token,
|
||||
|
|
Loading…
Reference in a new issue