]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Allow auto GO on DFS channels if driver supports this
authorSunil Dutt <usdutt@qti.qualcomm.com>
Tue, 13 Jun 2017 11:52:02 +0000 (17:22 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 7 Jul 2017 10:49:01 +0000 (13:49 +0300)
If a DFS forced frequency is provided in 'p2p_group_add' and the driver
supports DFS offload, the frequency was rejected in
wpas_p2p_init_go_params(). However, it was accepted in
wpas_p2p_select_go_freq() and wpas_p2p_group_add(). To make the behavior
consistent, the DFS frequency is now accepted in
wpas_p2p_init_go_params() similar to the way done in
wpas_p2p_select_go_freq().

Redundant check in wpas_p2p_group_add() for DFS forced frequency is
removed.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/p2p_supplicant.c

index dcba35e89395c887e7ce889ab952dca74a4cc824..978aaa3903e9f1f4f04e5d2faadeea6945e67016 100644 (file)
@@ -5842,12 +5842,30 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 
        /* try using the forced freq */
        if (freq) {
-               if (!wpas_p2p_supported_freq_go(wpa_s, channels, freq)) {
+               if (wpas_p2p_disallowed_freq(wpa_s->global, freq) ||
+                   !freq_included(wpa_s, channels, freq)) {
                        wpa_printf(MSG_DEBUG,
-                                  "P2P: Forced GO freq %d MHz not accepted",
+                                  "P2P: Forced GO freq %d MHz disallowed",
                                   freq);
                        goto fail;
                }
+               if (!p2p_supported_freq_go(wpa_s->global->p2p, freq)) {
+                       if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) &&
+                           ieee80211_is_dfs(freq)) {
+                               /*
+                                * If freq is a DFS channel and DFS is offloaded
+                                * to the driver, allow P2P GO to use it.
+                                */
+                               wpa_printf(MSG_DEBUG,
+                                          "P2P: %s: The forced channel for GO (%u MHz) requires DFS and DFS is offloaded",
+                                          __func__, freq);
+                       } else {
+                               wpa_printf(MSG_DEBUG,
+                                          "P2P: The forced channel for GO (%u MHz) is not supported for P2P uses",
+                                          freq);
+                               goto fail;
+                       }
+               }
 
                for (i = 0; i < num; i++) {
                        if (freqs[i].freq == freq) {
@@ -6086,24 +6104,7 @@ int wpas_p2p_group_add(struct wpa_supplicant *wpa_s, int persistent_group,
        if (wpas_p2p_init_go_params(wpa_s, &params, freq, vht_center_freq2,
                                    ht40, vht, max_oper_chwidth, NULL))
                return -1;
-       if (params.freq &&
-           !p2p_supported_freq_go(wpa_s->global->p2p, params.freq)) {
-               if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) &&
-                   ieee80211_is_dfs(params.freq)) {
-                       /*
-                        * If freq is a DFS channel and DFS is offloaded to the
-                        * driver, allow P2P GO to use it.
-                        */
-                       wpa_printf(MSG_DEBUG,
-                                  "P2P: %s: The forced channel for GO (%u MHz) is DFS, and DFS is offloaded to driver",
-                               __func__, params.freq);
-               } else {
-                       wpa_printf(MSG_DEBUG,
-                                  "P2P: The selected channel for GO (%u MHz) is not supported for P2P uses",
-                                  params.freq);
-                       return -1;
-               }
-       }
+
        p2p_go_params(wpa_s->global->p2p, &params);
        params.persistent_group = persistent_group;