aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/p2p_supplicant.c
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2016-03-03 16:18:30 (GMT)
committerJouni Malinen <j@w1.fi>2016-03-04 19:17:32 (GMT)
commitc69ef1d2da0d06fe6b254b34f33050a2e594b946 (patch)
treede1fb290144d0ebd189dc7cb79db818c9b087bb2 /wpa_supplicant/p2p_supplicant.c
parent4115b0524ba11c1cc007ccbb27d9ca3958afce77 (diff)
downloadhostap-c69ef1d2da0d06fe6b254b34f33050a2e594b946.zip
hostap-c69ef1d2da0d06fe6b254b34f33050a2e594b946.tar.gz
hostap-c69ef1d2da0d06fe6b254b34f33050a2e594b946.tar.bz2
P2P: Respect p2p_ignore_shared_freq on p2p_group_add
Make sure wpas_p2p_init_go_params() respects the p2p_ignore_shared_freq configuration option. Choose currently used frequencies only if this option is not set, or if there are no unused channels left. Signed-off-by: Eliad Peller <eliad@wizery.com>
Diffstat (limited to 'wpa_supplicant/p2p_supplicant.c')
-rw-r--r--wpa_supplicant/p2p_supplicant.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index a852c38..5ff758f 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -5771,6 +5771,7 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
unsigned int cand;
unsigned int num, i;
int ignore_no_freqs = 0;
+ int unused_channels = wpas_p2p_num_unused_channels(wpa_s) > 0;
os_memset(params, 0, sizeof(*params));
params->role_go = 1;
@@ -5827,8 +5828,7 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
}
}
- if (!ignore_no_freqs &&
- wpas_p2p_num_unused_channels(wpa_s) <= 0) {
+ if (!ignore_no_freqs && !unused_channels) {
wpa_printf(MSG_DEBUG,
"P2P: Cannot force GO on freq (%d MHz) as all the channels are in use",
freq);
@@ -5843,7 +5843,8 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
}
/* consider using one of the shared frequencies */
- if (num) {
+ if (num &&
+ (!wpa_s->conf->p2p_ignore_shared_freq || !unused_channels)) {
cand = wpas_p2p_pick_best_used_freq(wpa_s, freqs, num);
if (wpas_p2p_supported_freq_go(wpa_s, channels, cand)) {
wpa_printf(MSG_DEBUG,
@@ -5866,8 +5867,7 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
}
}
- if (!ignore_no_freqs &&
- wpas_p2p_num_unused_channels(wpa_s) <= 0) {
+ if (!ignore_no_freqs && !unused_channels) {
wpa_printf(MSG_DEBUG,
"P2P: Cannot force GO on any of the channels we are already using");
goto fail;