aboutsummaryrefslogtreecommitdiffstats
path: root/src/p2p
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2013-08-26 12:09:05 -0700
committerDmitry Shmidt <dimitrysh@google.com>2013-08-26 12:09:05 -0700
commitb7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15 (patch)
tree5c3debc3660836db47e9d01a3801a3587e74446b /src/p2p
parent0c18dcd2bd94644d9215995225c076d146d6ad82 (diff)
downloadandroid_external_wpa_supplicant_8-b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15.tar.gz
android_external_wpa_supplicant_8-b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15.tar.bz2
android_external_wpa_supplicant_8-b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15.zip
Cumulative patch from commit 853b49a030c00fd6b2dde14e183ca2bf108eaa16
853b49a tests: Increase test_ap_wps_init connection timeout 28de68a P2P: Update peer operating channel from GO Negotiation Confirm 6701fdc P2P: Use the first pref_chan entry as operating channel preference 99d7c76 P2P: Add more debug info on operating channel selection 8d660e0 P2P: Add GO negotiation results into the P2P-GO-NEG-SUCCESS event 2c6f8cf Replace perror() with wpa_printf(strerror) in ctrl_iface calls e743db4 IBSS RSN: Add IBSS-RSN-COMPLETED event message 4c55901 P2P: Add state info to global STATUS command ae8c27f Add STATUS command to global control interface 42868f1 Add SAVE_CONFIG command to global control interface 1b9b31c Add SET command for global control interface 0185007 hostapd: Add survey dump support 245e026 hostapd: Split up channel checking into helpers ba873bd wired: Wait for the link to become active before sending packets d393de1 P2P: Validate the freq in p2p_group_add 973622c wpa_supplicant: Fix AP mode frequency initialization d99ca89 P2P: Skip non-P2P interface in p2p_group_remove * 239abaf WPS: Set currently used RF band in RF Bands attribute bf83eab nl80211: Start P2P Device when rfkill is unblocked 60b13c2 nl80211: Do not change type to station on P2P interfaces e0591c3 wpa_supplicant: Reduce wait time for control interfaces 5046eb4 P2P: Allow separate interface GO to disconnect low-ack STAs 5bcd5c5 FT RRB: Clear pad field to avoid sending out uninitialized data b378c41 nl80211: Fix deinit path to unregister nl_mgmt socket a235aca Fix DETACH command debug prints to avoid use of freed memory 8d6e035 Make global UNIX socket non-blocking for ctrl_iface 86bd141 Change WEP network selection to reject WPA/WPA2 APs 2e145e9 WPS: Fix failure path to allow WSC_NACK and EAP-Failure to be exchanged 3351a38 WPS: Add control interface command for fetching latest status e96872a WPS: Track peer MAC address from the last operations ae23935 WPS: Track PBC status 61b6520 WPS: Track result of the latest WPS operation 50396e2 WPS: Add PBC mode activated/disabled events 961750c WPS: Share a common function for error strings 30158a0 nl80211: Update the assoc_freq during connect 83e7bb0 nl80211: Add more debug prints for DEL_STATION commands Bug: 9056601 Change-Id: I8bc671eb13f4c2c388a4c15cf1ba968c24c9656a Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/p2p.c20
-rw-r--r--src/p2p/p2p.h11
-rw-r--r--src/p2p/p2p_go_neg.c8
-rw-r--r--src/p2p/p2p_utils.c9
4 files changed, 48 insertions, 0 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 0a414eeb..b9a754cc 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -180,6 +180,12 @@ static const char * p2p_state_txt(int state)
}
+const char * p2p_get_state_txt(struct p2p_data *p2p)
+{
+ return p2p_state_txt(p2p->state);
+}
+
+
u16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr)
{
struct p2p_device *dev = NULL;
@@ -1195,6 +1201,8 @@ static int p2p_prepare_channel_pref(struct p2p_data *p2p,
u8 op_class, op_channel;
unsigned int freq = force_freq ? force_freq : pref_freq;
+ p2p_dbg(p2p, "Prepare channel pref - force_freq=%u pref_freq=%u",
+ force_freq, pref_freq);
if (p2p_freq_to_channel(freq, &op_class, &op_channel) < 0) {
p2p_dbg(p2p, "Unsupported frequency %u MHz", freq);
return -1;
@@ -1227,6 +1235,8 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
{
u8 op_class, op_channel;
+ p2p_dbg(p2p, "Prepare channel best");
+
if (!p2p->cfg->cfg_op_channel && p2p->best_freq_overall > 0 &&
p2p_supported_freq(p2p, p2p->best_freq_overall) &&
p2p_freq_to_channel(p2p->best_freq_overall, &op_class, &op_channel)
@@ -1248,7 +1258,15 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
p2p_dbg(p2p, "Select best 2.4 GHz channel as operating channel preference");
p2p->op_reg_class = op_class;
p2p->op_channel = op_channel;
+ } else if (p2p->cfg->num_pref_chan > 0 &&
+ p2p_channels_includes(&p2p->cfg->channels,
+ p2p->cfg->pref_chan[0].op_class,
+ p2p->cfg->pref_chan[0].chan)) {
+ p2p_dbg(p2p, "Select first pref_chan entry as operating channel preference");
+ p2p->op_reg_class = p2p->cfg->pref_chan[0].op_class;
+ p2p->op_channel = p2p->cfg->pref_chan[0].chan;
} else {
+ p2p_dbg(p2p, "Select pre-configured channel as operating channel preference");
p2p->op_reg_class = p2p->cfg->op_reg_class;
p2p->op_channel = p2p->cfg->op_channel;
}
@@ -1274,6 +1292,8 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev,
unsigned int force_freq, unsigned int pref_freq)
{
+ p2p_dbg(p2p, "Prepare channel - force_freq=%u pref_freq=%u",
+ force_freq, pref_freq);
if (force_freq || pref_freq) {
if (p2p_prepare_channel_pref(p2p, force_freq, pref_freq) < 0)
return -1;
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 0fdad86a..b206d232 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -1836,4 +1836,15 @@ struct wpabuf * wifi_display_encaps(struct wpabuf *subelems);
int p2p_set_disc_int(struct p2p_data *p2p, int min_disc_int, int max_disc_int,
int max_disc_tu);
+/**
+ * p2p_get_state_txt - Get current P2P state for debug purposes
+ * @p2p: P2P module context from p2p_init()
+ * Returns: Name of the current P2P module state
+ *
+ * It should be noted that the P2P module state names are internal information
+ * and subject to change at any point, i.e., this information should be used
+ * mainly for debugging purposes.
+ */
+const char * p2p_get_state_txt(struct p2p_data *p2p);
+
#endif /* P2P_H */
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index 4fba5501..8740ed5b 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -1094,6 +1094,14 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
p2p_parse_free(&msg);
return;
#endif /* CONFIG_P2P_STRICT */
+ } else if (dev->go_state == REMOTE_GO) {
+ int oper_freq = p2p_channel_to_freq(msg.operating_channel[3],
+ msg.operating_channel[4]);
+ if (oper_freq != dev->oper_freq) {
+ p2p_dbg(p2p, "Updated peer (GO) operating channel preference from %d MHz to %d MHz",
+ dev->oper_freq, oper_freq);
+ dev->oper_freq = oper_freq;
+ }
}
#ifdef ANDROID_P2P
diff --git a/src/p2p/p2p_utils.c b/src/p2p/p2p_utils.c
index 0da26827..deb7aa9f 100644
--- a/src/p2p/p2p_utils.c
+++ b/src/p2p/p2p_utils.c
@@ -109,6 +109,9 @@ int p2p_freq_to_channel(unsigned int freq, u8 *op_class, u8 *channel)
{
/* TODO: more operating classes */
if (freq >= 2412 && freq <= 2472) {
+ if ((freq - 2407) % 5)
+ return -1;
+
*op_class = 81; /* 2.407 GHz, channels 1..13 */
*channel = (freq - 2407) / 5;
return 0;
@@ -121,12 +124,18 @@ int p2p_freq_to_channel(unsigned int freq, u8 *op_class, u8 *channel)
}
if (freq >= 5180 && freq <= 5240) {
+ if ((freq - 5000) % 5)
+ return -1;
+
*op_class = 115; /* 5 GHz, channels 36..48 */
*channel = (freq - 5000) / 5;
return 0;
}
if (freq >= 5745 && freq <= 5805) {
+ if ((freq - 5000) % 5)
+ return -1;
+
*op_class = 124; /* 5 GHz, channels 149..161 */
*channel = (freq - 5000) / 5;
return 0;