WNM: Differentiate between WNM for station and for AP in build

Previously, CONFIG_WNM enabled build that supports WNM for both
station mode and AP mode. However, in most wpa_supplicant cases only
station mode WNM is required and there is no need for AP mode WNM.

Add support to differentiate between station mode WNM and AP mode
WNM in wpa_supplicant builds by adding CONFIG_WNM_AP that should be
used when AP mode WNM support is required in addition to station mode
WNM. This allows binary size to be reduced for builds that require
only the station side WNM functionality.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
This commit is contained in:
Avraham Stern 2017-06-12 09:29:27 +03:00 committed by Jouni Malinen
parent 922dcf1b45
commit b5bf84ba39
11 changed files with 26 additions and 24 deletions

View file

@ -288,7 +288,7 @@ endif
endif endif
ifdef CONFIG_WNM ifdef CONFIG_WNM
L_CFLAGS += -DCONFIG_WNM L_CFLAGS += -DCONFIG_WNM -DCONFIG_WNM_AP
OBJS += src/ap/wnm_ap.c OBJS += src/ap/wnm_ap.c
endif endif

View file

@ -332,7 +332,7 @@ endif
endif endif
ifdef CONFIG_WNM ifdef CONFIG_WNM
CFLAGS += -DCONFIG_WNM CFLAGS += -DCONFIG_WNM -DCONFIG_WNM_AP
OBJS += ../src/ap/wnm_ap.o OBJS += ../src/ap/wnm_ap.o
endif endif

View file

@ -3258,12 +3258,12 @@ static int hostapd_config_fill(struct hostapd_config *conf,
bss->time_zone = os_strdup(pos); bss->time_zone = os_strdup(pos);
if (bss->time_zone == NULL) if (bss->time_zone == NULL)
return 1; return 1;
#ifdef CONFIG_WNM #ifdef CONFIG_WNM_AP
} else if (os_strcmp(buf, "wnm_sleep_mode") == 0) { } else if (os_strcmp(buf, "wnm_sleep_mode") == 0) {
bss->wnm_sleep_mode = atoi(pos); bss->wnm_sleep_mode = atoi(pos);
} else if (os_strcmp(buf, "bss_transition") == 0) { } else if (os_strcmp(buf, "bss_transition") == 0) {
bss->bss_transition = atoi(pos); bss->bss_transition = atoi(pos);
#endif /* CONFIG_WNM */ #endif /* CONFIG_WNM_AP */
#ifdef CONFIG_INTERWORKING #ifdef CONFIG_INTERWORKING
} else if (os_strcmp(buf, "interworking") == 0) { } else if (os_strcmp(buf, "interworking") == 0) {
bss->interworking = atoi(pos); bss->interworking = atoi(pos);

View file

@ -764,7 +764,7 @@ static int hostapd_ctrl_iface_send_qos_map_conf(struct hostapd_data *hapd,
#endif /* CONFIG_INTERWORKING */ #endif /* CONFIG_INTERWORKING */
#ifdef CONFIG_WNM #ifdef CONFIG_WNM_AP
static int hostapd_ctrl_iface_disassoc_imminent(struct hostapd_data *hapd, static int hostapd_ctrl_iface_disassoc_imminent(struct hostapd_data *hapd,
const char *cmd) const char *cmd)
@ -988,7 +988,7 @@ fail:
return ret; return ret;
} }
#endif /* CONFIG_WNM */ #endif /* CONFIG_WNM_AP */
static int hostapd_ctrl_iface_get_key_mgmt(struct hostapd_data *hapd, static int hostapd_ctrl_iface_get_key_mgmt(struct hostapd_data *hapd,
@ -2538,7 +2538,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
if (hostapd_ctrl_iface_hs20_deauth_req(hapd, buf + 16)) if (hostapd_ctrl_iface_hs20_deauth_req(hapd, buf + 16))
reply_len = -1; reply_len = -1;
#endif /* CONFIG_HS20 */ #endif /* CONFIG_HS20 */
#ifdef CONFIG_WNM #ifdef CONFIG_WNM_AP
} else if (os_strncmp(buf, "DISASSOC_IMMINENT ", 18) == 0) { } else if (os_strncmp(buf, "DISASSOC_IMMINENT ", 18) == 0) {
if (hostapd_ctrl_iface_disassoc_imminent(hapd, buf + 18)) if (hostapd_ctrl_iface_disassoc_imminent(hapd, buf + 18))
reply_len = -1; reply_len = -1;
@ -2548,7 +2548,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
} else if (os_strncmp(buf, "BSS_TM_REQ ", 11) == 0) { } else if (os_strncmp(buf, "BSS_TM_REQ ", 11) == 0) {
if (hostapd_ctrl_iface_bss_tm_req(hapd, buf + 11)) if (hostapd_ctrl_iface_bss_tm_req(hapd, buf + 11))
reply_len = -1; reply_len = -1;
#endif /* CONFIG_WNM */ #endif /* CONFIG_WNM_AP */
} else if (os_strcmp(buf, "GET_CONFIG") == 0) { } else if (os_strcmp(buf, "GET_CONFIG") == 0) {
reply_len = hostapd_ctrl_iface_get_config(hapd, reply, reply_len = hostapd_ctrl_iface_get_config(hapd, reply,
reply_size); reply_size);

View file

@ -981,11 +981,11 @@ static void hostapd_action_rx(struct hostapd_data *hapd,
mgmt->u.action.u.sa_query_resp.trans_id); mgmt->u.action.u.sa_query_resp.trans_id);
} }
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_WNM #ifdef CONFIG_WNM_AP
if (mgmt->u.action.category == WLAN_ACTION_WNM) { if (mgmt->u.action.category == WLAN_ACTION_WNM) {
ieee802_11_rx_wnm_action_ap(hapd, mgmt, drv_mgmt->frame_len); ieee802_11_rx_wnm_action_ap(hapd, mgmt, drv_mgmt->frame_len);
} }
#endif /* CONFIG_WNM */ #endif /* CONFIG_WNM_AP */
#ifdef CONFIG_FST #ifdef CONFIG_FST
if (mgmt->u.action.category == WLAN_ACTION_FST && hapd->iface->fst) { if (mgmt->u.action.category == WLAN_ACTION_FST && hapd->iface->fst) {
fst_rx_action(hapd->iface->fst, mgmt, drv_mgmt->frame_len); fst_rx_action(hapd->iface->fst, mgmt, drv_mgmt->frame_len);

View file

@ -3458,11 +3458,11 @@ static int handle_action(struct hostapd_data *hapd,
case WLAN_ACTION_SA_QUERY: case WLAN_ACTION_SA_QUERY:
return hostapd_sa_query_action(hapd, mgmt, len); return hostapd_sa_query_action(hapd, mgmt, len);
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_WNM #ifdef CONFIG_WNM_AP
case WLAN_ACTION_WNM: case WLAN_ACTION_WNM:
ieee802_11_rx_wnm_action_ap(hapd, mgmt, len); ieee802_11_rx_wnm_action_ap(hapd, mgmt, len);
return 1; return 1;
#endif /* CONFIG_WNM */ #endif /* CONFIG_WNM_AP */
#ifdef CONFIG_FST #ifdef CONFIG_FST
case WLAN_ACTION_FST: case WLAN_ACTION_FST:
if (hapd->iface->fst) if (hapd->iface->fst)

View file

@ -186,9 +186,9 @@ static void hostapd_ext_capab_byte(struct hostapd_data *hapd, u8 *pos, int idx)
*pos |= 0x08; /* Bit 19 - BSS Transition */ *pos |= 0x08; /* Bit 19 - BSS Transition */
break; break;
case 3: /* Bits 24-31 */ case 3: /* Bits 24-31 */
#ifdef CONFIG_WNM #ifdef CONFIG_WNM_AP
*pos |= 0x02; /* Bit 25 - SSID List */ *pos |= 0x02; /* Bit 25 - SSID List */
#endif /* CONFIG_WNM */ #endif /* CONFIG_WNM_AP */
if (hapd->conf->time_advertisement == 2) if (hapd->conf->time_advertisement == 2)
*pos |= 0x08; /* Bit 27 - UTC TSF Offset */ *pos |= 0x08; /* Bit 27 - UTC TSF Offset */
if (hapd->conf->interworking) if (hapd->conf->interworking)
@ -254,10 +254,10 @@ u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid)
if (len < 9 && if (len < 9 &&
(hapd->conf->ftm_initiator || hapd->conf->ftm_responder)) (hapd->conf->ftm_initiator || hapd->conf->ftm_responder))
len = 9; len = 9;
#ifdef CONFIG_WNM #ifdef CONFIG_WNM_AP
if (len < 4) if (len < 4)
len = 4; len = 4;
#endif /* CONFIG_WNM */ #endif /* CONFIG_WNM_AP */
#ifdef CONFIG_HS20 #ifdef CONFIG_HS20
if (hapd->conf->hs20 && len < 6) if (hapd->conf->hs20 && len < 6)
len = 6; len = 6;
@ -516,7 +516,7 @@ u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid)
{ {
u8 *pos = eid; u8 *pos = eid;
#ifdef CONFIG_WNM #ifdef CONFIG_WNM_AP
if (hapd->conf->ap_max_inactivity > 0) { if (hapd->conf->ap_max_inactivity > 0) {
unsigned int val; unsigned int val;
*pos++ = WLAN_EID_BSS_MAX_IDLE_PERIOD; *pos++ = WLAN_EID_BSS_MAX_IDLE_PERIOD;
@ -534,7 +534,7 @@ u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid)
pos += 2; pos += 2;
*pos++ = 0x00; /* TODO: Protected Keep-Alive Required */ *pos++ = 0x00; /* TODO: Protected Keep-Alive Required */
} }
#endif /* CONFIG_WNM */ #endif /* CONFIG_WNM_AP */
return pos; return pos;
} }

View file

@ -617,7 +617,7 @@ void ap_sta_no_session_timeout(struct hostapd_data *hapd, struct sta_info *sta)
static void ap_handle_session_warning_timer(void *eloop_ctx, void *timeout_ctx) static void ap_handle_session_warning_timer(void *eloop_ctx, void *timeout_ctx)
{ {
#ifdef CONFIG_WNM #ifdef CONFIG_WNM_AP
struct hostapd_data *hapd = eloop_ctx; struct hostapd_data *hapd = eloop_ctx;
struct sta_info *sta = timeout_ctx; struct sta_info *sta = timeout_ctx;
@ -628,7 +628,7 @@ static void ap_handle_session_warning_timer(void *eloop_ctx, void *timeout_ctx)
wnm_send_ess_disassoc_imminent(hapd, sta, sta->hs20_session_info_url, wnm_send_ess_disassoc_imminent(hapd, sta, sta->hs20_session_info_url,
sta->hs20_disassoc_timer); sta->hs20_disassoc_timer);
#endif /* CONFIG_WNM */ #endif /* CONFIG_WNM_AP */
} }

View file

@ -3445,7 +3445,7 @@ static int wpa_group_update_sta(struct wpa_state_machine *sm, void *ctx)
} }
#ifdef CONFIG_WNM #ifdef CONFIG_WNM_AP
/* update GTK when exiting WNM-Sleep Mode */ /* update GTK when exiting WNM-Sleep Mode */
void wpa_wnmsleep_rekey_gtk(struct wpa_state_machine *sm) void wpa_wnmsleep_rekey_gtk(struct wpa_state_machine *sm)
{ {
@ -3524,7 +3524,7 @@ int wpa_wnmsleep_igtk_subelem(struct wpa_state_machine *sm, u8 *pos)
return pos - start; return pos - start;
} }
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
#endif /* CONFIG_WNM */ #endif /* CONFIG_WNM_AP */
static void wpa_group_setkeys(struct wpa_authenticator *wpa_auth, static void wpa_group_setkeys(struct wpa_authenticator *wpa_auth,

View file

@ -858,7 +858,8 @@ ifdef CONFIG_IEEE80211AX
OBJS += src/ap/ieee802_11_he.c OBJS += src/ap/ieee802_11_he.c
endif endif
endif endif
ifdef CONFIG_WNM ifdef CONFIG_WNM_AP
L_CFLAGS += -DCONFIG_WNM_AP
OBJS += src/ap/wnm_ap.c OBJS += src/ap/wnm_ap.c
endif endif
ifdef CONFIG_MBO ifdef CONFIG_MBO

View file

@ -900,7 +900,8 @@ ifdef CONFIG_IEEE80211AX
OBJS += ../src/ap/ieee802_11_he.o OBJS += ../src/ap/ieee802_11_he.o
endif endif
endif endif
ifdef CONFIG_WNM ifdef CONFIG_WNM_AP
CFLAGS += -DCONFIG_WNM_AP
OBJS += ../src/ap/wnm_ap.o OBJS += ../src/ap/wnm_ap.o
endif endif
ifdef CONFIG_MBO ifdef CONFIG_MBO