Cumulative patch from commit b19c098e75d1dfa681960d9656d36001464a746e
b19c098 Send authentication failure reason in wpas_auth_failed()
5cd0e22 P2P: Iterate through full pref_chan list in search of a valid channel
f41d55d hostapd: Check for overlapping 20 MHz BSS before starting 20/40 MHz BSS
5516ed3 WPS: Deinit before wpas_p2p_disconnect()
c70c375 SCARD: Fix GSM authentication on USIM
c78c6b7 WPS: Fix return value when context is not valid
388444e P2P: Modify the timeout for GO Negotiation on no concurrent session
7e68be3 P2P: Refrain from performing extended listen during PD
e9eb648 P2P: Reject P2P_FIND and P2P_LISTEN on disabled interface
c71c241 P2P: Clear P2P state if active interface is disabled
ad12f2f Add DRIVER_EVENT ctrl_iface command for testing purposes
3e66f78 P2P: Make sure GO start does not miss connect_without_scan
c7caac5 nl80211: Fix send_frame freq for IBSS
28fa4eb P2P: Fix scan optimization for GO during persistent group invocation
Change-Id: I5b4d46322641de1a2d87e50a7f5fdc97f2f30c38
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 5e227ec..c2f8d9b 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -3238,14 +3238,15 @@
static void p2p_timeout_wait_peer_idle(struct p2p_data *p2p)
{
struct p2p_device *dev = p2p->go_neg_peer;
+ struct os_reltime now;
if (dev == NULL) {
p2p_dbg(p2p, "Unknown GO Neg peer - stop GO Neg wait");
return;
}
- dev->wait_count++;
- if (dev->wait_count >= 120) {
+ os_get_reltime(&now);
+ if (os_reltime_expired(&now, &dev->go_neg_wait_started, 120)) {
p2p_dbg(p2p, "Timeout on waiting peer to become ready for GO Negotiation");
p2p_go_neg_failed(p2p, dev, -1);
return;
@@ -3534,7 +3535,6 @@
"req_config_methods=0x%x\n"
"flags=%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
"status=%d\n"
- "wait_count=%u\n"
"invitation_reqs=%u\n",
(int) (now.sec - dev->last_seen.sec),
dev->listen_freq,
@@ -3576,7 +3576,6 @@
dev->flags & P2P_DEV_PD_FOR_JOIN ?
"[PD_FOR_JOIN]" : "",
dev->status,
- dev->wait_count,
dev->invitation_reqs);
if (res < 0 || res >= end - pos)
return pos - buf;
@@ -3849,8 +3848,10 @@
p2p_ext_listen_timeout, p2p, NULL);
}
- if (p2p->cfg->is_p2p_in_progress &&
- p2p->cfg->is_p2p_in_progress(p2p->cfg->cb_ctx)) {
+ if ((p2p->cfg->is_p2p_in_progress &&
+ p2p->cfg->is_p2p_in_progress(p2p->cfg->cb_ctx)) ||
+ (p2p->pending_action_state == P2P_PENDING_PD &&
+ p2p->pd_retries > 0)) {
p2p_dbg(p2p, "Operation in progress - skip Extended Listen timeout (%s)",
p2p_state_txt(p2p->state));
return;
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index ac93902..f24fe23 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -939,7 +939,7 @@
if (*msg.status == P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE) {
p2p_dbg(p2p, "Wait for the peer to become ready for GO Negotiation");
dev->flags |= P2P_DEV_NOT_YET_READY;
- dev->wait_count = 0;
+ os_get_reltime(&dev->go_neg_wait_started);
p2p_set_state(p2p, P2P_WAIT_PEER_IDLE);
p2p_set_timeout(p2p, 0, 0);
} else {
diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
index 44b66c4..65ff9ef 100644
--- a/src/p2p/p2p_i.h
+++ b/src/p2p/p2p_i.h
@@ -101,6 +101,7 @@
unsigned int flags;
int status; /* enum p2p_status_code */
+ struct os_reltime go_neg_wait_started;
unsigned int wait_count;
unsigned int connect_reqs;
unsigned int invitation_reqs;
diff --git a/src/p2p/p2p_utils.c b/src/p2p/p2p_utils.c
index de47c12..06cb646 100644
--- a/src/p2p/p2p_utils.c
+++ b/src/p2p/p2p_utils.c
@@ -384,23 +384,14 @@
const struct p2p_channels *channels)
{
unsigned int i;
- int freq = 0;
-
- if (channels == NULL) {
- if (p2p->cfg->num_pref_chan) {
- freq = p2p_channel_to_freq(
- p2p->cfg->pref_chan[0].op_class,
- p2p->cfg->pref_chan[0].chan);
- if (freq < 0)
- freq = 0;
- }
- return freq;
- }
+ int freq;
for (i = 0; p2p->cfg->pref_chan && i < p2p->cfg->num_pref_chan; i++) {
freq = p2p_channel_to_freq(p2p->cfg->pref_chan[i].op_class,
p2p->cfg->pref_chan[i].chan);
- if (p2p_channels_includes_freq(channels, freq))
+ if (freq <= 0)
+ continue;
+ if (!channels || p2p_channels_includes_freq(channels, freq))
return freq;
}