From: Edhar, Mahesh Kumar Date: Mon, 5 May 2014 06:33:21 +0000 (+0530) Subject: P2P: Validate GO operating channel on channel list changes X-Git-Tag: hostap_2_2~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b42862ac87f333b0efb0f0bae822dcdf606bc69;p=thirdparty%2Fhostap.git P2P: Validate GO operating channel on channel list changes 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 --- diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 499b815ec..cd1ff1245 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -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); + } }