wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
driver_nl80211.h
Go to the documentation of this file.
1 
9 #ifndef DRIVER_NL80211_H
10 #define DRIVER_NL80211_H
11 
12 #include "nl80211_copy.h"
13 #include "utils/list.h"
14 #include "driver.h"
15 
16 #ifdef CONFIG_LIBNL20
17 /* libnl 2.0 compatibility code */
18 #define nl_handle nl_sock
19 #define nl80211_handle_alloc nl_socket_alloc_cb
20 #define nl80211_handle_destroy nl_socket_free
21 #endif /* CONFIG_LIBNL20 */
22 
24  struct dl_list interfaces;
25  int if_add_ifindex;
26  u64 if_add_wdevid;
27  int if_add_wdevid_set;
28  struct netlink_data *netlink;
29  struct nl_cb *nl_cb;
30  struct nl_handle *nl;
31  int nl80211_id;
32  int ioctl_sock; /* socket for ioctl() use */
33 
34  struct nl_handle *nl_event;
35 };
36 
38  struct dl_list list;
39  struct dl_list bsss;
40  struct dl_list drvs;
41 
42  struct nl_handle *nl_beacons;
43  struct nl_cb *nl_cb;
44 
45  int wiphy_idx;
46 };
47 
48 struct i802_bss {
49  struct wpa_driver_nl80211_data *drv;
50  struct i802_bss *next;
51  int ifindex;
52  int br_ifindex;
53  u64 wdev_id;
54  char ifname[IFNAMSIZ + 1];
55  char brname[IFNAMSIZ];
56  unsigned int beacon_set:1;
57  unsigned int added_if_into_bridge:1;
58  unsigned int added_bridge:1;
59  unsigned int in_deinit:1;
60  unsigned int wdev_id_set:1;
61  unsigned int added_if:1;
62  unsigned int static_ap:1;
63 
64  u8 addr[ETH_ALEN];
65 
66  int freq;
67  int bandwidth;
68  int if_dynamic;
69 
70  void *ctx;
71  struct nl_handle *nl_preq, *nl_mgmt;
72  struct nl_cb *nl_cb;
73 
74  struct nl80211_wiphy_data *wiphy_data;
75  struct dl_list wiphy_list;
76 };
77 
79  struct nl80211_global *global;
80  struct dl_list list;
81  struct dl_list wiphy_list;
82  char phyname[32];
83  u8 perm_addr[ETH_ALEN];
84  void *ctx;
85  int ifindex;
86  int if_removed;
87  int if_disabled;
88  int ignore_if_down_event;
89  struct rfkill_data *rfkill;
90  struct wpa_driver_capa capa;
91  u8 *extended_capa, *extended_capa_mask;
92  unsigned int extended_capa_len;
93  int has_capability;
94 
95  int operstate;
96 
97  int scan_complete_events;
98  enum scan_states {
99  NO_SCAN, SCAN_REQUESTED, SCAN_STARTED, SCAN_COMPLETED,
100  SCAN_ABORTED, SCHED_SCAN_STARTED, SCHED_SCAN_STOPPED,
101  SCHED_SCAN_RESULTS
102  } scan_state;
103 
104  u8 auth_bssid[ETH_ALEN];
105  u8 auth_attempt_bssid[ETH_ALEN];
106  u8 bssid[ETH_ALEN];
107  u8 prev_bssid[ETH_ALEN];
108  int associated;
109  u8 ssid[SSID_MAX_LEN];
110  size_t ssid_len;
111  enum nl80211_iftype nlmode;
112  enum nl80211_iftype ap_scan_as_station;
113  unsigned int assoc_freq;
114 
115  int monitor_sock;
116  int monitor_ifidx;
117  int monitor_refcount;
118 
119  unsigned int disabled_11b_rates:1;
120  unsigned int pending_remain_on_chan:1;
121  unsigned int in_interface_list:1;
122  unsigned int device_ap_sme:1;
123  unsigned int poll_command_supported:1;
124  unsigned int data_tx_status:1;
125  unsigned int scan_for_auth:1;
126  unsigned int retry_auth:1;
127  unsigned int use_monitor:1;
128  unsigned int ignore_next_local_disconnect:1;
129  unsigned int ignore_next_local_deauth:1;
130  unsigned int hostapd:1;
131  unsigned int start_mode_ap:1;
132  unsigned int start_iface_up:1;
133  unsigned int test_use_roc_tx:1;
134  unsigned int ignore_deauth_event:1;
135  unsigned int vendor_cmd_test_avail:1;
136  unsigned int roaming_vendor_cmd_avail:1;
137  unsigned int dfs_vendor_cmd_avail:1;
138  unsigned int have_low_prio_scan:1;
139  unsigned int force_connect_cmd:1;
140  unsigned int addr_changed:1;
141  unsigned int get_features_vendor_cmd_avail:1;
142  unsigned int set_rekey_offload:1;
143  unsigned int p2p_go_ctwindow_supported:1;
144  unsigned int setband_vendor_cmd_avail:1;
145  unsigned int get_pref_freq_list:1;
146  unsigned int set_prob_oper_freq:1;
147 
148  u64 remain_on_chan_cookie;
149  u64 send_action_cookie;
150 
151  unsigned int last_mgmt_freq;
152 
153  struct wpa_driver_scan_filter *filter_ssids;
154  size_t num_filter_ssids;
155 
156  struct i802_bss *first_bss;
157 
158  int eapol_tx_sock;
159 
160  int eapol_sock; /* socket for EAPOL frames */
161 
162  struct nl_handle *rtnl_sk; /* nl_sock for NETLINK_ROUTE */
163 
164  int default_if_indices[16];
165  int *if_indices;
166  int num_if_indices;
167 
168  /* From failed authentication command */
169  int auth_freq;
170  u8 auth_bssid_[ETH_ALEN];
171  u8 auth_ssid[SSID_MAX_LEN];
172  size_t auth_ssid_len;
173  int auth_alg;
174  u8 *auth_ie;
175  size_t auth_ie_len;
176  u8 auth_wep_key[4][16];
177  size_t auth_wep_key_len[4];
178  int auth_wep_tx_keyidx;
179  int auth_local_state_change;
180  int auth_p2p;
181 };
182 
183 struct nl_msg;
184 
185 void * nl80211_cmd(struct wpa_driver_nl80211_data *drv,
186  struct nl_msg *msg, int flags, uint8_t cmd);
187 struct nl_msg * nl80211_cmd_msg(struct i802_bss *bss, int flags, uint8_t cmd);
188 struct nl_msg * nl80211_drv_msg(struct wpa_driver_nl80211_data *drv, int flags,
189  uint8_t cmd);
190 struct nl_msg * nl80211_bss_msg(struct i802_bss *bss, int flags, uint8_t cmd);
191 int send_and_recv_msgs(struct wpa_driver_nl80211_data *drv, struct nl_msg *msg,
192  int (*valid_handler)(struct nl_msg *, void *),
193  void *valid_data);
194 int nl80211_create_iface(struct wpa_driver_nl80211_data *drv,
195  const char *ifname, enum nl80211_iftype iftype,
196  const u8 *addr, int wds,
197  int (*handler)(struct nl_msg *, void *),
198  void *arg, int use_existing);
199 void nl80211_remove_iface(struct wpa_driver_nl80211_data *drv, int ifidx);
200 unsigned int nl80211_get_assoc_freq(struct wpa_driver_nl80211_data *drv);
201 enum chan_width convert2width(int width);
202 void nl80211_mark_disconnected(struct wpa_driver_nl80211_data *drv);
203 struct i802_bss * get_bss_ifindex(struct wpa_driver_nl80211_data *drv,
204  int ifindex);
205 int is_ap_interface(enum nl80211_iftype nlmode);
206 int is_sta_interface(enum nl80211_iftype nlmode);
207 int wpa_driver_nl80211_authenticate_retry(struct wpa_driver_nl80211_data *drv);
208 int nl80211_get_link_signal(struct wpa_driver_nl80211_data *drv,
209  struct wpa_signal_info *sig);
210 int nl80211_get_link_noise(struct wpa_driver_nl80211_data *drv,
211  struct wpa_signal_info *sig_change);
212 int nl80211_get_wiphy_index(struct i802_bss *bss);
213 int wpa_driver_nl80211_set_mode(struct i802_bss *bss,
214  enum nl80211_iftype nlmode);
215 int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv,
216  const u8 *addr, int cmd, u16 reason_code,
217  int local_state_change);
218 
219 int nl80211_create_monitor_interface(struct wpa_driver_nl80211_data *drv);
220 void nl80211_remove_monitor_interface(struct wpa_driver_nl80211_data *drv);
221 int nl80211_send_monitor(struct wpa_driver_nl80211_data *drv,
222  const void *data, size_t len,
223  int encrypt, int noack);
224 
225 int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv);
226 struct hostapd_hw_modes *
227 nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags);
228 
229 int process_global_event(struct nl_msg *msg, void *arg);
230 int process_bss_event(struct nl_msg *msg, void *arg);
231 
232 #ifdef ANDROID
233 int android_nl_socket_set_nonblocking(struct nl_handle *handle);
234 int android_pno_start(struct i802_bss *bss,
235  struct wpa_driver_scan_params *params);
236 int android_pno_stop(struct i802_bss *bss);
237 extern int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
238  size_t buf_len);
239 
240 #ifdef ANDROID_P2P
241 int wpa_driver_set_p2p_noa(void *priv, u8 count, int start, int duration);
242 int wpa_driver_get_p2p_noa(void *priv, u8 *buf, size_t len);
243 int wpa_driver_set_p2p_ps(void *priv, int legacy_ps, int opp_ps, int ctwindow);
244 int wpa_driver_set_ap_wps_p2p_ie(void *priv, const struct wpabuf *beacon,
245  const struct wpabuf *proberesp,
246  const struct wpabuf *assocresp);
247 #endif /* ANDROID_P2P */
248 #endif /* ANDROID */
249 
250 
251 /* driver_nl80211_scan.c */
252 
254  struct wpa_driver_nl80211_data *drv;
255  struct wpa_scan_results *res;
256  unsigned int assoc_freq;
257  unsigned int ibss_freq;
258  u8 assoc_bssid[ETH_ALEN];
259 };
260 
261 int bss_info_handler(struct nl_msg *msg, void *arg);
262 void wpa_driver_nl80211_scan_timeout(void *eloop_ctx, void *timeout_ctx);
263 int wpa_driver_nl80211_scan(struct i802_bss *bss,
264  struct wpa_driver_scan_params *params);
265 int wpa_driver_nl80211_sched_scan(void *priv,
266  struct wpa_driver_scan_params *params,
267  u32 interval);
268 int wpa_driver_nl80211_stop_sched_scan(void *priv);
270 void nl80211_dump_scan(struct wpa_driver_nl80211_data *drv);
271 const u8 * nl80211_get_ie(const u8 *ies, size_t ies_len, u8 ie);
272 
273 #endif /* DRIVER_NL80211_H */
void wpa_driver_nl80211_scan_timeout(void *eloop_ctx, void *timeout_ctx)
Scan timeout to report scan completion.
Definition: driver_nl80211_scan.c:89
Definition: driver_nl80211.h:37
int wpa_driver_nl80211_scan(struct i802_bss *bss, struct wpa_driver_scan_params *params)
Request the driver to initiate scan.
Definition: driver_nl80211_scan.c:210
Driver interface definition.
Scan parameters Data for struct wpa_driver_ops::scan2().
Definition: driver.h:306
const u8 * extended_capa
extended capabilities in driver/device
Definition: driver.h:1384
Definition: wpabuf.h:16
Definition: driver_nl80211.h:48
int wpa_driver_nl80211_stop_sched_scan(void *priv)
Stop a scheduled scan.
Definition: driver_nl80211_scan.c:408
Doubly-linked list.
Supported hardware mode information.
Definition: driver.h:132
Definition: driver_nl80211.h:23
Doubly-linked list.
Definition: list.h:12
int wpa_driver_nl80211_sched_scan(void *priv, struct wpa_driver_scan_params *params, u32 interval)
Initiate a scheduled scan.
Definition: driver_nl80211_scan.c:310
struct wpa_scan_results * wpa_driver_nl80211_get_scan_results(void *priv)
Fetch the latest scan results.
Definition: driver_nl80211_scan.c:746
Definition: driver_nl80211.h:253
Scan results.
Definition: driver.h:277
Information about channel signal quality.
Definition: driver.h:1607
Driver capability information.
Definition: driver.h:1196
Definition: rfkill.c:42
Definition: driver_nl80211.h:78