2 * hostapd / Initialization and configuration
3 * Host AP kernel driver
4 * Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Alternatively, this software may be distributed under the terms of BSD
13 * See README and COPYING for more details.
29 #define ETH_P_ALL 0x0003
32 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
33 #endif /* ETH_P_PAE */
35 #define ETH_P_EAPOL ETH_P_PAE
36 #endif /* ETH_P_EAPOL */
39 #define ETH_P_RRB 0x890D
40 #endif /* ETH_P_RRB */
48 #define MAX_VLAN_ID 4094
57 struct ieee80211_hdr
{
64 /* followed by 'u8 addr4[6];' if ToDS and FromDS is set in data frame
72 #define IEEE80211_DA_FROMDS addr1
73 #define IEEE80211_BSSID_FROMDS addr2
74 #define IEEE80211_SA_FROMDS addr3
76 #define IEEE80211_HDRLEN (sizeof(struct ieee80211_hdr))
78 #define IEEE80211_FC(type, stype) host_to_le16((type << 2) | (stype << 4))
80 /* MTU to be set for the wlan#ap device; this is mainly needed for IEEE 802.1X
81 * frames that might be longer than normal default MTU and they are not
83 #define HOSTAPD_MTU 2290
85 extern unsigned char rfc1042_header
[6];
87 struct hostap_sta_driver_data
{
88 unsigned long rx_packets
, tx_packets
, rx_bytes
, tx_bytes
;
89 unsigned long current_tx_rate
;
90 unsigned long inactive_msec
;
92 unsigned long num_ps_buf_frames
;
93 unsigned long tx_retry_failed
;
94 unsigned long tx_retry_count
;
99 struct wpa_driver_ops
;
101 struct radius_server_data
;
103 #ifdef CONFIG_FULL_DYNAMIC_VLAN
104 struct full_dynamic_vlan
;
105 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
108 * struct hostapd_data - hostapd per-BSS data structure
110 struct hostapd_data
{
111 struct hostapd_iface
*iface
;
112 struct hostapd_config
*iconf
;
113 struct hostapd_bss_config
*conf
;
114 int interface_added
; /* virtual interface added for this BSS */
116 u8 own_addr
[ETH_ALEN
];
118 int num_sta
; /* number of entries in sta_list */
119 struct sta_info
*sta_list
; /* STA info list head */
120 struct sta_info
*sta_hash
[STA_HASH_SIZE
];
122 /* pointers to STA info; based on allocated AID or NULL if AID free
123 * AID is in the range 1-2007, so sta_aid[0] corresponders to AID 1
126 struct sta_info
*sta_aid
[MAX_AID_TABLE_SIZE
];
128 const struct wpa_driver_ops
*driver
;
132 u8 default_wep_key_idx
;
134 struct radius_client_data
*radius
;
135 int radius_client_reconfigured
;
136 u32 acct_session_id_hi
, acct_session_id_lo
;
138 struct iapp_data
*iapp
;
140 enum { DO_NOT_ASSOC
= 0, WAIT_BEACON
, AUTHENTICATE
, ASSOCIATE
,
141 ASSOCIATED
} assoc_ap_state
;
142 char assoc_ap_ssid
[33];
143 int assoc_ap_ssid_len
;
146 struct hostapd_cached_radius_acl
*acl_cache
;
147 struct hostapd_acl_query_data
*acl_queries
;
149 struct wpa_authenticator
*wpa_auth
;
150 struct eapol_authenticator
*eapol_auth
;
152 struct rsn_preauth_interface
*preauth_iface
;
153 time_t michael_mic_failure
;
154 int michael_mic_failures
;
155 int tkip_countermeasures
;
158 struct wpa_ctrl_dst
*ctrl_dst
;
161 void *eap_sim_db_priv
;
162 struct radius_server_data
*radius_srv
;
164 int parameter_set_count
;
166 #ifdef CONFIG_FULL_DYNAMIC_VLAN
167 struct full_dynamic_vlan
*full_dynamic_vlan
;
168 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
170 struct l2_packet_data
*l2
;
175 * hostapd_iface_cb - Generic callback type for per-iface asynchronous requests
176 * @iface: the interface the event occured on.
177 * @status: 0 if the request succeeded; -1 if the request failed.
179 typedef void (*hostapd_iface_cb
)(struct hostapd_iface
*iface
, int status
);
182 struct hostapd_config_change
;
185 * struct hostapd_iface - hostapd per-interface data structure
187 struct hostapd_iface
{
189 struct hostapd_config
*conf
;
191 hostapd_iface_cb setup_cb
;
194 struct hostapd_data
**bss
;
196 int num_ap
; /* number of entries in ap_list */
197 struct ap_info
*ap_list
; /* AP info list head */
198 struct ap_info
*ap_hash
[STA_HASH_SIZE
];
199 struct ap_info
*ap_iter_list
;
201 struct hostapd_hw_modes
*hw_features
;
203 struct hostapd_hw_modes
*current_mode
;
204 /* Rates that are currently used (i.e., filtered copy of
205 * current_mode->channels */
207 struct hostapd_rate_data
*current_rates
;
208 hostapd_iface_cb hw_mode_sel_cb
;
212 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
216 /* Number of associated stations that do not support Short Slot Time */
217 int num_sta_no_short_slot_time
;
219 /* Number of associated stations that do not support Short Preamble */
220 int num_sta_no_short_preamble
;
222 int olbc
; /* Overlapping Legacy BSS Condition */
226 unsigned int tx_power
;
227 unsigned int sta_max_power
;
229 unsigned int channel_switch
;
231 struct hostapd_config_change
*change
;
232 hostapd_iface_cb reload_iface_cb
;
233 hostapd_iface_cb config_reload_cb
;
236 void hostapd_new_assoc_sta(struct hostapd_data
*hapd
, struct sta_info
*sta
,
239 #endif /* HOSTAPD_H */