From ad3872a3720df13d8fc1a4345a5f0a8c3a204b4e Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 16 Dec 2012 18:22:54 +0200 Subject: [PATCH] WNM: Use CONFIG_WNM more consistently Replace CONFIG_IEEE80211V with CONFIG_WNM to get more consistent build options for WNM-Sleep Mode operations. Previously it was possible to define CONFIG_IEEE80211V without CONFIG_WNM which would break the build. In addition, IEEE 802.11v has been merged into IEEE Std 802.11-2012 and WNM is a better term to use for this new functionality anyway. Signed-hostap: Jouni Malinen --- hostapd/Makefile | 8 ++------ src/ap/drv_callbacks.c | 4 ++-- src/ap/wnm_ap.c | 3 --- src/ap/wpa_auth.c | 10 ++++------ src/ap/wpa_auth.h | 4 ---- src/ap/wpa_auth_i.h | 2 -- src/drivers/driver_atheros.c | 22 +++++++++++----------- src/rsn_supp/wpa.c | 4 ++-- src/rsn_supp/wpa.h | 2 -- wpa_supplicant/Makefile | 8 ++------ wpa_supplicant/events.c | 12 ++++++------ wpa_supplicant/wnm_sta.c | 3 --- 12 files changed, 29 insertions(+), 53 deletions(-) diff --git a/hostapd/Makefile b/hostapd/Makefile index 4cc38059b..d8c01e52e 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile @@ -176,8 +176,8 @@ ifdef CONFIG_SAE CFLAGS += -DCONFIG_SAE endif -ifdef CONFIG_IEEE80211V -CFLAGS += -DCONFIG_IEEE80211V +ifdef CONFIG_WNM +CFLAGS += -DCONFIG_WNM OBJS += ../src/ap/wnm_ap.o endif @@ -185,10 +185,6 @@ ifdef CONFIG_IEEE80211N CFLAGS += -DCONFIG_IEEE80211N endif -ifdef CONFIG_WNM -CFLAGS += -DCONFIG_WNM -endif - ifdef CONFIG_IEEE80211AC CFLAGS += -DCONFIG_IEEE80211AC endif diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 86139752f..8980bec03 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -512,13 +512,13 @@ static void hostapd_action_rx(struct hostapd_data *hapd, action->data + 2); } #endif /* CONFIG_IEEE80211W */ -#ifdef CONFIG_IEEE80211V +#ifdef CONFIG_WNM if (action->category == WLAN_ACTION_WNM) { wpa_printf(MSG_DEBUG, "%s: WNM_ACTION length %d", __func__, (int) action->len); ieee802_11_rx_wnm_action_ap(hapd, action); } -#endif /* CONFIG_IEEE80211V */ +#endif /* CONFIG_WNM */ } diff --git a/src/ap/wnm_ap.c b/src/ap/wnm_ap.c index 25944045f..01fe13554 100644 --- a/src/ap/wnm_ap.c +++ b/src/ap/wnm_ap.c @@ -19,7 +19,6 @@ #define MAX_TFS_IE_LEN 1024 -#ifdef CONFIG_IEEE80211V /* get the TFS IE from driver */ static int ieee80211_11_get_tfs_ie(struct hostapd_data *hapd, const u8 *addr, @@ -254,5 +253,3 @@ void ieee802_11_rx_wnm_action_ap(struct hostapd_data *hapd, break; } } - -#endif /* CONFIG_IEEE80211V */ diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index 0816b25b6..0dc3f58a5 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -2413,11 +2413,9 @@ static int wpa_group_update_sta(struct wpa_state_machine *sm, void *ctx) "marking station for GTK rekeying"); } -#ifdef CONFIG_IEEE80211V - /* Do not rekey GTK/IGTK when STA is in wnmsleep */ + /* Do not rekey GTK/IGTK when STA is in WNM-Sleep Mode */ if (sm->is_wnmsleep) return 0; -#endif /* CONFIG_IEEE80211V */ sm->group->GKeyDoneStations++; sm->GUpdateStationKeys = TRUE; @@ -2427,8 +2425,8 @@ static int wpa_group_update_sta(struct wpa_state_machine *sm, void *ctx) } -#ifdef CONFIG_IEEE80211V -/* update GTK when exiting wnmsleep mode */ +#ifdef CONFIG_WNM +/* update GTK when exiting WNM-Sleep Mode */ void wpa_wnmsleep_rekey_gtk(struct wpa_state_machine *sm) { if (sm->is_wnmsleep) @@ -2550,7 +2548,7 @@ int wpa_wnmsleep_igtk_subelem(struct wpa_state_machine *sm, u8 *pos) return subelem_len; } #endif /* CONFIG_IEEE80211W */ -#endif /* CONFIG_IEEE80211V */ +#endif /* CONFIG_WNM */ static void wpa_group_setkeys(struct wpa_authenticator *wpa_auth, diff --git a/src/ap/wpa_auth.h b/src/ap/wpa_auth.h index 6ab170d14..465eec6a5 100644 --- a/src/ap/wpa_auth.h +++ b/src/ap/wpa_auth.h @@ -282,14 +282,10 @@ int wpa_ft_rrb_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr, void wpa_ft_push_pmk_r1(struct wpa_authenticator *wpa_auth, const u8 *addr); #endif /* CONFIG_IEEE80211R */ -#ifdef CONFIG_IEEE80211V void wpa_wnmsleep_rekey_gtk(struct wpa_state_machine *sm); void wpa_set_wnmsleep(struct wpa_state_machine *sm, int flag); int wpa_wnmsleep_gtk_subelem(struct wpa_state_machine *sm, u8 *pos); -#ifdef CONFIG_IEEE80211W int wpa_wnmsleep_igtk_subelem(struct wpa_state_machine *sm, u8 *pos); -#endif /* CONFIG_IEEE80211W */ -#endif /* CONFIG_IEEE80211V */ int wpa_auth_uses_sae(struct wpa_state_machine *sm); diff --git a/src/ap/wpa_auth_i.h b/src/ap/wpa_auth_i.h index d5cf2c50e..97489d343 100644 --- a/src/ap/wpa_auth_i.h +++ b/src/ap/wpa_auth_i.h @@ -87,9 +87,7 @@ struct wpa_state_machine { unsigned int ft_completed:1; unsigned int pmk_r1_name_valid:1; #endif /* CONFIG_IEEE80211R */ -#ifdef CONFIG_IEEE80211V unsigned int is_wnmsleep:1; -#endif /* CONFIG_IEEE80211V */ u8 req_replay_counter[WPA_REPLAY_COUNTER_LEN]; int req_replay_counter_used; diff --git a/src/drivers/driver_atheros.c b/src/drivers/driver_atheros.c index a0a521027..8294e9ea9 100644 --- a/src/drivers/driver_atheros.c +++ b/src/drivers/driver_atheros.c @@ -874,7 +874,7 @@ static void atheros_raw_recv_hs20(void *ctx, const u8 *src_addr, const u8 *buf, } #endif /* CONFIG_HS20 */ -#if defined(CONFIG_IEEE80211V) && !defined(CONFIG_IEEE80211R) +#if defined(CONFIG_WNM) && !defined(CONFIG_IEEE80211R) static void atheros_raw_recv_11v(void *ctx, const u8 *src_addr, const u8 *buf, size_t len) { @@ -921,9 +921,9 @@ static void atheros_raw_recv_11v(void *ctx, const u8 *src_addr, const u8 *buf, break; } } -#endif /* CONFIG_IEEE80211V */ +#endif /* CONFIG_WNM */ -#if defined(CONFIG_WPS) || defined(CONFIG_IEEE80211R) || defined(CONFIG_IEEE80211V) +#if defined(CONFIG_WPS) || defined(CONFIG_IEEE80211R) || defined(CONFIG_WNM) static void atheros_raw_receive(void *ctx, const u8 *src_addr, const u8 *buf, size_t len) { @@ -933,9 +933,9 @@ static void atheros_raw_receive(void *ctx, const u8 *src_addr, const u8 *buf, #ifdef CONFIG_IEEE80211R atheros_raw_recv_11r(ctx, src_addr, buf, len); #endif /* CONFIG_IEEE80211R */ -#if defined(CONFIG_IEEE80211V) && !defined(CONFIG_IEEE80211R) +#if defined(CONFIG_WNM) && !defined(CONFIG_IEEE80211R) atheros_raw_recv_11v(ctx, src_addr, buf, len); -#endif /* CONFIG_IEEE80211V */ +#endif /* CONFIG_WNM */ #ifdef CONFIG_HS20 atheros_raw_recv_hs20(ctx, src_addr, buf, len); #endif /* CONFIG_HS20 */ @@ -957,9 +957,9 @@ static int atheros_receive_pkt(struct atheros_driver_data *drv) IEEE80211_FILTER_TYPE_AUTH | IEEE80211_FILTER_TYPE_ACTION); #endif -#ifdef CONFIG_IEEE80211V +#ifdef CONFIG_WNM filt.app_filterype |= IEEE80211_FILTER_TYPE_ACTION; -#endif /* CONFIG_IEEE80211V */ +#endif /* CONFIG_WNM */ #ifdef CONFIG_HS20 filt.app_filterype |= IEEE80211_FILTER_TYPE_ACTION; #endif /* CONFIG_HS20 */ @@ -1959,7 +1959,7 @@ static int atheros_send_action(void *priv, unsigned int freq, } -#ifdef CONFIG_IEEE80211V +#ifdef CONFIG_WNM static int athr_wnm_tfs(struct atheros_driver_data *drv, const u8* peer, u8 *ie, u16 *len, enum wnm_oper oper) { @@ -2112,7 +2112,7 @@ static int atheros_wnm_oper(void *priv, enum wnm_oper oper, const u8 *peer, return -1; } } -#endif /* CONFIG_IEEE80211V */ +#endif /* CONFIG_WNM */ const struct wpa_driver_ops wpa_driver_atheros_ops = { @@ -2146,7 +2146,7 @@ const struct wpa_driver_ops wpa_driver_atheros_ops = { .add_sta_node = atheros_add_sta_node, #endif /* CONFIG_IEEE80211R */ .send_action = atheros_send_action, -#ifdef CONFIG_IEEE80211V +#ifdef CONFIG_WNM .wnm_oper = atheros_wnm_oper, -#endif /* CONFIG_IEEE80211V */ +#endif /* CONFIG_WNM */ }; diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c index 5d1de4c39..e50404ce7 100644 --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c @@ -2627,7 +2627,7 @@ void wpa_sm_pmksa_cache_flush(struct wpa_sm *sm, void *network_ctx) } -#ifdef CONFIG_IEEE80211V +#ifdef CONFIG_WNM int wpa_wnmsleep_install_key(struct wpa_sm *sm, u8 subelem_id, u8 *buf) { struct wpa_gtk_data gd; @@ -2699,4 +2699,4 @@ int wpa_wnmsleep_install_key(struct wpa_sm *sm, u8 subelem_id, u8 *buf) return 0; } -#endif /* CONFIG_IEEE80211V */ +#endif /* CONFIG_WNM */ diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h index 8afdf39bf..791974c2b 100644 --- a/src/rsn_supp/wpa.h +++ b/src/rsn_supp/wpa.h @@ -365,8 +365,6 @@ void wpa_tdls_enable(struct wpa_sm *sm, int enabled); void wpa_tdls_disable_link(struct wpa_sm *sm, const u8 *addr); int wpa_tdls_is_external_setup(struct wpa_sm *sm); -#ifdef CONFIG_IEEE80211V int wpa_wnmsleep_install_key(struct wpa_sm *sm, u8 subelem_id, u8 *buf); -#endif /* CONFIG_IEEE80211V */ #endif /* WPA_H */ diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index b5aaaae5b..bafeccccc 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -176,8 +176,8 @@ ifdef CONFIG_SAE CFLAGS += -DCONFIG_SAE endif -ifdef CONFIG_IEEE80211V -CFLAGS += -DCONFIG_IEEE80211V +ifdef CONFIG_WNM +CFLAGS += -DCONFIG_WNM OBJS += wnm_sta.o endif @@ -758,10 +758,6 @@ OBJS += ../src/ap/hs20.o endif endif -ifdef CONFIG_WNM -CFLAGS += -DCONFIG_WNM -endif - ifdef NEED_RSN_AUTHENTICATOR CFLAGS += -DCONFIG_NO_RADIUS NEED_AES_WRAP=y diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 492674669..d9ed7a243 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2138,7 +2138,7 @@ static void wpa_supplicant_event_tdls(struct wpa_supplicant *wpa_s, #endif /* CONFIG_TDLS */ -#ifdef CONFIG_IEEE80211V +#ifdef CONFIG_WNM static void wpa_supplicant_event_wnm(struct wpa_supplicant *wpa_s, union wpa_event_data *data) { @@ -2154,7 +2154,7 @@ static void wpa_supplicant_event_wnm(struct wpa_supplicant *wpa_s, break; } } -#endif /* CONFIG_IEEE80211V */ +#endif /* CONFIG_WNM */ #ifdef CONFIG_IEEE80211R @@ -2507,11 +2507,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, wpa_supplicant_event_tdls(wpa_s, data); break; #endif /* CONFIG_TDLS */ -#ifdef CONFIG_IEEE80211V +#ifdef CONFIG_WNM case EVENT_WNM: wpa_supplicant_event_wnm(wpa_s, data); break; -#endif /* CONFIG_IEEE80211V */ +#endif /* CONFIG_WNM */ #ifdef CONFIG_IEEE80211R case EVENT_FT_RESPONSE: wpa_supplicant_event_ft_response(wpa_s, data); @@ -2709,12 +2709,12 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, } #endif /* CONFIG_SME */ #endif /* CONFIG_IEEE80211W */ -#ifdef CONFIG_IEEE80211V +#ifdef CONFIG_WNM if (data->rx_action.category == WLAN_ACTION_WNM) { ieee802_11_rx_wnm_action(wpa_s, &data->rx_action); break; } -#endif /* CONFIG_IEEE80211V */ +#endif /* CONFIG_WNM */ #ifdef CONFIG_GAS if (data->rx_action.category == WLAN_ACTION_PUBLIC && gas_query_rx(wpa_s->gas, data->rx_action.da, diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index 3a2c17eb8..35cd032b4 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -16,7 +16,6 @@ #define MAX_TFS_IE_LEN 1024 -#ifdef CONFIG_IEEE80211V /* get the TFS IE from driver */ static int ieee80211_11_get_tfs_ie(struct wpa_supplicant *wpa_s, u8 *buf, @@ -307,5 +306,3 @@ void ieee802_11_rx_wnm_action(struct wpa_supplicant *wpa_s, break; } } - -#endif /* CONFIG_IEEE80211V */