aboutsummaryrefslogtreecommitdiffstats
path: root/src/p2p
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2012-04-26 16:11:17 +0300
committerJouni Malinen <j@w1.fi>2012-04-26 16:11:17 +0300
commitc98b83f2d3f8b9ad435c75f386829105f9837baa (patch)
treefbb8f37eb6d573f45033a70e30f7759d402e5f27 /src/p2p
parent7c4e92115a795dd2ee2135cf49d7e9e172fb5851 (diff)
downloadexternal_wpa_supplicant_8_ti-c98b83f2d3f8b9ad435c75f386829105f9837baa.zip
external_wpa_supplicant_8_ti-c98b83f2d3f8b9ad435c75f386829105f9837baa.tar.gz
external_wpa_supplicant_8_ti-c98b83f2d3f8b9ad435c75f386829105f9837baa.tar.bz2
P2P: Do not update peer Listen channel based on PD/Invitation
Commits 17bef1e97a5061a8b5443dc24166e28439911f0b and ffe98dfb88a19b66418184955ef272789e3abb68 started using p2p_add_device() with other frames than just Probe Response frames from scan results. However, these changes did not take into account that the PD Request and Invitation Request frames are normally received on the our own Listen channel, not on the Listen channel of the peer. As such, these frames must not be used to update Listen channel information for the peer. Fix this by letting p2p_add_device() know whether the results are from scan results and if not, skip the peer table updates that are specific to Probe Response frames. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com> intended-for: hostap-1
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/p2p.c23
-rw-r--r--src/p2p/p2p_i.h2
-rw-r--r--src/p2p/p2p_invitation.c3
-rw-r--r--src/p2p/p2p_pd.c3
4 files changed, 19 insertions, 12 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index a23ccaf..474dd73 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -544,7 +544,7 @@ static void p2p_copy_wps_info(struct p2p_device *dev, int probe_req,
/**
- * p2p_add_device - Add peer entries based on scan results
+ * p2p_add_device - Add peer entries based on scan results or P2P frames
* @p2p: P2P module context from p2p_init()
* @addr: Source address of Beacon or Probe Response frame (may be either
* P2P Device Address or P2P Interface Address)
@@ -552,6 +552,7 @@ static void p2p_copy_wps_info(struct p2p_device *dev, int probe_req,
* @freq: Frequency on which the Beacon or Probe Response frame was received
* @ies: IEs from the Beacon or Probe Response frame
* @ies_len: Length of ies buffer in octets
+ * @scan_res: Whether this was based on scan results
* Returns: 0 on success, -1 on failure
*
* If the scan result is for a GO, the clients in the group will also be added
@@ -560,7 +561,7 @@ static void p2p_copy_wps_info(struct p2p_device *dev, int probe_req,
* Info attributes.
*/
int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
- const u8 *ies, size_t ies_len)
+ const u8 *ies, size_t ies_len, int scan_res)
{
struct p2p_device *dev;
struct p2p_message msg;
@@ -629,16 +630,18 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
}
}
- if (dev->listen_freq && dev->listen_freq != freq) {
+ if (dev->listen_freq && dev->listen_freq != freq && scan_res) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Update Listen frequency based on scan "
"results (" MACSTR " %d -> %d MHz (DS param %d)",
MAC2STR(dev->info.p2p_device_addr), dev->listen_freq,
freq, msg.ds_params ? *msg.ds_params : -1);
}
- dev->listen_freq = freq;
- if (msg.group_info)
- dev->oper_freq = freq;
+ if (scan_res) {
+ dev->listen_freq = freq;
+ if (msg.group_info)
+ dev->oper_freq = freq;
+ }
dev->info.level = level;
p2p_copy_wps_info(dev, 0, &msg);
@@ -657,8 +660,10 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
break;
}
- p2p_add_group_clients(p2p, p2p_dev_addr, addr, freq, msg.group_info,
- msg.group_info_len);
+ if (scan_res) {
+ p2p_add_group_clients(p2p, p2p_dev_addr, addr, freq,
+ msg.group_info, msg.group_info_len);
+ }
p2p_parse_free(&msg);
@@ -2598,7 +2603,7 @@ static void p2p_prov_disc_cb(struct p2p_data *p2p, int success)
int p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq,
int level, const u8 *ies, size_t ies_len)
{
- p2p_add_device(p2p, bssid, freq, level, ies, ies_len);
+ p2p_add_device(p2p, bssid, freq, level, ies, ies_len, 1);
if (p2p->go_neg_peer && p2p->state == P2P_SEARCH &&
os_memcmp(p2p->go_neg_peer->info.p2p_device_addr, bssid, ETH_ALEN)
diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
index 30a83d5..3a764ca 100644
--- a/src/p2p/p2p_i.h
+++ b/src/p2p/p2p_i.h
@@ -653,7 +653,7 @@ struct p2p_device * p2p_add_dev_from_go_neg_req(struct p2p_data *p2p,
void p2p_add_dev_info(struct p2p_data *p2p, const u8 *addr,
struct p2p_device *dev, struct p2p_message *msg);
int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
- const u8 *ies, size_t ies_len);
+ const u8 *ies, size_t ies_len, int scan_res);
struct p2p_device * p2p_get_device(struct p2p_data *p2p, const u8 *addr);
struct p2p_device * p2p_get_device_interface(struct p2p_data *p2p,
const u8 *addr);
diff --git a/src/p2p/p2p_invitation.c b/src/p2p/p2p_invitation.c
index 1e6ed7d..5925549 100644
--- a/src/p2p/p2p_invitation.c
+++ b/src/p2p/p2p_invitation.c
@@ -121,7 +121,8 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
"P2P: Invitation Request from unknown peer "
MACSTR, MAC2STR(sa));
- if (p2p_add_device(p2p, sa, rx_freq, 0, data + 1, len - 1)) {
+ if (p2p_add_device(p2p, sa, rx_freq, 0, data + 1, len - 1, 0))
+ {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invitation Request add device failed "
MACSTR, MAC2STR(sa));
diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c
index ca248ae..7f18766 100644
--- a/src/p2p/p2p_pd.c
+++ b/src/p2p/p2p_pd.c
@@ -110,7 +110,8 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Provision Discovery Request from "
"unknown peer " MACSTR, MAC2STR(sa));
- if (p2p_add_device(p2p, sa, rx_freq, 0, data + 1, len - 1)) {
+ if (p2p_add_device(p2p, sa, rx_freq, 0, data + 1, len - 1, 0))
+ {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Provision Discovery Request add device "
"failed " MACSTR, MAC2STR(sa));