wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sta_info.h
Go to the documentation of this file.
1 
5 #ifndef STA_INFO_H
6 #define STA_INFO_H
7 
8 #ifdef CONFIG_MESH
9 /* needed for mesh_plink_state enum */
10 #include "common/defs.h"
11 #endif /* CONFIG_MESH */
12 
13 #include "list.h"
14 
15 /* STA flags */
16 #define WLAN_STA_AUTH BIT(0)
17 #define WLAN_STA_ASSOC BIT(1)
18 #define WLAN_STA_AUTHORIZED BIT(5)
19 #define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */
20 #define WLAN_STA_SHORT_PREAMBLE BIT(7)
21 #define WLAN_STA_PREAUTH BIT(8)
22 #define WLAN_STA_WMM BIT(9)
23 #define WLAN_STA_MFP BIT(10)
24 #define WLAN_STA_HT BIT(11)
25 #define WLAN_STA_WPS BIT(12)
26 #define WLAN_STA_MAYBE_WPS BIT(13)
27 #define WLAN_STA_WDS BIT(14)
28 #define WLAN_STA_ASSOC_REQ_OK BIT(15)
29 #define WLAN_STA_WPS2 BIT(16)
30 #define WLAN_STA_GAS BIT(17)
31 #define WLAN_STA_VHT BIT(18)
32 #define WLAN_STA_WNM_SLEEP_MODE BIT(19)
33 #define WLAN_STA_VHT_OPMODE_ENABLED BIT(20)
34 #define WLAN_STA_VENDOR_VHT BIT(21)
35 #define WLAN_STA_PENDING_DISASSOC_CB BIT(29)
36 #define WLAN_STA_PENDING_DEAUTH_CB BIT(30)
37 #define WLAN_STA_NONERP BIT(31)
38 
39 /* Maximum number of supported rates (from both Supported Rates and Extended
40  * Supported Rates IEs). */
41 #define WLAN_SUPP_RATES_MAX 32
42 
43 
44 struct sta_info {
45  struct sta_info *next; /* next entry in sta list */
46  struct sta_info *hnext; /* next entry in hash table list */
47  u8 addr[6];
48  be32 ipaddr;
49  struct dl_list ip6addr; /* list head for struct ip6addr */
50  u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */
51  u32 flags; /* Bitfield of WLAN_STA_* */
52  u16 capability;
53  u16 listen_interval; /* or beacon_int for APs */
54  u8 supported_rates[WLAN_SUPP_RATES_MAX];
55  int supported_rates_len;
56  u8 qosinfo; /* Valid when WLAN_STA_WMM is set */
57 
58 #ifdef CONFIG_MESH
59  enum mesh_plink_state plink_state;
60  u16 peer_lid;
61  u16 my_lid;
62  u16 mpm_close_reason;
63  int mpm_retries;
64  u8 my_nonce[32];
65  u8 peer_nonce[32];
66  u8 aek[32]; /* SHA256 digest length */
67  u8 mtk[16];
68  u8 mgtk[16];
69  u8 sae_auth_retry;
70 #endif /* CONFIG_MESH */
71 
72  unsigned int nonerp_set:1;
73  unsigned int no_short_slot_time_set:1;
74  unsigned int no_short_preamble_set:1;
75  unsigned int no_ht_gf_set:1;
76  unsigned int no_ht_set:1;
77  unsigned int ht40_intolerant_set:1;
78  unsigned int ht_20mhz_set:1;
79  unsigned int no_p2p_set:1;
80  unsigned int qos_map_enabled:1;
81  unsigned int remediation:1;
82  unsigned int hs20_deauth_requested:1;
83  unsigned int session_timeout_set:1;
84  unsigned int radius_das_match:1;
85 
86  u16 auth_alg;
87 
88  enum {
89  STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH, STA_REMOVE,
90  STA_DISASSOC_FROM_CLI
91  } timeout_next;
92 
93  u16 deauth_reason;
94  u16 disassoc_reason;
95 
96  /* IEEE 802.1X related data */
98 
99  u32 acct_session_id_hi;
100  u32 acct_session_id_lo;
101  struct os_reltime acct_session_start;
102  int acct_session_started;
103  int acct_terminate_cause; /* Acct-Terminate-Cause */
104  int acct_interim_interval; /* Acct-Interim-Interval */
105 
106  unsigned long last_rx_bytes;
107  unsigned long last_tx_bytes;
108  u32 acct_input_gigawords; /* Acct-Input-Gigawords */
109  u32 acct_output_gigawords; /* Acct-Output-Gigawords */
110 
111  u8 *challenge; /* IEEE 802.11 Shared Key Authentication Challenge */
112 
113  struct wpa_state_machine *wpa_sm;
114  struct rsn_preauth_interface *preauth_iface;
115 
116  int vlan_id; /* 0: none, >0: VID */
117  int vlan_id_bound; /* updated by ap_sta_bind_vlan() */
118  /* PSKs from RADIUS authentication server */
119  struct hostapd_sta_wpa_psk_short *psk;
120 
121  char *identity; /* User-Name from RADIUS */
122  char *radius_cui; /* Chargeable-User-Identity from RADIUS */
123 
124  struct ieee80211_ht_capabilities *ht_capabilities;
125  struct ieee80211_vht_capabilities *vht_capabilities;
126  u8 vht_opmode;
127 
128 #ifdef CONFIG_IEEE80211W
129  int sa_query_count; /* number of pending SA Query requests;
130  * 0 = no SA Query in progress */
131  int sa_query_timed_out;
132  u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
133  * sa_query_count octets of pending SA Query
134  * transaction identifiers */
135  struct os_reltime sa_query_start;
136 #endif /* CONFIG_IEEE80211W */
137 
138 #ifdef CONFIG_INTERWORKING
139 #define GAS_DIALOG_MAX 8 /* Max concurrent dialog number */
140  struct gas_dialog_info *gas_dialog;
141  u8 gas_dialog_next;
142 #endif /* CONFIG_INTERWORKING */
143 
144  struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
145  struct wpabuf *p2p_ie; /* P2P IE from (Re)Association Request */
146  struct wpabuf *hs20_ie; /* HS 2.0 IE from (Re)Association Request */
147  u8 remediation_method;
148  char *remediation_url; /* HS 2.0 Subscription Remediation Server URL */
149  struct wpabuf *hs20_deauth_req;
150  char *hs20_session_info_url;
151  int hs20_disassoc_timer;
152 #ifdef CONFIG_FST
153  struct wpabuf *mb_ies; /* MB IEs from (Re)Association Request */
154 #endif /* CONFIG_FST */
155 
156  struct os_reltime connected_time;
157 
158 #ifdef CONFIG_SAE
159  struct sae_data *sae;
160 #endif /* CONFIG_SAE */
161 
162  u32 session_timeout; /* valid only if session_timeout_set == 1 */
163 
164  /* Last Authentication/(Re)Association Request/Action frame sequence
165  * control */
166  u16 last_seq_ctrl;
167  /* Last Authentication/(Re)Association Request/Action frame subtype */
168  u8 last_subtype;
169 };
170 
171 
172 /* Default value for maximum station inactivity. After AP_MAX_INACTIVITY has
173  * passed since last received frame from the station, a nullfunc data frame is
174  * sent to the station. If this frame is not acknowledged and no other frames
175  * have been received, the station will be disassociated after
176  * AP_DISASSOC_DELAY seconds. Similarly, the station will be deauthenticated
177  * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
178 #define AP_MAX_INACTIVITY (5 * 60)
179 #define AP_DISASSOC_DELAY (1)
180 #define AP_DEAUTH_DELAY (1)
181 /* Number of seconds to keep STA entry with Authenticated flag after it has
182  * been disassociated. */
183 #define AP_MAX_INACTIVITY_AFTER_DISASSOC (1 * 30)
184 /* Number of seconds to keep STA entry after it has been deauthenticated. */
185 #define AP_MAX_INACTIVITY_AFTER_DEAUTH (1 * 5)
186 
187 
188 struct hostapd_data;
189 
190 int ap_for_each_sta(struct hostapd_data *hapd,
191  int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
192  void *ctx),
193  void *ctx);
194 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta);
195 struct sta_info * ap_get_sta_p2p(struct hostapd_data *hapd, const u8 *addr);
196 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta);
197 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
198 void ap_sta_ip6addr_del(struct hostapd_data *hapd, struct sta_info *sta);
199 void hostapd_free_stas(struct hostapd_data *hapd);
200 void ap_handle_timer(void *eloop_ctx, void *timeout_ctx);
201 void ap_sta_replenish_timeout(struct hostapd_data *hapd, struct sta_info *sta,
202  u32 session_timeout);
203 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
204  u32 session_timeout);
205 void ap_sta_no_session_timeout(struct hostapd_data *hapd,
206  struct sta_info *sta);
207 void ap_sta_session_warning_timeout(struct hostapd_data *hapd,
208  struct sta_info *sta, int warning_time);
209 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr);
210 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
211  u16 reason);
212 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
213  u16 reason);
214 #ifdef CONFIG_WPS
215 int ap_sta_wps_cancel(struct hostapd_data *hapd,
216  struct sta_info *sta, void *ctx);
217 #endif /* CONFIG_WPS */
218 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta);
219 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
220 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
221 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta);
222 void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
223  const u8 *addr, u16 reason);
224 
225 void ap_sta_set_authorized(struct hostapd_data *hapd,
226  struct sta_info *sta, int authorized);
227 static inline int ap_sta_is_authorized(struct sta_info *sta)
228 {
229  return sta->flags & WLAN_STA_AUTHORIZED;
230 }
231 
232 void ap_sta_deauth_cb(struct hostapd_data *hapd, struct sta_info *sta);
233 void ap_sta_disassoc_cb(struct hostapd_data *hapd, struct sta_info *sta);
234 
235 int ap_sta_flags_txt(u32 flags, char *buf, size_t buflen);
236 
237 #endif /* STA_INFO_H */
Definition: sta_info.h:44
Definition: wpa_auth_i.h:20
WPA Supplicant - Common definitions.
void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
Per STA timer handler.
Definition: sta_info.c:346
Definition: wpabuf.h:16
Definition: ieee802_11_defs.h:634
Definition: ap_config.h:124
Definition: ieee802_11_defs.h:668
Per-Supplicant Authenticator state machines.
Definition: eapol_auth_sm_i.h:40
Definition: os.h:22
Doubly-linked list.
Definition: sae.h:40
Doubly-linked list.
Definition: list.h:12
Definition: gas_serv.h:41
Internal data for EAPOL state machines.
Definition: eapol_supp_sm.c:28
Internal WPA state machine data.
Definition: wpa_i.h:18
hostapd per-BSS data structure
Definition: hostapd.h:103