P2P: Include passive channels in invitation response

Patch 51e9f22809 added the option
p2p_add_cli_chan to allow P2P GC to connect on passive channels
assuming the GO should know whether allowed to send on these channels.
This patch adds missing cli_channels to invitation response messages
to allow re-connecting to a persistent group as GC on passive
channels.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
This commit is contained in:
Mikael Kanstrup 2014-10-17 13:16:35 +02:00 committed by Jouni Malinen
parent fd1776536b
commit a0a5f73e62

View file

@ -174,7 +174,7 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
u8 group_bssid[ETH_ALEN], *bssid; u8 group_bssid[ETH_ALEN], *bssid;
int op_freq = 0; int op_freq = 0;
u8 reg_class = 0, channel = 0; u8 reg_class = 0, channel = 0;
struct p2p_channels intersection, *channels = NULL; struct p2p_channels all_channels, intersection, *channels = NULL;
int persistent; int persistent;
os_memset(group_bssid, 0, sizeof(group_bssid)); os_memset(group_bssid, 0, sizeof(group_bssid));
@ -226,7 +226,10 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
persistent = 1; persistent = 1;
} }
if (p2p_peer_channels_check(p2p, &p2p->cfg->channels, dev, p2p_channels_union(&p2p->cfg->channels, &p2p->cfg->cli_channels,
&all_channels);
if (p2p_peer_channels_check(p2p, &all_channels, dev,
msg.channel_list, msg.channel_list_len) < msg.channel_list, msg.channel_list_len) <
0) { 0) {
p2p_dbg(p2p, "No common channels found"); p2p_dbg(p2p, "No common channels found");
@ -235,8 +238,9 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
} }
p2p_channels_dump(p2p, "own channels", &p2p->cfg->channels); p2p_channels_dump(p2p, "own channels", &p2p->cfg->channels);
p2p_channels_dump(p2p, "own client channels", &all_channels);
p2p_channels_dump(p2p, "peer channels", &dev->channels); p2p_channels_dump(p2p, "peer channels", &dev->channels);
p2p_channels_intersect(&p2p->cfg->channels, &dev->channels, p2p_channels_intersect(&all_channels, &dev->channels,
&intersection); &intersection);
p2p_channels_dump(p2p, "intersection", &intersection); p2p_channels_dump(p2p, "intersection", &intersection);
@ -248,6 +252,17 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
msg.dev_password_id_present ? msg.dev_password_id : -1); msg.dev_password_id_present ? msg.dev_password_id : -1);
} }
if (go) {
p2p_channels_intersect(&p2p->cfg->channels, &dev->channels,
&intersection);
p2p_channels_dump(p2p, "intersection(GO)", &intersection);
if (intersection.reg_classes == 0) {
p2p_dbg(p2p, "No common channels found (GO)");
status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
goto fail;
}
}
if (op_freq) { if (op_freq) {
p2p_dbg(p2p, "Invitation processing forced frequency %d MHz", p2p_dbg(p2p, "Invitation processing forced frequency %d MHz",
op_freq); op_freq);