2 * Driver interaction with Linux nl80211/cfg80211
3 * Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
4 * Copyright (c) 2003-2004, Instant802 Networks, Inc.
5 * Copyright (c) 2005-2006, Devicescape Software, Inc.
6 * Copyright (c) 2007, Johannes Berg <johannes@sipsolutions.net>
7 * Copyright (c) 2009-2010, Atheros Communications
9 * This software may be distributed under the terms of the BSD license.
10 * See README for more details.
13 #ifndef _DRIVER_NL80211_H_
14 #define _DRIVER_NL80211_H_
17 #include <sys/ioctl.h>
18 #include <sys/types.h>
22 #include <netlink/genl/genl.h>
23 #include <netlink/genl/family.h>
24 #include <netlink/genl/ctrl.h>
25 #include <linux/rtnetlink.h>
26 #include <netpacket/packet.h>
27 #include <linux/filter.h>
28 #include <linux/errqueue.h>
29 #include "nl80211_copy.h"
33 #include "utils/list.h"
34 #include "common/qca-vendor.h"
35 #include "common/ieee802_11_defs.h"
36 #include "common/ieee802_11_common.h"
37 #include "l2_packet/l2_packet.h"
39 #include "linux_ioctl.h"
41 #include "radiotap_iter.h"
46 /* libnl 2.0 compatibility code */
47 #define nl_handle nl_sock
48 #define nl80211_handle_alloc nl_socket_alloc_cb
49 #define nl80211_handle_destroy nl_socket_free
50 #endif /* CONFIG_LIBNL20 */
53 #define IFF_LOWER_UP 0x10000 /* driver signals L1 up */
56 #define IFF_DORMANT 0x20000 /* driver signals dormant */
59 #ifndef IF_OPER_DORMANT
60 #define IF_OPER_DORMANT 5
66 struct nl80211_global {
67 struct dl_list interfaces;
70 int if_add_wdevid_set;
71 struct netlink_data *netlink;
75 int ioctl_sock; /* socket for ioctl() use */
77 struct nl_handle *nl_event;
80 struct nl80211_wiphy_data {
85 struct nl_handle *nl_beacons;
92 struct wpa_driver_nl80211_data *drv;
93 struct i802_bss *next;
96 char ifname[IFNAMSIZ + 1];
97 char brname[IFNAMSIZ];
98 unsigned int beacon_set:1;
99 unsigned int added_if_into_bridge:1;
100 unsigned int added_bridge:1;
101 unsigned int in_deinit:1;
102 unsigned int wdev_id_set:1;
103 unsigned int added_if:1;
111 struct nl_handle *nl_preq, *nl_mgmt;
114 struct nl80211_wiphy_data *wiphy_data;
115 struct dl_list wiphy_list;
118 struct wpa_driver_nl80211_data {
119 struct nl80211_global *global;
121 struct dl_list wiphy_list;
127 int ignore_if_down_event;
128 struct rfkill_data *rfkill;
129 struct wpa_driver_capa capa;
130 u8 *extended_capa, *extended_capa_mask;
131 unsigned int extended_capa_len;
136 int scan_complete_events;
138 NO_SCAN, SCAN_REQUESTED, SCAN_STARTED, SCAN_COMPLETED,
139 SCAN_ABORTED, SCHED_SCAN_STARTED, SCHED_SCAN_STOPPED,
145 u8 auth_bssid[ETH_ALEN];
146 u8 auth_attempt_bssid[ETH_ALEN];
148 u8 prev_bssid[ETH_ALEN];
152 enum nl80211_iftype nlmode;
153 enum nl80211_iftype ap_scan_as_station;
154 unsigned int assoc_freq;
158 int monitor_refcount;
160 unsigned int disabled_11b_rates:1;
161 unsigned int pending_remain_on_chan:1;
162 unsigned int in_interface_list:1;
163 unsigned int device_ap_sme:1;
164 unsigned int poll_command_supported:1;
165 unsigned int data_tx_status:1;
166 unsigned int scan_for_auth:1;
167 unsigned int retry_auth:1;
168 unsigned int use_monitor:1;
169 unsigned int ignore_next_local_disconnect:1;
170 unsigned int allow_p2p_device:1;
171 unsigned int hostapd:1;
172 unsigned int start_mode_ap:1;
173 unsigned int start_iface_up:1;
175 u64 remain_on_chan_cookie;
176 u64 send_action_cookie;
178 unsigned int last_mgmt_freq;
180 struct wpa_driver_scan_filter *filter_ssids;
181 size_t num_filter_ssids;
183 struct i802_bss *first_bss;
187 int eapol_sock; /* socket for EAPOL frames */
189 int default_if_indices[16];
193 /* From failed authentication command */
195 u8 auth_bssid_[ETH_ALEN];
197 size_t auth_ssid_len;
201 u8 auth_wep_key[4][16];
202 size_t auth_wep_key_len[4];
203 int auth_wep_tx_keyidx;
204 int auth_local_state_change;