aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/p2p/p2p.c10
-rw-r--r--src/p2p/p2p_build.c24
-rw-r--r--src/p2p/p2p_go_neg.c56
-rw-r--r--src/p2p/p2p_invitation.c32
4 files changed, 30 insertions, 92 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 03380dc..f038812 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -1185,9 +1185,15 @@ static int p2p_prepare_channel(struct p2p_data *p2p, unsigned int force_freq)
* are multichannel concurrent, we have to poplulate the
* p2p_channels with list of channels that we support.
*/
+#ifdef ANDROID_P2P
+ wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "Full channel list");
+#endif
os_memcpy(&p2p->channels, &p2p->cfg->channels,
sizeof(struct p2p_channels));
} else {
+#ifdef ANDROID_P2P
+ wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "Single channel list %d", p2p->op_channel);
+#endif
p2p->channels.reg_classes = 1;
p2p->channels.reg_class[0].channels = 1;
p2p->channels.reg_class[0].reg_class = p2p->op_reg_class;
@@ -1280,9 +1286,9 @@ int p2p_connect(struct p2p_data *p2p, const u8 *peer_addr,
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Request to start group negotiation - peer=" MACSTR
" GO Intent=%d Intended Interface Address=" MACSTR
- " wps_method=%d persistent_group=%d pd_before_go_neg=%d",
+ " wps_method=%d persistent_group=%d pd_before_go_neg=%d force_freq %d",
MAC2STR(peer_addr), go_intent, MAC2STR(own_interface_addr),
- wps_method, persistent_group, pd_before_go_neg);
+ wps_method, persistent_group, pd_before_go_neg, force_freq);
if (p2p_prepare_channel(p2p, force_freq) < 0)
return -1;
diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c
index 7f4d295..be069a5 100644
--- a/src/p2p/p2p_build.c
+++ b/src/p2p/p2p_build.c
@@ -136,30 +136,6 @@ void p2p_buf_add_channel_list(struct wpabuf *buf, const char *country,
len + 2, (u8 *) wpabuf_put(buf, 0) - len - 2);
}
-#ifdef ANDROID_P2P
-/* Adds a given channel as the only channel in channel list attribute */
-void p2p_buf_add_oper_as_channel_list(struct wpabuf *buf, const char *country,
- u8 reg_class, u8 channel)
-{
- u8 *len;
- u8 channel_list[1];
- channel_list[0] = channel;
-
- /* Channel List */
- wpabuf_put_u8(buf, P2P_ATTR_CHANNEL_LIST);
- len = wpabuf_put(buf, 2); /* IE length to be filled */
- wpabuf_put_data(buf, country, 3); /* Country String */
-
- wpabuf_put_u8(buf, reg_class);
- wpabuf_put_u8(buf, 1);
- wpabuf_put_data(buf, channel_list, 1);
-
- /* Update attribute length */
- WPA_PUT_LE16(len, (u8 *) wpabuf_put(buf, 0) - len - 2);
- wpa_printf(MSG_DEBUG, "P2P: * Oper as Channel List %u", channel);
-}
-#endif
-
void p2p_buf_add_status(struct wpabuf *buf, u8 status)
{
/* Status */
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index 9c287b6..3835590 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -174,17 +174,7 @@ static struct wpabuf * p2p_build_go_neg_req(struct p2p_data *p2p,
p2p_buf_add_ext_listen_timing(buf, p2p->ext_listen_period,
p2p->ext_listen_interval);
p2p_buf_add_intended_addr(buf, p2p->intended_addr);
-#ifdef ANDROID_P2P
- if (p2p->cfg->p2p_concurrency == P2P_SINGLE_CHANNEL_CONCURRENT && p2p->op_channel) {
- wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Force channel list %d", p2p->op_channel);
- p2p_buf_add_oper_as_channel_list(buf, p2p->cfg->country, p2p->op_reg_class,
- p2p->op_channel);
- } else {
-#endif
- p2p_buf_add_channel_list(buf, p2p->cfg->country, &p2p->channels);
-#ifdef ANDROID_P2P
- }
-#endif
+ p2p_buf_add_channel_list(buf, p2p->cfg->country, &p2p->channels);
p2p_buf_add_device_info(buf, p2p, peer);
p2p_buf_add_operating_channel(buf, p2p->cfg->country,
p2p->op_reg_class, p2p->op_channel);
@@ -304,18 +294,8 @@ static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p,
p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) | tie_breaker);
p2p_buf_add_config_timeout(buf, p2p->go_timeout, p2p->client_timeout);
if (peer && peer->go_state == REMOTE_GO) {
-#ifdef ANDROID_P2P
- if (p2p->cfg->p2p_concurrency == P2P_SINGLE_CHANNEL_CONCURRENT && p2p->op_channel) {
- wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Forcing a channel ");
- p2p_buf_add_operating_channel(buf, p2p->cfg->country,
- p2p->op_reg_class, p2p->op_channel);
- } else {
-#endif
- wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Omit Operating "
- "Channel attribute");
-#ifdef ANDROID_P2P
- }
-#endif
+ wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Omit Operating "
+ "Channel attribute");
} else {
p2p_buf_add_operating_channel(buf, p2p->cfg->country,
p2p->op_reg_class,
@@ -323,28 +303,18 @@ static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p,
}
p2p_buf_add_intended_addr(buf, p2p->intended_addr);
-#ifdef ANDROID_P2P
- if (p2p->cfg->p2p_concurrency == P2P_SINGLE_CHANNEL_CONCURRENT && p2p->op_channel) {
- wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Force channel list %d", p2p->op_channel);
- p2p_buf_add_oper_as_channel_list(buf, p2p->cfg->country, p2p->op_reg_class,
- p2p->op_channel);
+ if (status || peer == NULL) {
+ p2p_buf_add_channel_list(buf, p2p->cfg->country,
+ &p2p->channels);
+ } else if (peer->go_state == REMOTE_GO) {
+ p2p_buf_add_channel_list(buf, p2p->cfg->country,
+ &p2p->channels);
} else {
-#endif
- if (status || peer == NULL) {
- p2p_buf_add_channel_list(buf, p2p->cfg->country,
- &p2p->channels);
- } else if (peer->go_state == REMOTE_GO) {
- p2p_buf_add_channel_list(buf, p2p->cfg->country,
- &p2p->channels);
- } else {
- struct p2p_channels res;
- p2p_channels_intersect(&p2p->channels, &peer->channels,
- &res);
- p2p_buf_add_channel_list(buf, p2p->cfg->country, &res);
- }
-#ifdef ANDROID_P2P
+ struct p2p_channels res;
+ p2p_channels_intersect(&p2p->channels, &peer->channels,
+ &res);
+ p2p_buf_add_channel_list(buf, p2p->cfg->country, &res);
}
-#endif
p2p_buf_add_device_info(buf, p2p, peer);
if (peer && peer->go_state == LOCAL_GO) {
diff --git a/src/p2p/p2p_invitation.c b/src/p2p/p2p_invitation.c
index 7d6dd11..769e57b 100644
--- a/src/p2p/p2p_invitation.c
+++ b/src/p2p/p2p_invitation.c
@@ -66,17 +66,7 @@ static struct wpabuf * p2p_build_invitation_req(struct p2p_data *p2p,
p2p->op_reg_class, p2p->op_channel);
if (p2p->inv_bssid_set)
p2p_buf_add_group_bssid(buf, p2p->inv_bssid);
-#ifdef ANDROID_P2P
- if (p2p->cfg->p2p_concurrency == P2P_SINGLE_CHANNEL_CONCURRENT && p2p->op_channel) {
- wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "Forcing channel list %d", p2p->op_channel);
- p2p_buf_add_oper_as_channel_list(buf, p2p->cfg->country, p2p->op_reg_class,
- p2p->op_channel);
- } else {
-#endif
- p2p_buf_add_channel_list(buf, p2p->cfg->country, &p2p->channels);
-#ifdef ANDROID_P2P
- }
-#endif
+ p2p_buf_add_channel_list(buf, p2p->cfg->country, &p2p->channels);
if (go_dev_addr)
dev_addr = go_dev_addr;
else if (p2p->inv_role == P2P_INVITE_ROLE_CLIENT)
@@ -143,18 +133,8 @@ static struct wpabuf * p2p_build_invitation_resp(struct p2p_data *p2p,
reg_class, channel);
if (group_bssid)
p2p_buf_add_group_bssid(buf, group_bssid);
-#ifdef ANDROID_P2P
- if (p2p->cfg->p2p_concurrency == P2P_SINGLE_CHANNEL_CONCURRENT && channel) {
- wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "Forcing channel list %d", channel);
- p2p_buf_add_oper_as_channel_list(buf, p2p->cfg->country,
- reg_class, channel);
- } else {
-#endif
- if (channels)
- p2p_buf_add_channel_list(buf, p2p->cfg->country, channels);
-#ifdef ANDROID_P2P
- }
-#endif
+ if (channels)
+ p2p_buf_add_channel_list(buf, p2p->cfg->country, channels);
p2p_buf_update_ie_hdr(buf, len);
#ifdef CONFIG_WIFI_DISPLAY
@@ -603,11 +583,17 @@ int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role,
force_freq);
return -1;
}
+#ifdef ANDROID_P2P
+ wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "Single channel list %d", p2p->op_channel);
+#endif
p2p->channels.reg_classes = 1;
p2p->channels.reg_class[0].channels = 1;
p2p->channels.reg_class[0].reg_class = p2p->op_reg_class;
p2p->channels.reg_class[0].channel[0] = p2p->op_channel;
} else {
+#ifdef ANDROID_P2P
+ wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "Full channel list");
+#endif
p2p->op_reg_class = p2p->cfg->op_reg_class;
p2p->op_channel = p2p->cfg->op_channel;
os_memcpy(&p2p->channels, &p2p->cfg->channels,