P2P: Allow the avoid channels for P2P discovery/negotiation

The avoid channels are notified through
QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY allow minimal traffic, so
enhance the P2P behavior accordingly by considering these avoid
frequencies for P2P discovery/negotiation as long as they are not in
disallowed frequencies list.

Additionally, do not return failure when none of social channels are
available as operation channel, rather, mark the op_channel/op_reg_class
to 0 as this would anyway get selected during the group formation in
p2p_prepare_channel.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Purushottam Kushwaha 2018-12-28 18:12:00 +05:30 committed by Jouni Malinen
parent 0c1e29fd30
commit 59fa205388
6 changed files with 45 additions and 15 deletions

View file

@ -1470,7 +1470,8 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
p2p->op_channel = p2p->cfg->op_channel;
} else if (p2p_channel_random_social(&p2p->cfg->channels,
&p2p->op_reg_class,
&p2p->op_channel) == 0) {
&p2p->op_channel,
NULL, NULL) == 0) {
p2p_dbg(p2p, "Select random available social channel (op_class %u channel %u) as operating channel preference",
p2p->op_reg_class, p2p->op_channel);
} else {
@ -4764,9 +4765,12 @@ void p2p_set_managed_oper(struct p2p_data *p2p, int enabled)
int p2p_config_get_random_social(struct p2p_config *p2p, u8 *op_class,
u8 *op_channel)
u8 *op_channel,
struct wpa_freq_range_list *avoid_list,
struct wpa_freq_range_list *disallow_list)
{
return p2p_channel_random_social(&p2p->channels, op_class, op_channel);
return p2p_channel_random_social(&p2p->channels, op_class, op_channel,
avoid_list, disallow_list);
}