Allocate sta->ht_capabilities dynamically
This avoids need for conditional inclusion of header file into sta_info.h and cleans up the code a bit.
This commit is contained in:
parent
99d845a7ec
commit
df84268ae7
4 changed files with 25 additions and 13 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
#include "eap_server/eap.h"
|
#include "eap_server/eap.h"
|
||||||
#include "radius/radius_client.h"
|
#include "radius/radius_client.h"
|
||||||
|
#include "common/ieee802_11_defs.h"
|
||||||
#include "common/wpa_common.h"
|
#include "common/wpa_common.h"
|
||||||
#include "wpa.h"
|
#include "wpa.h"
|
||||||
#include "uuid.h"
|
#include "uuid.h"
|
||||||
|
|
|
@ -855,15 +855,28 @@ static void handle_assoc(struct hostapd_data *hapd,
|
||||||
|
|
||||||
#ifdef CONFIG_IEEE80211N
|
#ifdef CONFIG_IEEE80211N
|
||||||
/* save HT capabilities in the sta object */
|
/* save HT capabilities in the sta object */
|
||||||
os_memset(&sta->ht_capabilities, 0, sizeof(sta->ht_capabilities));
|
|
||||||
if (elems.ht_capabilities &&
|
if (elems.ht_capabilities &&
|
||||||
elems.ht_capabilities_len >=
|
elems.ht_capabilities_len >=
|
||||||
sizeof(struct ieee80211_ht_capabilities)) {
|
sizeof(struct ieee80211_ht_capabilities)) {
|
||||||
|
if (sta->ht_capabilities) {
|
||||||
|
os_memset(sta->ht_capabilities, 0,
|
||||||
|
sizeof(*sta->ht_capabilities));
|
||||||
|
} else {
|
||||||
|
sta->ht_capabilities =
|
||||||
|
os_zalloc(sizeof(*sta->ht_capabilities));
|
||||||
|
if (sta->ht_capabilities == NULL) {
|
||||||
|
resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
sta->flags |= WLAN_STA_HT;
|
sta->flags |= WLAN_STA_HT;
|
||||||
os_memcpy(&sta->ht_capabilities, elems.ht_capabilities,
|
os_memcpy(sta->ht_capabilities, elems.ht_capabilities,
|
||||||
sizeof(struct ieee80211_ht_capabilities));
|
sizeof(struct ieee80211_ht_capabilities));
|
||||||
} else
|
} else {
|
||||||
sta->flags &= ~WLAN_STA_HT;
|
sta->flags &= ~WLAN_STA_HT;
|
||||||
|
os_free(sta->ht_capabilities);
|
||||||
|
sta->ht_capabilities = NULL;
|
||||||
|
}
|
||||||
#endif /* CONFIG_IEEE80211N */
|
#endif /* CONFIG_IEEE80211N */
|
||||||
|
|
||||||
if ((hapd->conf->wpa & WPA_PROTO_RSN) && elems.rsn_ie) {
|
if ((hapd->conf->wpa & WPA_PROTO_RSN) && elems.rsn_ie) {
|
||||||
|
@ -1033,9 +1046,9 @@ static void handle_assoc(struct hostapd_data *hapd,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_IEEE80211N
|
#ifdef CONFIG_IEEE80211N
|
||||||
if (sta->flags & WLAN_STA_HT) {
|
if ((sta->flags & WLAN_STA_HT) && sta->ht_capabilities) {
|
||||||
u16 ht_capab = le_to_host16(
|
u16 ht_capab = le_to_host16(
|
||||||
sta->ht_capabilities.ht_capabilities_info);
|
sta->ht_capabilities->ht_capabilities_info);
|
||||||
wpa_printf(MSG_DEBUG, "HT: STA " MACSTR " HT Capabilities "
|
wpa_printf(MSG_DEBUG, "HT: STA " MACSTR " HT Capabilities "
|
||||||
"Info: 0x%04x", MAC2STR(sta->addr), ht_capab);
|
"Info: 0x%04x", MAC2STR(sta->addr), ht_capab);
|
||||||
if ((ht_capab & HT_CAP_INFO_GREEN_FIELD) == 0) {
|
if ((ht_capab & HT_CAP_INFO_GREEN_FIELD) == 0) {
|
||||||
|
@ -1586,6 +1599,8 @@ hostapd_get_ht_capab(struct hostapd_data *hapd,
|
||||||
{
|
{
|
||||||
u16 cap;
|
u16 cap;
|
||||||
|
|
||||||
|
if (ht_cap == NULL)
|
||||||
|
return;
|
||||||
os_memcpy(neg_ht_cap, ht_cap, sizeof(*neg_ht_cap));
|
os_memcpy(neg_ht_cap, ht_cap, sizeof(*neg_ht_cap));
|
||||||
cap = le_to_host16(neg_ht_cap->ht_capabilities_info);
|
cap = le_to_host16(neg_ht_cap->ht_capabilities_info);
|
||||||
cap &= hapd->iconf->ht_capab;
|
cap &= hapd->iconf->ht_capab;
|
||||||
|
@ -1667,7 +1682,7 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
|
||||||
#ifdef CONFIG_IEEE80211N
|
#ifdef CONFIG_IEEE80211N
|
||||||
if (sta->flags & WLAN_STA_HT) {
|
if (sta->flags & WLAN_STA_HT) {
|
||||||
ht_cap_ptr = &ht_cap;
|
ht_cap_ptr = &ht_cap;
|
||||||
hostapd_get_ht_capab(hapd, &sta->ht_capabilities, ht_cap_ptr);
|
hostapd_get_ht_capab(hapd, sta->ht_capabilities, ht_cap_ptr);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_IEEE80211N */
|
#endif /* CONFIG_IEEE80211N */
|
||||||
|
|
||||||
|
|
|
@ -200,6 +200,8 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
|
||||||
|
|
||||||
wpabuf_free(sta->wps_ie);
|
wpabuf_free(sta->wps_ie);
|
||||||
|
|
||||||
|
os_free(sta->ht_capabilities);
|
||||||
|
|
||||||
os_free(sta);
|
os_free(sta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,6 @@
|
||||||
#ifndef STA_INFO_H
|
#ifndef STA_INFO_H
|
||||||
#define STA_INFO_H
|
#define STA_INFO_H
|
||||||
|
|
||||||
#ifdef CONFIG_IEEE80211N
|
|
||||||
#include "common/ieee802_11_defs.h"
|
|
||||||
#endif /* CONFIG_IEEE80211N */
|
|
||||||
|
|
||||||
/* Maximum number of supported rates (from both Supported Rates and Extended
|
/* Maximum number of supported rates (from both Supported Rates and Extended
|
||||||
* Supported Rates IEs). */
|
* Supported Rates IEs). */
|
||||||
#define WLAN_SUPP_RATES_MAX 32
|
#define WLAN_SUPP_RATES_MAX 32
|
||||||
|
@ -77,9 +73,7 @@ struct sta_info {
|
||||||
|
|
||||||
int vlan_id;
|
int vlan_id;
|
||||||
|
|
||||||
#ifdef CONFIG_IEEE80211N
|
struct ieee80211_ht_capabilities *ht_capabilities;
|
||||||
struct ieee80211_ht_capabilities ht_capabilities;
|
|
||||||
#endif /* CONFIG_IEEE80211N */
|
|
||||||
|
|
||||||
#ifdef CONFIG_IEEE80211W
|
#ifdef CONFIG_IEEE80211W
|
||||||
int sa_query_count; /* number of pending SA Query requests;
|
int sa_query_count; /* number of pending SA Query requests;
|
||||||
|
|
Loading…
Reference in a new issue