aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/gas_query.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2013-04-14 20:23:50 (GMT)
committerJouni Malinen <j@w1.fi>2013-05-20 08:09:16 (GMT)
commit7a56af545a47f975463da0029d2c2d3fcb4af925 (patch)
tree122022d851280c2da19b4a6179a714f662ea16db /wpa_supplicant/gas_query.c
parent9e1ecab1c5c4c3c583fd18fd77566b467b0b9de8 (diff)
downloadhostap-7a56af545a47f975463da0029d2c2d3fcb4af925.zip
hostap-7a56af545a47f975463da0029d2c2d3fcb4af925.tar.gz
hostap-7a56af545a47f975463da0029d2c2d3fcb4af925.tar.bz2
GAS: Assign new dialog token even if previous one is free
This makes the design more robust against unexpected duplicates since each new GAS exchange gets a different dialog token compared to the previous one. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/gas_query.c')
-rw-r--r--wpa_supplicant/gas_query.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/wpa_supplicant/gas_query.c b/wpa_supplicant/gas_query.c
index 09d308a..38c342e 100644
--- a/wpa_supplicant/gas_query.c
+++ b/wpa_supplicant/gas_query.c
@@ -466,16 +466,20 @@ int gas_query_req(struct gas_query *gas, const u8 *dst, int freq,
{
struct gas_query_pending *query;
int dialog_token;
+ static int next_start = 0;
if (wpabuf_len(req) < 3)
return -1;
for (dialog_token = 0; dialog_token < 256; dialog_token++) {
- if (gas_query_dialog_token_available(gas, dst, dialog_token))
+ if (gas_query_dialog_token_available(
+ gas, dst, (next_start + dialog_token) % 256))
break;
}
if (dialog_token == 256)
return -1; /* Too many pending queries */
+ dialog_token = (next_start + dialog_token) % 256;
+ next_start = (dialog_token + 1) % 256;
query = os_zalloc(sizeof(*query));
if (query == NULL)