This patch activates the functionality of the previous patches by handling the actual events that will trigger the CAC process. Signed-off-by: John Crispin <john@xxxxxxxxxxx> --- src/ap/drv_callbacks.c | 42 +++++++++++++++++++- src/drivers/driver.h | 27 +++++++++++++ src/drivers/driver_common.c | 4 ++ src/drivers/driver_nl80211_event.c | 64 ++++++++++++++++++++++++++++++ 4 files changed, 136 insertions(+), 1 deletion(-) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 173549e7b..06cf8545d 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -43,7 +43,6 @@ #include "fils_hlp.h" #include "neighbor_db.h" - #ifdef CONFIG_FILS void hostapd_notify_assoc_fils_finish(struct hostapd_data *hapd, struct sta_info *sta) @@ -1722,6 +1721,36 @@ static void hostapd_event_wds_sta_interface_status(struct hostapd_data *hapd, } +#ifdef CONFIG_IEEE80211AX +static void hostapd_event_bss_color_collision(struct hostapd_data *hapd, + u64 bitmap) +{ + wpa_printf(MSG_DEBUG, "BSS color collision on %s", hapd->conf->iface); + hostapd_switch_color(hapd, bitmap); +} + +static void hostapd_event_cca(struct hostapd_data *hapd, enum wpa_event_type event) +{ + switch (event) { + case EVENT_CCA_STARTED_NOTIFY: + wpa_printf(MSG_DEBUG, "CCA started on on %s", hapd->conf->iface); + break; + case EVENT_CCA_NOTIFY: + wpa_printf(MSG_DEBUG, "CCA finished on on %s", hapd->conf->iface); + hapd->conf->he_op.he_bss_color = hapd->cca_color; + hostapd_cleanup_cca_params(hapd); + break; + case EVENT_CCA_ABORTED_NOTIFY: + wpa_printf(MSG_DEBUG, "CCA aborted on on %s", hapd->conf->iface); + hostapd_cleanup_cca_params(hapd); + break; + default: + break; + } +} +#endif + + #ifdef CONFIG_OWE static int hostapd_notif_update_dh_ie(struct hostapd_data *hapd, const u8 *peer, const u8 *ie, @@ -2028,6 +2057,17 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, data->wds_sta_interface.ifname, data->wds_sta_interface.sta_addr); break; +#ifdef CONFIG_IEEE80211AX + case EVENT_BSS_COLOR_COLLISION: + hostapd_event_bss_color_collision(hapd, + data->bss_color_collision.bitmap); + break; + case EVENT_CCA_STARTED_NOTIFY: + case EVENT_CCA_ABORTED_NOTIFY: + case EVENT_CCA_NOTIFY: + hostapd_event_cca(hapd, event); + break; +#endif default: wpa_printf(MSG_DEBUG, "Unknown event %d", event); break; diff --git a/src/drivers/driver.h b/src/drivers/driver.h index b5a8a64c3..443286bd8 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -5044,6 +5044,26 @@ enum wpa_event_type { * is required to provide more details of the frame. */ EVENT_UNPROT_BEACON, + + /** + * EVENT_BSS_COLOR_COLLISION - Notification of a BSS color collision + */ + EVENT_BSS_COLOR_COLLISION, + + /** + * EVENT_CCA_STARTED_NOTIFY - Notification that CCA has started + */ + EVENT_CCA_STARTED_NOTIFY, + + /** + * EVENT_CCA_ABORTED_NOTIFY - Notification that CCA has aborted + */ + EVENT_CCA_ABORTED_NOTIFY, + + /** + * EVENT_CCA_NOTIFY - Notification that CCA has completed + */ + EVENT_CCA_NOTIFY, }; @@ -5903,6 +5923,13 @@ union wpa_event_data { struct unprot_beacon { const u8 *sa; } unprot_beacon; + + /** + * struct bss_color_collision - Data for EVENT_BSS_COLOR_COLLISION + */ + struct bss_color_collision { + u64 bitmap; + } bss_color_collision; }; /** diff --git a/src/drivers/driver_common.c b/src/drivers/driver_common.c index 23a6a4293..3d7d1540d 100644 --- a/src/drivers/driver_common.c +++ b/src/drivers/driver_common.c @@ -90,6 +90,10 @@ const char * event_to_string(enum wpa_event_type event) E2S(WDS_STA_INTERFACE_STATUS); E2S(UPDATE_DH); E2S(UNPROT_BEACON); + E2S(BSS_COLOR_COLLISION); + E2S(CCA_STARTED_NOTIFY); + E2S(CCA_ABORTED_NOTIFY); + E2S(CCA_NOTIFY); } return "UNKNOWN"; diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index 6a2de1f3c..634d405cb 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -138,6 +138,10 @@ static const char * nl80211_command_to_string(enum nl80211_commands cmd) C2S(NL80211_CMD_CONTROL_PORT_FRAME) C2S(NL80211_CMD_UPDATE_OWE_INFO) C2S(NL80211_CMD_UNPROT_BEACON) + C2S(NL80211_CMD_OBSS_COLOR_COLLISION) + C2S(NL80211_CMD_CCA_STARTED_NOTIFY) + C2S(NL80211_CMD_CCA_ABORTED_NOTIFY) + C2S(NL80211_CMD_CCA_NOTIFY) default: return "NL80211_CMD_UNKNOWN"; } @@ -2557,6 +2561,52 @@ static void nl80211_control_port_frame(struct wpa_driver_nl80211_data *drv, } +#ifdef CONFIG_IEEE80211AX +static void mlme_event_obss_color_collision(struct wpa_driver_nl80211_data *drv, + struct nlattr *tb[]) +{ + union wpa_event_data data; + + if (!tb[NL80211_ATTR_OBSS_COLOR_BITMAP]) + return; + + os_memset(&data, 0, sizeof(data)); + data.bss_color_collision.bitmap = nla_get_u64(tb[NL80211_ATTR_OBSS_COLOR_BITMAP]); + + wpa_printf(MSG_DEBUG, "nl80211: BSS color collision - bitmap %08lx", + data.bss_color_collision.bitmap); + + wpa_supplicant_event(drv->ctx, EVENT_BSS_COLOR_COLLISION, &data); +} + +static void mlme_event_cca_started_notify(struct wpa_driver_nl80211_data *drv) +{ + union wpa_event_data data = {}; + + wpa_printf(MSG_DEBUG, "nl80211: CCA started"); + + wpa_supplicant_event(drv->ctx, EVENT_CCA_STARTED_NOTIFY, &data); +} + +static void mlme_event_cca_aborted_notify(struct wpa_driver_nl80211_data *drv) +{ + union wpa_event_data data = {}; + + wpa_printf(MSG_DEBUG, "nl80211: CCA aborted"); + + wpa_supplicant_event(drv->ctx, EVENT_CCA_ABORTED_NOTIFY, &data); +} + +static void mlme_event_cca_notify(struct wpa_driver_nl80211_data *drv) +{ + union wpa_event_data data = {}; + + wpa_printf(MSG_DEBUG, "nl80211: CCA completed"); + + wpa_supplicant_event(drv->ctx, EVENT_CCA_NOTIFY, &data); +} +#endif + static void do_process_drv_event(struct i802_bss *bss, int cmd, struct nlattr **tb) { @@ -2775,6 +2825,20 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd, mlme_event_unprot_beacon(drv, nla_data(frame), nla_len(frame)); break; +#ifdef CONFIG_IEEE80211AX + case NL80211_CMD_OBSS_COLOR_COLLISION: + mlme_event_obss_color_collision(drv, tb); + break; + case NL80211_CMD_CCA_STARTED_NOTIFY: + mlme_event_cca_started_notify(drv); + break; + case NL80211_CMD_CCA_ABORTED_NOTIFY: + mlme_event_cca_aborted_notify(drv); + break; + case NL80211_CMD_CCA_NOTIFY: + mlme_event_cca_notify(drv); + break; +#endif default: wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event " "(cmd=%d)", cmd); -- 2.25.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap