]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Validate GO operating channel on channel list changes
authorEdhar, Mahesh Kumar <c_medhar@qti.qualcomm.com>
Mon, 5 May 2014 06:33:21 +0000 (12:03 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 12 May 2014 16:43:59 +0000 (19:43 +0300)
On receiving CHANNEL_LIST_CHANGED event from driver, verify that local
GO (if any) is operating in valid frequency. If not, we should remove
the group and reform on valid frequency. Indicate this similarly to the
avoid-frequency notification (i.e., a control interface message for
upper layers to react to this for now; potentially CSA later).

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

index 499b815ec4c219ca412d73187ad67285d45513a1..cd1ff12456c37e88577956f8412fc95b82e7dc11 100644 (file)
@@ -6413,6 +6413,7 @@ void wpas_p2p_pbc_overlap_cb(void *eloop_ctx, void *timeout_ctx)
 void wpas_p2p_update_channel_list(struct wpa_supplicant *wpa_s)
 {
        struct p2p_channels chan, cli_chan;
+       struct wpa_supplicant *ifs;
 
        if (wpa_s->global == NULL || wpa_s->global->p2p == NULL)
                return;
@@ -6426,6 +6427,28 @@ void wpas_p2p_update_channel_list(struct wpa_supplicant *wpa_s)
        }
 
        p2p_update_channel_list(wpa_s->global->p2p, &chan, &cli_chan);
+
+       for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) {
+               int freq;
+               if (!ifs->current_ssid ||
+                   !ifs->current_ssid->p2p_group ||
+                   (ifs->current_ssid->mode != WPAS_MODE_P2P_GO &&
+                    ifs->current_ssid->mode != WPAS_MODE_P2P_GROUP_FORMATION))
+                               continue;
+               freq = ifs->current_ssid->frequency;
+               if (freq_included(&chan, freq)) {
+                       wpa_dbg(ifs, MSG_DEBUG,
+                               "P2P GO operating frequency %d MHz in valid range",
+                               freq);
+                       continue;
+               }
+
+               wpa_dbg(ifs, MSG_DEBUG,
+                       "P2P GO operating in invalid frequency %d MHz", freq);
+               /* TODO: Consider using CSA or removing the group within
+                * wpa_supplicant */
+               wpa_msg(ifs, MSG_INFO, P2P_EVENT_REMOVE_AND_REFORM_GROUP);
+       }
 }