wpa_supplicant: Make GAS Address3 field selection behavior configurable
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 10 Jun 2016 17:58:23 +0000 (20:58 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 10 Jun 2016 18:44:49 +0000 (21:44 +0300)
IEEE Std 802.11-2012, 10.19 (Public Action frame addressing) specifies
that the wildcard BSSID value is used in Public Action frames that are
transmitted to a STA that is not a member of the same BSS.
wpa_supplicant used to use the actual BSSID value for all such frames
regardless of whether the destination STA is a member of the BSS.

P2P does not follow this rule, so P2P Public Action frame construction
must not be changed. However, the cases using GAS/ANQP for non-P2P
purposes should follow the standard requirements.

Unfortunately, there are deployed AP implementations that do not reply
to a GAS request sent using the wildcard BSSID value. The previously
used behavior (Address3 = AP BSSID even when not associated) continues
to be the default, but the IEEE 802.11 standard compliant addressing
behavior can now be configured with gas_address3=1.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/gas_query.c
wpa_supplicant/wpa_supplicant.conf

index 674faab..0571c23 100644 (file)
@@ -4368,6 +4368,7 @@ static const struct global_parse_data global_fields[] = {
        { INT_RANGE(mbo_cell_capa, MBO_CELL_CAPA_AVAILABLE,
                    MBO_CELL_CAPA_NOT_SUPPORTED), 0 },
 #endif /*CONFIG_MBO */
+       { INT(gas_address3), 0 },
 };
 
 #undef FUNC
index 786b85a..1535738 100644 (file)
@@ -1292,6 +1292,16 @@ struct wpa_config {
         */
        enum mbo_cellular_capa mbo_cell_capa;
 #endif /* CONFIG_MBO */
+
+       /**
+        * gas_address3 - GAS Address3 field behavior
+        *
+        * Values:
+        * 0 - P2P specification (Address3 = AP BSSID)
+        * 1 = IEEE 802.11 standard compliant (Address3 = Wildcard BSSID when
+        *      sent to not-associated AP; if associated, AP BSSID)
+        */
+       int gas_address3;
 };
 
 
index 939a795..e72f844 100644 (file)
@@ -1336,6 +1336,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
                fprintf(f, "mbo_cell_capa=%u\n", config->mbo_cell_capa);
 #endif /* CONFIG_MBO */
 
+       if (config->gas_address3)
+               fprintf(f, "gas_address3=%d\n", config->gas_address3);
 }
 
 #endif /* CONFIG_NO_CONFIG_WRITE */
index 4f0d0e6..52f50cf 100644 (file)
@@ -17,6 +17,7 @@
 #include "common/wpa_ctrl.h"
 #include "rsn_supp/wpa.h"
 #include "wpa_supplicant_i.h"
+#include "config.h"
 #include "driver_i.h"
 #include "offchannel.h"
 #include "gas_query.h"
@@ -273,6 +274,10 @@ static int gas_query_tx(struct gas_query *gas, struct gas_query_pending *query,
                        struct wpabuf *req, unsigned int wait_time)
 {
        int res, prot = pmf_in_use(gas->wpa_s, query->addr);
+       const u8 *bssid;
+       const u8 wildcard_bssid[ETH_ALEN] = {
+               0xff, 0xff, 0xff, 0xff, 0xff, 0xff
+       };
 
        wpa_printf(MSG_DEBUG, "GAS: Send action frame to " MACSTR " len=%u "
                   "freq=%d prot=%d", MAC2STR(query->addr),
@@ -285,8 +290,15 @@ 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))
+               bssid = query->addr;
+       else
+               bssid = wildcard_bssid;
        res = offchannel_send_action(gas->wpa_s, query->freq, query->addr,
-                                    gas->wpa_s->own_addr, query->addr,
+                                    gas->wpa_s->own_addr, bssid,
                                     wpabuf_head(req), wpabuf_len(req),
                                     wait_time, gas_query_tx_status, 0);
        if (res == 0)
index 2d487c5..3d34bc0 100644 (file)
@@ -440,6 +440,12 @@ fast_reauth=1
 #     matching network block
 #auto_interworking=0
 
+# GAS Address3 field behavior
+# 0 = P2P specification (Address3 = AP BSSID); default
+# 1 = IEEE 802.11 standard compliant (Address3 = Wildcard BSSID when
+#     sent to not-associated AP; if associated, AP BSSID)
+#gas_address3=0
+
 # credential block
 #
 # Each credential used for automatic network selection is configured as a set