diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index f2c60e7fd..5950207b9 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -26,6 +26,7 @@ #include "ap/ieee802_1x.h" #include "ap/wps_hostapd.h" #include "ap/ctrl_iface_ap.h" +#include "ap/dfs.h" #include "wps/wps.h" #include "common/ieee802_11_defs.h" #include "config_ssid.h" @@ -1260,3 +1261,66 @@ int wpas_ap_stop_ap(struct wpa_supplicant *wpa_s) hapd = wpa_s->ap_iface->bss[0]; return hostapd_ctrl_iface_stop_ap(hapd); } + + +#ifdef NEED_AP_MLME +void wpas_event_dfs_radar_detected(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) +{ + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) + return; + wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq); + hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq, + radar->ht_enabled, radar->chan_offset, + radar->chan_width, + radar->cf1, radar->cf2); +} + + +void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) +{ + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) + return; + wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq); + hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq, + radar->ht_enabled, radar->chan_offset, + radar->chan_width, radar->cf1, radar->cf2); +} + + +void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) +{ + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) + return; + wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq); + hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq, + radar->ht_enabled, radar->chan_offset, + radar->chan_width, radar->cf1, radar->cf2); +} + + +void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) +{ + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) + return; + wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq); + hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq, + radar->ht_enabled, radar->chan_offset, + radar->chan_width, radar->cf1, radar->cf2); +} + + +void wpas_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) +{ + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) + return; + wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq); + hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq, + radar->ht_enabled, radar->chan_offset, + radar->chan_width, radar->cf1, radar->cf2); +} +#endif /* NEED_AP_MLME */ diff --git a/wpa_supplicant/ap.h b/wpa_supplicant/ap.h index 6a1183424..3f4151d8c 100644 --- a/wpa_supplicant/ap.h +++ b/wpa_supplicant/ap.h @@ -82,4 +82,15 @@ void wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, int wpas_ap_stop_ap(struct wpa_supplicant *wpa_s); +void wpas_event_dfs_radar_detected(struct wpa_supplicant *wpa_s, + struct dfs_event *radar); +void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s, + struct dfs_event *radar); +void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, + struct dfs_event *radar); +void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, + struct dfs_event *radar); +void wpas_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s, + struct dfs_event *radar); + #endif /* AP_H */ diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 9de8f7abf..a368c6de0 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -3303,6 +3303,29 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, data->ch_switch.cf1, data->ch_switch.cf2); break; +#ifdef NEED_AP_MLME + case EVENT_DFS_RADAR_DETECTED: + if (data) + wpas_event_dfs_radar_detected(wpa_s, &data->dfs_event); + break; + case EVENT_DFS_CAC_STARTED: + if (data) + wpas_event_dfs_cac_started(wpa_s, &data->dfs_event); + break; + case EVENT_DFS_CAC_FINISHED: + if (data) + wpas_event_dfs_cac_finished(wpa_s, &data->dfs_event); + break; + case EVENT_DFS_CAC_ABORTED: + if (data) + wpas_event_dfs_cac_aborted(wpa_s, &data->dfs_event); + break; + case EVENT_DFS_NOP_FINISHED: + if (data) + wpas_event_dfs_cac_nop_finished(wpa_s, + &data->dfs_event); + break; +#endif /* NEED_AP_MLME */ #endif /* CONFIG_AP */ case EVENT_RX_MGMT: { u16 fc, stype;