From: Jouni Malinen Date: Mon, 26 Aug 2013 11:10:23 +0000 (+0300) Subject: P2P: Use the first pref_chan entry as operating channel preference X-Git-Tag: aosp-kk-from-upstream~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6701fdc;p=thirdparty%2Fhostap.git P2P: Use the first pref_chan entry as operating channel preference If there are no higher priority preference for the operating channel, use the first pref_chan entry as the operating channel preference over the pre-configured channel which is not really a good indication of preference. This changes the behavior for GO Negotiation Request frame operating channel preference value in cases where p2p_pref_chan list is set. Signed-hostap: Jouni Malinen --- diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 26b86a8bc..f3414dd9e 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -1190,6 +1190,13 @@ 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;