Coverage Report

Created: 2025-11-03 06:51

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/hostap/src/ap/ieee802_11.h
Line
Count
Source
1
/*
2
 * hostapd / IEEE 802.11 Management
3
 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
4
 *
5
 * This software may be distributed under the terms of the BSD license.
6
 * See README for more details.
7
 */
8
9
#ifndef IEEE802_11_H
10
#define IEEE802_11_H
11
12
#include "utils/list.h"
13
14
struct hostapd_iface;
15
struct hostapd_data;
16
struct sta_info;
17
struct hostapd_frame_info;
18
struct ieee80211_ht_capabilities;
19
struct ieee80211_vht_capabilities;
20
struct ieee80211_mgmt;
21
struct radius_sta;
22
enum ieee80211_op_mode;
23
enum oper_chan_width;
24
struct ieee802_11_elems;
25
struct sae_pk;
26
struct sae_pt;
27
struct sae_password_entry;
28
struct mld_info;
29
struct mld_link_info;
30
31
enum link_parse_type {
32
  LINK_PARSE_ASSOC,
33
  LINK_PARSE_REASSOC,
34
  LINK_PARSE_RECONF,
35
};
36
37
#define LINK_RECONF_GROUP_KDE_MAX_LEN 255
38
39
struct link_reconf_req_info {
40
  struct dl_list list;
41
  u16 status;
42
  u8 link_id;
43
  u8 local_addr[ETH_ALEN];
44
  u8 peer_addr[ETH_ALEN];
45
  size_t sta_prof_len;
46
  u8 sta_prof[];
47
};
48
49
struct link_reconf_req_list {
50
  u8 sta_mld_addr[ETH_ALEN];
51
  u8 dialog_token;
52
  u16 links_add_ok;
53
  u16 links_del_ok;
54
  u16 new_valid_links;
55
  struct dl_list del_req; /* list of struct link_reconf_req_info */
56
  struct dl_list add_req; /* list of struct link_reconf_req_info */
57
};
58
59
int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
60
        struct hostapd_frame_info *fi);
61
void ieee802_11_mgmt_cb(struct hostapd_data *hapd, const u8 *buf, size_t len,
62
      u16 stype, int ok);
63
void hostapd_2040_coex_action(struct hostapd_data *hapd,
64
            const struct ieee80211_mgmt *mgmt, size_t len);
65
#ifdef NEED_AP_MLME
66
int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
67
int ieee802_11_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
68
         char *buf, size_t buflen);
69
#else /* NEED_AP_MLME */
70
static inline int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf,
71
             size_t buflen)
72
{
73
  return 0;
74
}
75
76
static inline int ieee802_11_get_mib_sta(struct hostapd_data *hapd,
77
           struct sta_info *sta,
78
           char *buf, size_t buflen)
79
{
80
  return 0;
81
}
82
#endif /* NEED_AP_MLME */
83
u16 hostapd_own_capab_info(struct hostapd_data *hapd);
84
void ap_ht2040_timeout(void *eloop_data, void *user_data);
85
u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid,
86
         bool mbssid_complete);
87
u8 * hostapd_eid_qos_map_set(struct hostapd_data *hapd, u8 *eid);
88
u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid);
89
u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid);
90
u8 * hostapd_eid_rm_enabled_capab(struct hostapd_data *hapd, u8 *eid,
91
          size_t len);
92
u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid);
93
u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid);
94
u8 * hostapd_eid_vht_capabilities(struct hostapd_data *hapd, u8 *eid, u32 nsts);
95
u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid);
96
u8 * hostapd_eid_vendor_vht(struct hostapd_data *hapd, u8 *eid);
97
u8 * hostapd_eid_chsw_wrapper(struct hostapd_data *hapd, u8 *eid);
98
u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid);
99
u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid,
100
        enum ieee80211_op_mode opmode);
101
u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid);
102
u8 * hostapd_eid_he_mu_edca_parameter_set(struct hostapd_data *hapd, u8 *eid);
103
u8 * hostapd_eid_spatial_reuse(struct hostapd_data *hapd, u8 *eid);
104
u8 * hostapd_eid_he_6ghz_band_cap(struct hostapd_data *hapd, u8 *eid);
105
106
int hostapd_ht_operation_update(struct hostapd_iface *iface);
107
void ieee802_11_send_sa_query_req(struct hostapd_data *hapd,
108
          const u8 *addr, const u8 *trans_id);
109
void hostapd_get_ht_capab(struct hostapd_data *hapd,
110
        struct ieee80211_ht_capabilities *ht_cap,
111
        struct ieee80211_ht_capabilities *neg_ht_cap);
112
void hostapd_get_vht_capab(struct hostapd_data *hapd,
113
         struct ieee80211_vht_capabilities *vht_cap,
114
         struct ieee80211_vht_capabilities *neg_vht_cap);
115
void hostapd_get_he_capab(struct hostapd_data *hapd,
116
        const struct ieee80211_he_capabilities *he_cap,
117
        struct ieee80211_he_capabilities *neg_he_cap,
118
        size_t he_capab_len);
119
void hostapd_get_eht_capab(struct hostapd_data *hapd,
120
         const struct ieee80211_eht_capabilities *src,
121
         struct ieee80211_eht_capabilities *dest,
122
         size_t len);
123
u8 * hostapd_eid_eht_ml_beacon(struct hostapd_data *hapd,
124
             struct mld_info *mld_info,
125
             u8 *eid, bool include_mld_id);
126
u8 * hostapd_eid_eht_ml_assoc(struct hostapd_data *hapd, struct sta_info *info,
127
            u8 *eid);
128
u8 * hostapd_eid_eht_basic_ml_common(struct hostapd_data *hapd,
129
             u8 *eid, struct mld_info *mld_info,
130
             bool include_mld_id, bool include_bpcc);
131
size_t hostapd_eid_eht_basic_ml_len(struct hostapd_data *hapd,
132
            struct sta_info *info,
133
            bool include_mld_id, bool include_pbcc);
134
size_t hostapd_eid_eht_ml_beacon_len(struct hostapd_data *hapd,
135
             struct mld_info *info,
136
             bool include_mld_id);
137
struct wpabuf * hostapd_ml_auth_resp(struct hostapd_data *hapd);
138
const u8 * hostapd_process_ml_auth(struct hostapd_data *hapd,
139
           const struct ieee80211_mgmt *mgmt,
140
           size_t len);
141
u16 hostapd_process_ml_assoc_req(struct hostapd_data *hapd,
142
         struct ieee802_11_elems *elems,
143
         struct sta_info *sta);
144
int hostapd_process_ml_assoc_req_addr(struct hostapd_data *hapd,
145
              const u8 *basic_mle, size_t basic_mle_len,
146
              u8 *mld_addr);
147
int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta);
148
u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta,
149
          const u8 *ht_capab);
150
u16 copy_sta_vendor_vht(struct hostapd_data *hapd, struct sta_info *sta,
151
      const u8 *ie, size_t len);
152
153
int update_ht_state(struct hostapd_data *hapd, struct sta_info *sta);
154
void ht40_intolerant_add(struct hostapd_iface *iface, struct sta_info *sta);
155
void ht40_intolerant_remove(struct hostapd_iface *iface, struct sta_info *sta);
156
u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
157
           const u8 *vht_capab);
158
u16 copy_sta_vht_oper(struct hostapd_data *hapd, struct sta_info *sta,
159
          const u8 *vht_oper);
160
u16 set_sta_vht_opmode(struct hostapd_data *hapd, struct sta_info *sta,
161
           const u8 *vht_opmode);
162
u16 copy_sta_he_capab(struct hostapd_data *hapd, struct sta_info *sta,
163
          enum ieee80211_op_mode opmode, const u8 *he_capab,
164
          size_t he_capab_len);
165
u16 copy_sta_he_6ghz_capab(struct hostapd_data *hapd, struct sta_info *sta,
166
         const u8 *he_6ghz_capab);
167
int hostapd_get_he_twt_responder(struct hostapd_data *hapd,
168
         enum ieee80211_op_mode mode);
169
bool hostapd_get_ht_vht_twt_responder(struct hostapd_data *hapd);
170
void hostapd_wfa_capab(struct hostapd_data *hapd, struct sta_info *sta,
171
           const u8 *pos, const u8 *end);
172
u8 * hostapd_eid_cca(struct hostapd_data *hapd, u8 *eid);
173
void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
174
           const u8 *buf, size_t len, int ack);
175
void ieee802_11_rx_from_unknown(struct hostapd_data *hapd, const u8 *src,
176
        int wds);
177
u8 * hostapd_eid_assoc_comeback_time(struct hostapd_data *hapd,
178
             struct sta_info *sta, u8 *eid);
179
void ieee802_11_sa_query_action(struct hostapd_data *hapd,
180
        const struct ieee80211_mgmt *mgmt,
181
        size_t len);
182
u8 * hostapd_eid_interworking(struct hostapd_data *hapd, u8 *eid);
183
u8 * hostapd_eid_adv_proto(struct hostapd_data *hapd, u8 *eid);
184
u8 * hostapd_eid_roaming_consortium(struct hostapd_data *hapd, u8 *eid);
185
u8 * hostapd_eid_time_adv(struct hostapd_data *hapd, u8 *eid);
186
u8 * hostapd_eid_time_zone(struct hostapd_data *hapd, u8 *eid);
187
int hostapd_update_time_adv(struct hostapd_data *hapd);
188
void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);
189
u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid,
190
             u16 value);
191
192
int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);
193
#ifdef CONFIG_SAE
194
void sae_clear_retransmit_timer(struct hostapd_data *hapd,
195
        struct sta_info *sta);
196
void sae_accept_sta(struct hostapd_data *hapd, struct sta_info *sta);
197
#else /* CONFIG_SAE */
198
static inline void sae_clear_retransmit_timer(struct hostapd_data *hapd,
199
                struct sta_info *sta)
200
0
{
201
0
}
Unexecuted instantiation: wpa_auth.c:sae_clear_retransmit_timer
Unexecuted instantiation: wpa_auth_ft.c:sae_clear_retransmit_timer
Unexecuted instantiation: wpa_auth_ie.c:sae_clear_retransmit_timer
Unexecuted instantiation: sta_info.c:sae_clear_retransmit_timer
Unexecuted instantiation: wmm.c:sae_clear_retransmit_timer
Unexecuted instantiation: ap_drv_ops.c:sae_clear_retransmit_timer
Unexecuted instantiation: ap_mlme.c:sae_clear_retransmit_timer
Unexecuted instantiation: beacon.c:sae_clear_retransmit_timer
Unexecuted instantiation: hostapd.c:sae_clear_retransmit_timer
Unexecuted instantiation: hw_features.c:sae_clear_retransmit_timer
Unexecuted instantiation: ieee802_11_auth.c:sae_clear_retransmit_timer
Unexecuted instantiation: ieee802_11.c:sae_clear_retransmit_timer
Unexecuted instantiation: ieee802_11_ht.c:sae_clear_retransmit_timer
Unexecuted instantiation: ieee802_11_shared.c:sae_clear_retransmit_timer
Unexecuted instantiation: ieee802_1x.c:sae_clear_retransmit_timer
Unexecuted instantiation: neighbor_db.c:sae_clear_retransmit_timer
Unexecuted instantiation: wpa_auth_glue.c:sae_clear_retransmit_timer
Unexecuted instantiation: ap_list.c:sae_clear_retransmit_timer
202
#endif /* CONFIG_SAE */
203
204
#ifdef CONFIG_MBO
205
206
u8 * hostapd_eid_mbo(struct hostapd_data *hapd, u8 *eid, size_t len);
207
208
u8 hostapd_mbo_ie_len(struct hostapd_data *hapd);
209
210
u8 * hostapd_eid_mbo_rssi_assoc_rej(struct hostapd_data *hapd, u8 *eid,
211
            size_t len, int delta);
212
213
#else /* CONFIG_MBO */
214
215
static inline u8 * hostapd_eid_mbo(struct hostapd_data *hapd, u8 *eid,
216
           size_t len)
217
0
{
218
0
  return eid;
219
0
}
Unexecuted instantiation: wpa_auth.c:hostapd_eid_mbo
Unexecuted instantiation: wpa_auth_ft.c:hostapd_eid_mbo
Unexecuted instantiation: wpa_auth_ie.c:hostapd_eid_mbo
Unexecuted instantiation: sta_info.c:hostapd_eid_mbo
Unexecuted instantiation: wmm.c:hostapd_eid_mbo
Unexecuted instantiation: ap_drv_ops.c:hostapd_eid_mbo
Unexecuted instantiation: ap_mlme.c:hostapd_eid_mbo
Unexecuted instantiation: beacon.c:hostapd_eid_mbo
Unexecuted instantiation: hostapd.c:hostapd_eid_mbo
Unexecuted instantiation: hw_features.c:hostapd_eid_mbo
Unexecuted instantiation: ieee802_11_auth.c:hostapd_eid_mbo
Unexecuted instantiation: ieee802_11.c:hostapd_eid_mbo
Unexecuted instantiation: ieee802_11_ht.c:hostapd_eid_mbo
Unexecuted instantiation: ieee802_11_shared.c:hostapd_eid_mbo
Unexecuted instantiation: ieee802_1x.c:hostapd_eid_mbo
Unexecuted instantiation: neighbor_db.c:hostapd_eid_mbo
Unexecuted instantiation: wpa_auth_glue.c:hostapd_eid_mbo
Unexecuted instantiation: ap_list.c:hostapd_eid_mbo
220
221
static inline u8 hostapd_mbo_ie_len(struct hostapd_data *hapd)
222
0
{
223
0
  return 0;
224
0
}
Unexecuted instantiation: wpa_auth.c:hostapd_mbo_ie_len
Unexecuted instantiation: wpa_auth_ft.c:hostapd_mbo_ie_len
Unexecuted instantiation: wpa_auth_ie.c:hostapd_mbo_ie_len
Unexecuted instantiation: sta_info.c:hostapd_mbo_ie_len
Unexecuted instantiation: wmm.c:hostapd_mbo_ie_len
Unexecuted instantiation: ap_drv_ops.c:hostapd_mbo_ie_len
Unexecuted instantiation: ap_mlme.c:hostapd_mbo_ie_len
Unexecuted instantiation: beacon.c:hostapd_mbo_ie_len
Unexecuted instantiation: hostapd.c:hostapd_mbo_ie_len
Unexecuted instantiation: hw_features.c:hostapd_mbo_ie_len
Unexecuted instantiation: ieee802_11_auth.c:hostapd_mbo_ie_len
Unexecuted instantiation: ieee802_11.c:hostapd_mbo_ie_len
Unexecuted instantiation: ieee802_11_ht.c:hostapd_mbo_ie_len
Unexecuted instantiation: ieee802_11_shared.c:hostapd_mbo_ie_len
Unexecuted instantiation: ieee802_1x.c:hostapd_mbo_ie_len
Unexecuted instantiation: neighbor_db.c:hostapd_mbo_ie_len
Unexecuted instantiation: wpa_auth_glue.c:hostapd_mbo_ie_len
Unexecuted instantiation: ap_list.c:hostapd_mbo_ie_len
225
226
#endif /* CONFIG_MBO */
227
228
void ap_copy_sta_supp_op_classes(struct sta_info *sta,
229
         const u8 *supp_op_classes,
230
         size_t supp_op_classes_len);
231
232
u8 * hostapd_eid_fils_indic(struct hostapd_data *hapd, u8 *eid, int hessid);
233
void ieee802_11_finish_fils_auth(struct hostapd_data *hapd,
234
         struct sta_info *sta, int success,
235
         struct wpabuf *erp_resp,
236
         const u8 *msk, size_t msk_len);
237
u8 * owe_assoc_req_process(struct hostapd_data *hapd, struct sta_info *sta,
238
         const u8 *owe_dh, u8 owe_dh_len,
239
         u8 *owe_buf, size_t owe_buf_len, u16 *status);
240
u16 owe_process_rsn_ie(struct hostapd_data *hapd, struct sta_info *sta,
241
           const u8 *rsn_ie, size_t rsn_ie_len,
242
           const u8 *owe_dh, size_t owe_dh_len,
243
           const u8 *link_addr);
244
u16 owe_validate_request(struct hostapd_data *hapd, const u8 *peer,
245
       const u8 *rsn_ie, size_t rsn_ie_len,
246
       const u8 *owe_dh, size_t owe_dh_len);
247
void fils_hlp_timeout(void *eloop_ctx, void *eloop_data);
248
void fils_hlp_finish_assoc(struct hostapd_data *hapd, struct sta_info *sta);
249
void handle_auth_fils(struct hostapd_data *hapd, struct sta_info *sta,
250
          const u8 *pos, size_t len, u16 auth_alg,
251
          u16 auth_transaction, u16 status_code,
252
          void (*cb)(struct hostapd_data *hapd,
253
         struct sta_info *sta,
254
         u16 resp, struct wpabuf *data, int pub));
255
256
size_t hostapd_eid_owe_trans_len(struct hostapd_data *hapd);
257
u8 * hostapd_eid_owe_trans(struct hostapd_data *hapd, u8 *eid, size_t len);
258
259
size_t hostapd_eid_dpp_cc_len(struct hostapd_data *hapd);
260
u8 * hostapd_eid_dpp_cc(struct hostapd_data *hapd, u8 *eid, size_t len);
261
262
int get_tx_parameters(struct sta_info *sta, int ap_max_chanwidth,
263
          int ap_seg1_idx, int *bandwidth, int *seg1_idx);
264
265
void auth_sae_process_commit(void *eloop_ctx, void *user_ctx);
266
u8 * hostapd_eid_rsnxe(struct hostapd_data *hapd, u8 *eid, size_t len);
267
u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta,
268
        const u8 *ext_capab_ie, size_t ext_capab_ie_len);
269
size_t hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type,
270
         bool include_mld_params);
271
u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type,
272
         bool include_mld_params);
273
int ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta,
274
             int res, struct radius_sta *info);
275
size_t hostapd_eid_eht_capab_len(struct hostapd_data *hapd,
276
         enum ieee80211_op_mode opmode);
277
u8 * hostapd_eid_eht_capab(struct hostapd_data *hapd, u8 *eid,
278
         enum ieee80211_op_mode opmode);
279
u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid);
280
u16 copy_sta_eht_capab(struct hostapd_data *hapd, struct sta_info *sta,
281
           enum ieee80211_op_mode opmode,
282
           const u8 *he_capab, size_t he_capab_len,
283
           const u8 *eht_capab, size_t eht_capab_len);
284
size_t hostapd_eid_mbssid_len(struct hostapd_data *hapd, u32 frame_type,
285
            u8 *elem_count, const u8 *known_bss,
286
            size_t known_bss_len, size_t *rnr_len);
287
u8 * hostapd_eid_mbssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
288
      unsigned int frame_stype, u8 elem_count,
289
      u8 **elem_offset,
290
      const u8 *known_bss, size_t known_bss_len, u8 *rnr_eid,
291
      u8 *rnr_count, u8 **rnr_offset, size_t rnr_len);
292
bool hostapd_is_multiple_link_mld(struct hostapd_data *hapd);
293
int sae_password_bind(struct hostapd_data *hapd, const u8 *addr,
294
          const char *password);
295
const char * sae_get_password(struct hostapd_data *hapd,
296
            struct sta_info *sta, const u8 *rx_id,
297
            size_t rx_id_len,
298
            struct sae_password_entry **pw_entry,
299
            struct sae_pt **s_pt, const struct sae_pk **s_pk);
300
struct sta_info * hostapd_ml_get_assoc_sta(struct hostapd_data *hapd,
301
             struct sta_info *sta,
302
             struct hostapd_data **assoc_hapd);
303
int hostapd_process_assoc_ml_info(struct hostapd_data *hapd,
304
          struct sta_info *sta,
305
          const u8 *ies, size_t ies_len,
306
          bool reassoc, int tx_link_status,
307
          bool offload);
308
309
void ml_deinit_link_reconf_req(struct link_reconf_req_list **req_list_ptr);
310
int ieee80211_ml_process_link(struct hostapd_data *hapd,
311
            struct sta_info *origin_sta,
312
            struct mld_link_info *link,
313
            const u8 *ies, size_t ies_len,
314
            enum link_parse_type type, bool offload);
315
void ieee80211_ml_build_assoc_resp(struct hostapd_data *hapd,
316
           struct mld_link_info *link);
317
318
void ieee802_11_rx_protected_eht_action(struct hostapd_data *hapd,
319
          const struct ieee80211_mgmt *mgmt,
320
          size_t len);
321
void hostapd_link_reconf_resp_tx_status(struct hostapd_data *hapd,
322
          struct sta_info *sta,
323
          const struct ieee80211_mgmt *mgmt,
324
          size_t len, int ok);
325
326
#endif /* IEEE802_11_H */