diff options
author | Jouni Malinen <j@w1.fi> | 2009-12-13 11:35:39 +0200 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2009-12-13 11:35:39 +0200 |
commit | 0de39516aeb185d54cd755e366dde2f2cc149e50 (patch) | |
tree | aed324356d8cd50d834878f20cfcb722cf7c80b5 /hostapd | |
parent | a34325dde9d88ec379f5b2c960ad1ef9182a2f33 (diff) | |
download | external_wpa_supplicant_8_ti-0de39516aeb185d54cd755e366dde2f2cc149e50.zip external_wpa_supplicant_8_ti-0de39516aeb185d54cd755e366dde2f2cc149e50.tar.gz external_wpa_supplicant_8_ti-0de39516aeb185d54cd755e366dde2f2cc149e50.tar.bz2 |
Map STA flags into values defined in driver.h
This removes need for including hostapd/sta_flags.h into driver
wrappers and removes any remaining dependencies between driver flags
and internal hostapd flags.
Diffstat (limited to 'hostapd')
-rw-r--r-- | hostapd/hostapd.c | 15 | ||||
-rw-r--r-- | hostapd/hostapd.h | 1 | ||||
-rw-r--r-- | hostapd/ieee802_11.c | 13 | ||||
-rw-r--r-- | hostapd/ieee802_1x.c | 12 |
4 files changed, 31 insertions, 10 deletions
diff --git a/hostapd/hostapd.c b/hostapd/hostapd.c index d969255..65886e1 100644 --- a/hostapd/hostapd.c +++ b/hostapd/hostapd.c @@ -1507,3 +1507,18 @@ int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname, } return hostapd_set_ieee8021x(hapd, ¶ms); } + + +int hostapd_sta_flags_to_drv(int flags) +{ + int res = 0; + if (flags & WLAN_STA_AUTHORIZED) + res |= WPA_STA_AUTHORIZED; + if (flags & WLAN_STA_WMM) + res |= WPA_STA_WMM; + if (flags & WLAN_STA_SHORT_PREAMBLE) + res |= WPA_STA_SHORT_PREAMBLE; + if (flags & WLAN_STA_MFP) + res |= WPA_STA_MFP; + return res; +} diff --git a/hostapd/hostapd.h b/hostapd/hostapd.h index 52a46d5..e6d564c 100644 --- a/hostapd/hostapd.h +++ b/hostapd/hostapd.h @@ -189,6 +189,7 @@ int hostapd_register_probereq_cb(struct hostapd_data *hapd, void *ctx); int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname, int enabled); +int hostapd_sta_flags_to_drv(int flags); int eap_server_register_methods(void); diff --git a/hostapd/ieee802_11.c b/hostapd/ieee802_11.c index f7d58bb..b8d0443 100644 --- a/hostapd/ieee802_11.c +++ b/hostapd/ieee802_11.c @@ -1466,7 +1466,7 @@ static void handle_assoc_cb(struct hostapd_data *hapd, struct sta_info *sta; int new_assoc = 1; struct ieee80211_ht_capabilities ht_cap; - int set_flags, flags_and, flags_or; + int set_flags, total_flags, flags_and, flags_or; if (!ok) { hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211, @@ -1559,13 +1559,14 @@ static void handle_assoc_cb(struct hostapd_data *hapd, ap_sta_bind_vlan(hapd, sta, 0); } - set_flags = WLAN_STA_SHORT_PREAMBLE | WLAN_STA_WMM | WLAN_STA_MFP; + total_flags = hostapd_sta_flags_to_drv(sta->flags); + set_flags = WPA_STA_SHORT_PREAMBLE | WPA_STA_WMM | WPA_STA_MFP; if (!hapd->conf->ieee802_1x && !hapd->conf->wpa && sta->flags & WLAN_STA_AUTHORIZED) - set_flags |= WLAN_STA_AUTHORIZED; - flags_or = sta->flags & set_flags; - flags_and = sta->flags | ~set_flags; - hostapd_sta_set_flags(hapd, sta->addr, sta->flags, + set_flags |= WPA_STA_AUTHORIZED; + flags_or = total_flags & set_flags; + flags_and = total_flags | ~set_flags; + hostapd_sta_set_flags(hapd, sta->addr, total_flags, flags_or, flags_and); if (sta->auth_alg == WLAN_AUTH_FT) diff --git a/hostapd/ieee802_1x.c b/hostapd/ieee802_1x.c index 322026c..d0f077f 100644 --- a/hostapd/ieee802_1x.c +++ b/hostapd/ieee802_1x.c @@ -91,8 +91,10 @@ void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd, wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr)); sta->flags |= WLAN_STA_AUTHORIZED; - res = hostapd_sta_set_flags(hapd, sta->addr, sta->flags, - WLAN_STA_AUTHORIZED, ~0); + res = hostapd_sta_set_flags(hapd, sta->addr, + hostapd_sta_flags_to_drv( + sta->flags), + WPA_STA_AUTHORIZED, ~0); hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X, HOSTAPD_LEVEL_DEBUG, "authorizing port"); } else { @@ -102,8 +104,10 @@ void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd, AP_STA_DISCONNECTED MACSTR, MAC2STR(sta->addr)); sta->flags &= ~WLAN_STA_AUTHORIZED; - res = hostapd_sta_set_flags(hapd, sta->addr, sta->flags, - 0, ~WLAN_STA_AUTHORIZED); + res = hostapd_sta_set_flags(hapd, sta->addr, + hostapd_sta_flags_to_drv( + sta->flags), + 0, ~WPA_STA_AUTHORIZED); hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X, HOSTAPD_LEVEL_DEBUG, "unauthorizing port"); } |