diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 674faabf5..0571c232d 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -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 diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index 786b85ab8..153573897 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -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; }; diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 939a79527..e72f8441f 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -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 */ diff --git a/wpa_supplicant/gas_query.c b/wpa_supplicant/gas_query.c index 4f0d0e622..52f50cfb7 100644 --- a/wpa_supplicant/gas_query.c +++ b/wpa_supplicant/gas_query.c @@ -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) diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf index 2d487c5a2..3d34bc04b 100644 --- a/wpa_supplicant/wpa_supplicant.conf +++ b/wpa_supplicant/wpa_supplicant.conf @@ -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