If a GAS response is received for a pending SD query, process it even if
the TX status event for the query has not yet been received. It is
possible for the TX status and RX events to be reordered especially when
using UML time-travel, so this is needed to avoid race conditions to
make SD more robust.
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
u16 slen;
u16 update_indic;
- if (p2p->state != P2P_SD_DURING_FIND || p2p->sd_peer == NULL ||
+ if ((p2p->state != P2P_SD_DURING_FIND && p2p->state != P2P_SEARCH) ||
+ !p2p->sd_peer ||
!ether_addr_equal(sa, p2p->sd_peer->info.p2p_device_addr)) {
p2p_dbg(p2p, "Ignore unexpected GAS Initial Response from "
MACSTR, MAC2STR(sa));
return;
}
+ if (p2p->state == P2P_SEARCH) {
+ /* It is possible for the TX status and RX response events to be
+ * reordered, so assume the request was ACKed if a response is
+ * received. */
+ p2p_dbg(p2p,
+ "GAS Initial Request had not yet received TX status - process the response anyway");
+ p2p_set_state(p2p, P2P_SD_DURING_FIND);
+ }
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
p2p_clear_timeout(p2p);