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>
This commit is contained in:
parent
9e1ecab1c5
commit
7a56af545a
1 changed files with 5 additions and 1 deletions
|
@ -466,16 +466,20 @@ int gas_query_req(struct gas_query *gas, const u8 *dst, int freq,
|
||||||
{
|
{
|
||||||
struct gas_query_pending *query;
|
struct gas_query_pending *query;
|
||||||
int dialog_token;
|
int dialog_token;
|
||||||
|
static int next_start = 0;
|
||||||
|
|
||||||
if (wpabuf_len(req) < 3)
|
if (wpabuf_len(req) < 3)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (dialog_token = 0; dialog_token < 256; dialog_token++) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
if (dialog_token == 256)
|
if (dialog_token == 256)
|
||||||
return -1; /* Too many pending queries */
|
return -1; /* Too many pending queries */
|
||||||
|
dialog_token = (next_start + dialog_token) % 256;
|
||||||
|
next_start = (dialog_token + 1) % 256;
|
||||||
|
|
||||||
query = os_zalloc(sizeof(*query));
|
query = os_zalloc(sizeof(*query));
|
||||||
if (query == NULL)
|
if (query == NULL)
|
||||||
|
|
Loading…
Reference in a new issue