]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Use wildcard BSSID in GAS query frames
authorJouni Malinen <jouni@codeaurora.org>
Sat, 10 Feb 2018 10:42:00 +0000 (12:42 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 10 Feb 2018 10:42:00 +0000 (12:42 +0200)
Force use of the wildcard BSSID address in GAS query frames with DPP
regardless of how the gas_address3 configuration parameter is set. DPP
specification mandates this and the use of GAS here is really outside
the context of a BSS, so using the wildcard BSSID makes sense even for
the corner case of Configurator running on a known AP (where IEEE 802.11
standard would allow the BSSID of the AP to be used).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/dpp_supplicant.c
wpa_supplicant/gas_query.c
wpa_supplicant/gas_query.h
wpa_supplicant/hs20_supplicant.c
wpa_supplicant/interworking.c

index 3eb18727b2baeda42ce37e00e9ca8a1a146ab7d9..9755ecee147b102b1a86e2da43fb6d845f98d2e4 100644 (file)
@@ -1418,7 +1418,7 @@ static void wpas_dpp_start_gas_client(struct wpa_supplicant *wpa_s)
                   MAC2STR(auth->peer_mac_addr), auth->curr_freq);
 
        res = gas_query_req(wpa_s->gas, auth->peer_mac_addr, auth->curr_freq,
-                           buf, wpas_dpp_gas_resp_cb, wpa_s);
+                           1, buf, wpas_dpp_gas_resp_cb, wpa_s);
        if (res < 0) {
                wpa_msg(wpa_s, MSG_DEBUG, "GAS: Failed to send Query Request");
                wpabuf_free(buf);
index 3567fa27d1f25feaa0a7440179fe0d6bb4ffc020..f4f60c58bee53a64202bd83428fbe7bdf8881aa8 100644 (file)
@@ -42,6 +42,7 @@ struct gas_query_pending {
        unsigned int wait_comeback:1;
        unsigned int offchannel_tx_started:1;
        unsigned int retry:1;
+       unsigned int wildcard_bssid:1;
        int freq;
        u16 status_code;
        struct wpabuf *req;
@@ -302,10 +303,11 @@ static int gas_query_tx(struct gas_query *gas, struct gas_query_pending *query,
        if (gas->wpa_s->max_remain_on_chan &&
            wait_time > gas->wpa_s->max_remain_on_chan)
                wait_time = gas->wpa_s->max_remain_on_chan;
-       if (!gas->wpa_s->conf->gas_address3 ||
-           (gas->wpa_s->current_ssid &&
-            gas->wpa_s->wpa_state >= WPA_ASSOCIATED &&
-            os_memcmp(query->addr, gas->wpa_s->bssid, ETH_ALEN) == 0))
+       if (!query->wildcard_bssid &&
+           (!gas->wpa_s->conf->gas_address3 ||
+            (gas->wpa_s->current_ssid &&
+             gas->wpa_s->wpa_state >= WPA_ASSOCIATED &&
+             os_memcmp(query->addr, gas->wpa_s->bssid, ETH_ALEN) == 0)))
                bssid = query->addr;
        else
                bssid = wildcard_bssid;
@@ -805,7 +807,7 @@ static int gas_query_set_sa(struct gas_query *gas,
  * Returns: dialog token (>= 0) on success or -1 on failure
  */
 int gas_query_req(struct gas_query *gas, const u8 *dst, int freq,
-                 struct wpabuf *req,
+                 int wildcard_bssid, struct wpabuf *req,
                  void (*cb)(void *ctx, const u8 *dst, u8 dialog_token,
                             enum gas_query_result result,
                             const struct wpabuf *adv_proto,
@@ -833,6 +835,7 @@ int gas_query_req(struct gas_query *gas, const u8 *dst, int freq,
        }
        os_memcpy(query->addr, dst, ETH_ALEN);
        query->dialog_token = dialog_token;
+       query->wildcard_bssid = !!wildcard_bssid;
        query->freq = freq;
        query->cb = cb;
        query->ctx = ctx;
index 05a3ae608abddf34defc9ca2515130da94ec87a9..982c0f7ce60e334d0674c5ab1289fc7f2853fc0e 100644 (file)
@@ -34,7 +34,7 @@ enum gas_query_result {
 };
 
 int gas_query_req(struct gas_query *gas, const u8 *dst, int freq,
-                 struct wpabuf *req,
+                 int wildcard_bssid, struct wpabuf *req,
                  void (*cb)(void *ctx, const u8 *dst, u8 dialog_token,
                             enum gas_query_result result,
                             const struct wpabuf *adv_proto,
index cbcbc95cee44b3aee0e8003dd08695d91f96c425..393b93887e27b96661113e494e362432e46c36e1 100644 (file)
@@ -248,7 +248,7 @@ int hs20_anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst, u32 stypes,
        if (buf == NULL)
                return -1;
 
-       res = gas_query_req(wpa_s->gas, dst, freq, buf, anqp_resp_cb, wpa_s);
+       res = gas_query_req(wpa_s->gas, dst, freq, 0, buf, anqp_resp_cb, wpa_s);
        if (res < 0) {
                wpa_printf(MSG_DEBUG, "ANQP: Failed to send Query Request");
                wpabuf_free(buf);
index dd5a7249c906d9428b879f4839fd236dc476ee76..5f7d6d4c2de6edaadb0e8ccc9a6bd1bfe2d75814 100644 (file)
@@ -312,7 +312,7 @@ static int interworking_anqp_send_req(struct wpa_supplicant *wpa_s,
        if (buf == NULL)
                return -1;
 
-       res = gas_query_req(wpa_s->gas, bss->bssid, bss->freq, buf,
+       res = gas_query_req(wpa_s->gas, bss->bssid, bss->freq, 0, buf,
                            interworking_anqp_resp_cb, wpa_s);
        if (res < 0) {
                wpa_msg(wpa_s, MSG_DEBUG, "ANQP: Failed to send Query Request");
@@ -2752,7 +2752,7 @@ int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst,
        if (buf == NULL)
                return -1;
 
-       res = gas_query_req(wpa_s->gas, dst, freq, buf, anqp_resp_cb, wpa_s);
+       res = gas_query_req(wpa_s->gas, dst, freq, 0, buf, anqp_resp_cb, wpa_s);
        if (res < 0) {
                wpa_msg(wpa_s, MSG_DEBUG, "ANQP: Failed to send Query Request");
                wpabuf_free(buf);
@@ -3154,7 +3154,7 @@ int gas_send_request(struct wpa_supplicant *wpa_s, const u8 *dst,
        } else
                wpabuf_put_le16(buf, 0);
 
-       res = gas_query_req(wpa_s->gas, dst, freq, buf, gas_resp_cb, wpa_s);
+       res = gas_query_req(wpa_s->gas, dst, freq, 0, buf, gas_resp_cb, wpa_s);
        if (res < 0) {
                wpa_msg(wpa_s, MSG_DEBUG, "GAS: Failed to send Query Request");
                wpabuf_free(buf);