aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2012-08-30 21:06:45 +0300
committerArik Nemtsov <arik@wizery.com>2012-09-04 20:46:20 +0300
commit66b8140a08b9f6297cd49a3428ada713bf668300 (patch)
treecef8699bb7f7e29cbbbe47675079842326e81782
parent886a5892958070e5f34aa37dae8d9afe79758c5e (diff)
downloadexternal_wpa_supplicant_8_ti-66b8140a08b9f6297cd49a3428ada713bf668300.zip
external_wpa_supplicant_8_ti-66b8140a08b9f6297cd49a3428ada713bf668300.tar.gz
external_wpa_supplicant_8_ti-66b8140a08b9f6297cd49a3428ada713bf668300.tar.bz2
P2P: always re-select oper channel if not hard coded
Since the operating channel is randomly set to 1/6/11 on init, which is always in the channel intersection, we were effectively ignoring the set of p2p preferred channels. Fix this by trying to get the best channel we can, unless the user hard coded the operating channel in the configuration file. Fall back to the initial randomly selected channel if a better one cannot be chosen. Signed-hostap: Arik Nemtsov <arik@wizery.com>
-rw-r--r--src/p2p/p2p_go_neg.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index db12e9d..407897b 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -367,6 +367,20 @@ static void p2p_reselect_channel(struct p2p_data *p2p,
}
/*
+ * Try to see if the original channel is in the intersection. If
+ * so, no need to change anything, as it already contains some
+ * randomness.
+ */
+ if (p2p_channels_includes(intersection, p2p->op_reg_class,
+ p2p->op_channel)) {
+ wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
+ "P2P: Using original operating class and channel "
+ "(reg_class %u channel %u) from intersection",
+ p2p->op_reg_class, p2p->op_channel);
+ return;
+ }
+
+ /*
* Fall back to whatever is included in the channel intersection since
* no better options seems to be available.
*/
@@ -623,7 +637,8 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
wpa_hexdump(MSG_DEBUG, "P2P: channels",
c->channel, c->channels);
}
- if (!p2p_channels_includes(&intersection,
+ if (!p2p->cfg->cfg_op_channel ||
+ !p2p_channels_includes(&intersection,
p2p->op_reg_class,
p2p->op_channel))
p2p_reselect_channel(p2p, &intersection);