P2P: Fix p2p_pref_chan setting from configuration file
authorYufeng Wang <yufengw@qca.qualcomm.com>
Fri, 17 May 2013 08:03:52 +0000 (11:03 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 17 May 2013 08:03:52 +0000 (11:03 +0300)
Commit 21d996f775a2131bb0c73d6e18ca9b382f017057 added p2p_pref_chan as a
configuration file parameter, but included only the case of dynamically
setting this at runtime through the control interface SET command.
Complete this functionality by taking this value into use directly from
the configuration file, too.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/p2p_supplicant.c

index 37aa314..090168a 100644 (file)
@@ -3030,6 +3030,12 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
                wpa_printf(MSG_DEBUG, "P2P: Random operating channel: "
                           "%d:%d", p2p.op_reg_class, p2p.op_channel);
        }
+
+       if (wpa_s->conf->p2p_pref_chan && wpa_s->conf->num_p2p_pref_chan) {
+               p2p.pref_chan = wpa_s->conf->p2p_pref_chan;
+               p2p.num_pref_chan = wpa_s->conf->num_p2p_pref_chan;
+       }
+
        if (wpa_s->conf->country[0] && wpa_s->conf->country[1]) {
                os_memcpy(p2p.country, wpa_s->conf->country, 2);
                p2p.country[2] = 0x04;