diff options
author | Thomas Pedersen <c_tpeder@qca.qualcomm.com> | 2012-06-25 14:45:14 +0300 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2012-06-25 14:45:14 +0300 |
commit | 1b487b8b1e95e1fbd9e00d52d883ba0ac4c2e4bf (patch) | |
tree | 9b8ebae95234d64e861736aec269b67abafa28e2 /src/ap | |
parent | e7381b8473e7fb43c0e13f45c1c61e64d64072c2 (diff) | |
download | external_wpa_supplicant_8_ti-1b487b8b1e95e1fbd9e00d52d883ba0ac4c2e4bf.zip external_wpa_supplicant_8_ti-1b487b8b1e95e1fbd9e00d52d883ba0ac4c2e4bf.tar.gz external_wpa_supplicant_8_ti-1b487b8b1e95e1fbd9e00d52d883ba0ac4c2e4bf.tar.bz2 |
nl80211: Handle CH_SWITCH event
Some drivers may independently decide to switch channels. Handle this by
updating the hostapd and wpa_supplicant AP and GO configuration.
Signed-hostap: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Diffstat (limited to 'src/ap')
-rw-r--r-- | src/ap/drv_callbacks.c | 33 | ||||
-rw-r--r-- | src/ap/hostapd.h | 2 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 4c0d0ab..7c2e87e 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -26,6 +26,7 @@ #include "wps_hostapd.h" #include "ap_drv_ops.h" #include "ap_config.h" +#include "hw_features.h" int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, @@ -273,6 +274,31 @@ void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr) } +void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht, + int offset) +{ + int channel; + + hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, + HOSTAPD_LEVEL_INFO, "driver had channel switch: " + "freq=%d, ht=%d, offset=%d", freq, ht, offset); + + hapd->iface->freq = freq; + + channel = hostapd_hw_get_channel(hapd, freq); + if (!channel) { + hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, + HOSTAPD_LEVEL_WARNING, "driver switched to " + "bad channel!"); + return; + } + + hapd->iconf->channel = channel; + hapd->iconf->ieee80211n = ht; + hapd->iconf->secondary_channel = offset; +} + + int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da, const u8 *bssid, const u8 *ie, size_t ie_len, int ssi_signal) @@ -590,6 +616,13 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, hostapd_rx_action(hapd, &data->rx_action); break; #endif /* NEED_AP_MLME */ + case EVENT_CH_SWITCH: + if (!data) + break; + hostapd_event_ch_switch(hapd, data->ch_switch.freq, + data->ch_switch.ht_enabled, + data->ch_switch.ch_offset); + break; default: wpa_printf(MSG_DEBUG, "Unknown event %d", event); break; diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 4e45d59..f7ed311 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -283,5 +283,7 @@ void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr); int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da, const u8 *bssid, const u8 *ie, size_t ie_len, int ssi_signal); +void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht, + int offset); #endif /* HOSTAPD_H */ |