1 /*- 2 * Copyright (c) 2003-2008 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * 25 * $FreeBSD$ 26 */ 27 #ifndef _NET80211_IEEE80211_FREEBSD_H_ 28 #define _NET80211_IEEE80211_FREEBSD_H_ 29 30 #ifdef _KERNEL 31 #include <sys/param.h> 32 #include <sys/lock.h> 33 #include <sys/mutex.h> 34 #include <sys/rwlock.h> 35 #include <sys/sysctl.h> 36 #include <sys/taskqueue.h> 37 38 /* 39 * Common state locking definitions. 40 */ 41 typedef struct { 42 char name[16]; /* e.g. "ath0_com_lock" */ 43 struct mtx mtx; 44 } ieee80211_com_lock_t; 45 #define IEEE80211_LOCK_INIT(_ic, _name) do { \ 46 ieee80211_com_lock_t *cl = &(_ic)->ic_comlock; \ 47 snprintf(cl->name, sizeof(cl->name), "%s_com_lock", _name); \ 48 mtx_init(&cl->mtx, cl->name, NULL, MTX_DEF | MTX_RECURSE); \ 49 } while (0) 50 #define IEEE80211_LOCK_OBJ(_ic) (&(_ic)->ic_comlock.mtx) 51 #define IEEE80211_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_LOCK_OBJ(_ic)) 52 #define IEEE80211_LOCK(_ic) mtx_lock(IEEE80211_LOCK_OBJ(_ic)) 53 #define IEEE80211_UNLOCK(_ic) mtx_unlock(IEEE80211_LOCK_OBJ(_ic)) 54 #define IEEE80211_LOCK_ASSERT(_ic) \ 55 mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED) 56 57 /* 58 * Node locking definitions. 59 */ 60 typedef struct { 61 char name[16]; /* e.g. "ath0_node_lock" */ 62 struct mtx mtx; 63 } ieee80211_node_lock_t; 64 #define IEEE80211_NODE_LOCK_INIT(_nt, _name) do { \ 65 ieee80211_node_lock_t *nl = &(_nt)->nt_nodelock; \ 66 snprintf(nl->name, sizeof(nl->name), "%s_node_lock", _name); \ 67 mtx_init(&nl->mtx, nl->name, NULL, MTX_DEF | MTX_RECURSE); \ 68 } while (0) 69 #define IEEE80211_NODE_LOCK_OBJ(_nt) (&(_nt)->nt_nodelock.mtx) 70 #define IEEE80211_NODE_LOCK_DESTROY(_nt) \ 71 mtx_destroy(IEEE80211_NODE_LOCK_OBJ(_nt)) 72 #define IEEE80211_NODE_LOCK(_nt) \ 73 mtx_lock(IEEE80211_NODE_LOCK_OBJ(_nt)) 74 #define IEEE80211_NODE_IS_LOCKED(_nt) \ 75 mtx_owned(IEEE80211_NODE_LOCK_OBJ(_nt)) 76 #define IEEE80211_NODE_UNLOCK(_nt) \ 77 mtx_unlock(IEEE80211_NODE_LOCK_OBJ(_nt)) 78 #define IEEE80211_NODE_LOCK_ASSERT(_nt) \ 79 mtx_assert(IEEE80211_NODE_LOCK_OBJ(_nt), MA_OWNED) 80 81 /* 82 * Node table iteration locking definitions; this protects the 83 * scan generation # used to iterate over the station table 84 * while grabbing+releasing the node lock. 85 */ 86 typedef struct { 87 char name[16]; /* e.g. "ath0_scan_lock" */ 88 struct mtx mtx; 89 } ieee80211_scan_lock_t; 90 #define IEEE80211_NODE_ITERATE_LOCK_INIT(_nt, _name) do { \ 91 ieee80211_scan_lock_t *sl = &(_nt)->nt_scanlock; \ 92 snprintf(sl->name, sizeof(sl->name), "%s_scan_lock", _name); \ 93 mtx_init(&sl->mtx, sl->name, NULL, MTX_DEF); \ 94 } while (0) 95 #define IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt) (&(_nt)->nt_scanlock.mtx) 96 #define IEEE80211_NODE_ITERATE_LOCK_DESTROY(_nt) \ 97 mtx_destroy(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)) 98 #define IEEE80211_NODE_ITERATE_LOCK(_nt) \ 99 mtx_lock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)) 100 #define IEEE80211_NODE_ITERATE_UNLOCK(_nt) \ 101 mtx_unlock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)) 102 103 /* 104 * Power-save queue definitions. 105 */ 106 typedef struct mtx ieee80211_psq_lock_t; 107 #define IEEE80211_PSQ_INIT(_psq, _name) \ 108 mtx_init(&(_psq)->psq_lock, _name, "802.11 ps q", MTX_DEF) 109 #define IEEE80211_PSQ_DESTROY(_psq) mtx_destroy(&(_psq)->psq_lock) 110 #define IEEE80211_PSQ_LOCK(_psq) mtx_lock(&(_psq)->psq_lock) 111 #define IEEE80211_PSQ_UNLOCK(_psq) mtx_unlock(&(_psq)->psq_lock) 112 113 #ifndef IF_PREPEND_LIST 114 #define _IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \ 115 (mtail)->m_nextpkt = (ifq)->ifq_head; \ 116 if ((ifq)->ifq_tail == NULL) \ 117 (ifq)->ifq_tail = (mtail); \ 118 (ifq)->ifq_head = (mhead); \ 119 (ifq)->ifq_len += (mcount); \ 120 } while (0) 121 #define IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \ 122 IF_LOCK(ifq); \ 123 _IF_PREPEND_LIST(ifq, mhead, mtail, mcount); \ 124 IF_UNLOCK(ifq); \ 125 } while (0) 126 #endif /* IF_PREPEND_LIST */ 127 128 /* 129 * Age queue definitions. 130 */ 131 typedef struct mtx ieee80211_ageq_lock_t; 132 #define IEEE80211_AGEQ_INIT(_aq, _name) \ 133 mtx_init(&(_aq)->aq_lock, _name, "802.11 age q", MTX_DEF) 134 #define IEEE80211_AGEQ_DESTROY(_aq) mtx_destroy(&(_aq)->aq_lock) 135 #define IEEE80211_AGEQ_LOCK(_aq) mtx_lock(&(_aq)->aq_lock) 136 #define IEEE80211_AGEQ_UNLOCK(_aq) mtx_unlock(&(_aq)->aq_lock) 137 138 /* 139 * 802.1x MAC ACL database locking definitions. 140 */ 141 typedef struct mtx acl_lock_t; 142 #define ACL_LOCK_INIT(_as, _name) \ 143 mtx_init(&(_as)->as_lock, _name, "802.11 ACL", MTX_DEF) 144 #define ACL_LOCK_DESTROY(_as) mtx_destroy(&(_as)->as_lock) 145 #define ACL_LOCK(_as) mtx_lock(&(_as)->as_lock) 146 #define ACL_UNLOCK(_as) mtx_unlock(&(_as)->as_lock) 147 #define ACL_LOCK_ASSERT(_as) \ 148 mtx_assert((&(_as)->as_lock), MA_OWNED) 149 150 /* 151 * Node reference counting definitions. 152 * 153 * ieee80211_node_initref initialize the reference count to 1 154 * ieee80211_node_incref add a reference 155 * ieee80211_node_decref remove a reference 156 * ieee80211_node_dectestref remove a reference and return 1 if this 157 * is the last reference, otherwise 0 158 * ieee80211_node_refcnt reference count for printing (only) 159 */ 160 #include <machine/atomic.h> 161 162 #define ieee80211_node_initref(_ni) \ 163 do { ((_ni)->ni_refcnt = 1); } while (0) 164 #define ieee80211_node_incref(_ni) \ 165 atomic_add_int(&(_ni)->ni_refcnt, 1) 166 #define ieee80211_node_decref(_ni) \ 167 atomic_subtract_int(&(_ni)->ni_refcnt, 1) 168 struct ieee80211_node; 169 int ieee80211_node_dectestref(struct ieee80211_node *ni); 170 #define ieee80211_node_refcnt(_ni) (_ni)->ni_refcnt 171 172 struct ifqueue; 173 struct ieee80211vap; 174 void ieee80211_drain_ifq(struct ifqueue *); 175 void ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *); 176 177 void ieee80211_vap_destroy(struct ieee80211vap *); 178 179 #define IFNET_IS_UP_RUNNING(_ifp) \ 180 (((_ifp)->if_flags & IFF_UP) && \ 181 ((_ifp)->if_drv_flags & IFF_DRV_RUNNING)) 182 183 #define msecs_to_ticks(ms) (((ms)*hz)/1000) 184 #define ticks_to_msecs(t) (1000*(t) / hz) 185 #define ticks_to_secs(t) ((t) / hz) 186 #define time_after(a,b) ((long)(b) - (long)(a) < 0) 187 #define time_before(a,b) time_after(b,a) 188 #define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0) 189 #define time_before_eq(a,b) time_after_eq(b,a) 190 191 struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen); 192 193 /* tx path usage */ 194 #define M_ENCAP M_PROTO1 /* 802.11 encap done */ 195 #define M_EAPOL M_PROTO3 /* PAE/EAPOL frame */ 196 #define M_PWR_SAV M_PROTO4 /* bypass PS handling */ 197 #define M_MORE_DATA M_PROTO5 /* more data frames to follow */ 198 #define M_FF M_PROTO6 /* fast frame */ 199 #define M_TXCB M_PROTO7 /* do tx complete callback */ 200 #define M_AMPDU_MPDU M_PROTO8 /* ok for A-MPDU aggregation */ 201 #define M_80211_TX \ 202 (M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_ENCAP|M_EAPOL|M_PWR_SAV|\ 203 M_MORE_DATA|M_FF|M_TXCB|M_AMPDU_MPDU) 204 205 /* rx path usage */ 206 #define M_AMPDU M_PROTO1 /* A-MPDU subframe */ 207 #define M_WEP M_PROTO2 /* WEP done by hardware */ 208 #if 0 209 #define M_AMPDU_MPDU M_PROTO8 /* A-MPDU re-order done */ 210 #endif 211 #define M_80211_RX (M_AMPDU|M_WEP|M_AMPDU_MPDU) 212 213 #define IEEE80211_MBUF_TX_FLAG_BITS \ 214 "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_ENCAP\6M_WEP\7M_EAPOL" \ 215 "\10M_PWR_SAV\11M_MORE_DATA\12M_BCAST\13M_MCAST\14M_FRAG\15M_FIRSTFRAG" \ 216 "\16M_LASTFRAG\17M_SKIP_FIREWALL\20M_FREELIST\21M_VLANTAG\22M_PROMISC" \ 217 "\23M_NOFREE\24M_FF\25M_TXCB\26M_AMPDU_MPDU\27M_FLOWID" 218 219 #define IEEE80211_MBUF_RX_FLAG_BITS \ 220 "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_AMPDU\6M_WEP\7M_PROTO3" \ 221 "\10M_PROTO4\11M_PROTO5\12M_BCAST\13M_MCAST\14M_FRAG\15M_FIRSTFRAG" \ 222 "\16M_LASTFRAG\17M_SKIP_FIREWALL\20M_FREELIST\21M_VLANTAG\22M_PROMISC" \ 223 "\23M_NOFREE\24M_PROTO6\25M_PROTO7\26M_AMPDU_MPDU\27M_FLOWID" 224 225 /* 226 * Store WME access control bits in the vlan tag. 227 * This is safe since it's done after the packet is classified 228 * (where we use any previous tag) and because it's passed 229 * directly in to the driver and there's no chance someone 230 * else will clobber them on us. 231 */ 232 #define M_WME_SETAC(m, ac) \ 233 ((m)->m_pkthdr.ether_vtag = (ac)) 234 #define M_WME_GETAC(m) ((m)->m_pkthdr.ether_vtag) 235 236 /* 237 * Mbufs on the power save queue are tagged with an age and 238 * timed out. We reuse the hardware checksum field in the 239 * mbuf packet header to store this data. 240 */ 241 #define M_AGE_SET(m,v) (m->m_pkthdr.csum_data = v) 242 #define M_AGE_GET(m) (m->m_pkthdr.csum_data) 243 #define M_AGE_SUB(m,adj) (m->m_pkthdr.csum_data -= adj) 244 245 /* 246 * Store the sequence number. 247 */ 248 #define M_SEQNO_SET(m, seqno) \ 249 ((m)->m_pkthdr.tso_segsz = (seqno)) 250 #define M_SEQNO_GET(m) ((m)->m_pkthdr.tso_segsz) 251 252 #define MTAG_ABI_NET80211 1132948340 /* net80211 ABI */ 253 254 struct ieee80211_cb { 255 void (*func)(struct ieee80211_node *, void *, int status); 256 void *arg; 257 }; 258 #define NET80211_TAG_CALLBACK 0 /* xmit complete callback */ 259 int ieee80211_add_callback(struct mbuf *m, 260 void (*func)(struct ieee80211_node *, void *, int), void *arg); 261 void ieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int); 262 263 void get_random_bytes(void *, size_t); 264 265 struct ieee80211com; 266 267 void ieee80211_sysctl_attach(struct ieee80211com *); 268 void ieee80211_sysctl_detach(struct ieee80211com *); 269 void ieee80211_sysctl_vattach(struct ieee80211vap *); 270 void ieee80211_sysctl_vdetach(struct ieee80211vap *); 271 272 SYSCTL_DECL(_net_wlan); 273 int ieee80211_sysctl_msecs_ticks(SYSCTL_HANDLER_ARGS); 274 275 void ieee80211_load_module(const char *); 276 277 /* 278 * A "policy module" is an adjunct module to net80211 that provides 279 * functionality that typically includes policy decisions. This 280 * modularity enables extensibility and vendor-supplied functionality. 281 */ 282 #define _IEEE80211_POLICY_MODULE(policy, name, version) \ 283 typedef void (*policy##_setup)(int); \ 284 SET_DECLARE(policy##_set, policy##_setup); \ 285 static int \ 286 wlan_##name##_modevent(module_t mod, int type, void *unused) \ 287 { \ 288 policy##_setup * const *iter, f; \ 289 switch (type) { \ 290 case MOD_LOAD: \ 291 SET_FOREACH(iter, policy##_set) { \ 292 f = (void*) *iter; \ 293 f(type); \ 294 } \ 295 return 0; \ 296 case MOD_UNLOAD: \ 297 case MOD_QUIESCE: \ 298 if (nrefs) { \ 299 printf("wlan_##name: still in use (%u dynamic refs)\n",\ 300 nrefs); \ 301 return EBUSY; \ 302 } \ 303 if (type == MOD_UNLOAD) { \ 304 SET_FOREACH(iter, policy##_set) { \ 305 f = (void*) *iter; \ 306 f(type); \ 307 } \ 308 } \ 309 return 0; \ 310 } \ 311 return EINVAL; \ 312 } \ 313 static moduledata_t name##_mod = { \ 314 "wlan_" #name, \ 315 wlan_##name##_modevent, \ 316 0 \ 317 }; \ 318 DECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\ 319 MODULE_VERSION(wlan_##name, version); \ 320 MODULE_DEPEND(wlan_##name, wlan, 1, 1, 1) 321 322 /* 323 * Crypto modules implement cipher support. 324 */ 325 #define IEEE80211_CRYPTO_MODULE(name, version) \ 326 _IEEE80211_POLICY_MODULE(crypto, name, version); \ 327 static void \ 328 name##_modevent(int type) \ 329 { \ 330 if (type == MOD_LOAD) \ 331 ieee80211_crypto_register(&name); \ 332 else \ 333 ieee80211_crypto_unregister(&name); \ 334 } \ 335 TEXT_SET(crypto##_set, name##_modevent) 336 337 /* 338 * Scanner modules provide scanning policy. 339 */ 340 #define IEEE80211_SCANNER_MODULE(name, version) \ 341 _IEEE80211_POLICY_MODULE(scanner, name, version) 342 343 #define IEEE80211_SCANNER_ALG(name, alg, v) \ 344 static void \ 345 name##_modevent(int type) \ 346 { \ 347 if (type == MOD_LOAD) \ 348 ieee80211_scanner_register(alg, &v); \ 349 else \ 350 ieee80211_scanner_unregister(alg, &v); \ 351 } \ 352 TEXT_SET(scanner_set, name##_modevent); \ 353 354 /* 355 * ACL modules implement acl policy. 356 */ 357 #define IEEE80211_ACL_MODULE(name, alg, version) \ 358 _IEEE80211_POLICY_MODULE(acl, name, version); \ 359 static void \ 360 alg##_modevent(int type) \ 361 { \ 362 if (type == MOD_LOAD) \ 363 ieee80211_aclator_register(&alg); \ 364 else \ 365 ieee80211_aclator_unregister(&alg); \ 366 } \ 367 TEXT_SET(acl_set, alg##_modevent); \ 368 369 /* 370 * Authenticator modules handle 802.1x/WPA authentication. 371 */ 372 #define IEEE80211_AUTH_MODULE(name, version) \ 373 _IEEE80211_POLICY_MODULE(auth, name, version) 374 375 #define IEEE80211_AUTH_ALG(name, alg, v) \ 376 static void \ 377 name##_modevent(int type) \ 378 { \ 379 if (type == MOD_LOAD) \ 380 ieee80211_authenticator_register(alg, &v); \ 381 else \ 382 ieee80211_authenticator_unregister(alg); \ 383 } \ 384 TEXT_SET(auth_set, name##_modevent) 385 386 /* 387 * Rate control modules provide tx rate control support. 388 */ 389 #define IEEE80211_RATE_MODULE(alg, version) \ 390 _IEEE80211_POLICY_MODULE(rate, alg, version); \ 391 static void \ 392 alg##_modevent(int type) \ 393 { \ 394 /* XXX nothing to do until the rate control framework arrives */\ 395 } \ 396 TEXT_SET(rate##_set, alg##_modevent) 397 398 struct ieee80211req; 399 typedef int ieee80211_ioctl_getfunc(struct ieee80211vap *, 400 struct ieee80211req *); 401 SET_DECLARE(ieee80211_ioctl_getset, ieee80211_ioctl_getfunc); 402 #define IEEE80211_IOCTL_GET(_name, _get) TEXT_SET(ieee80211_ioctl_getset, _get) 403 404 typedef int ieee80211_ioctl_setfunc(struct ieee80211vap *, 405 struct ieee80211req *); 406 SET_DECLARE(ieee80211_ioctl_setset, ieee80211_ioctl_setfunc); 407 #define IEEE80211_IOCTL_SET(_name, _set) TEXT_SET(ieee80211_ioctl_setset, _set) 408 #endif /* _KERNEL */ 409 410 /* XXX this stuff belongs elsewhere */ 411 /* 412 * Message formats for messages from the net80211 layer to user 413 * applications via the routing socket. These messages are appended 414 * to an if_announcemsghdr structure. 415 */ 416 struct ieee80211_join_event { 417 uint8_t iev_addr[6]; 418 }; 419 420 struct ieee80211_leave_event { 421 uint8_t iev_addr[6]; 422 }; 423 424 struct ieee80211_replay_event { 425 uint8_t iev_src[6]; /* src MAC */ 426 uint8_t iev_dst[6]; /* dst MAC */ 427 uint8_t iev_cipher; /* cipher type */ 428 uint8_t iev_keyix; /* key id/index */ 429 uint64_t iev_keyrsc; /* RSC from key */ 430 uint64_t iev_rsc; /* RSC from frame */ 431 }; 432 433 struct ieee80211_michael_event { 434 uint8_t iev_src[6]; /* src MAC */ 435 uint8_t iev_dst[6]; /* dst MAC */ 436 uint8_t iev_cipher; /* cipher type */ 437 uint8_t iev_keyix; /* key id/index */ 438 }; 439 440 struct ieee80211_wds_event { 441 uint8_t iev_addr[6]; 442 }; 443 444 struct ieee80211_csa_event { 445 uint32_t iev_flags; /* channel flags */ 446 uint16_t iev_freq; /* setting in Mhz */ 447 uint8_t iev_ieee; /* IEEE channel number */ 448 uint8_t iev_mode; /* CSA mode */ 449 uint8_t iev_count; /* CSA count */ 450 }; 451 452 struct ieee80211_cac_event { 453 uint32_t iev_flags; /* channel flags */ 454 uint16_t iev_freq; /* setting in Mhz */ 455 uint8_t iev_ieee; /* IEEE channel number */ 456 /* XXX timestamp? */ 457 uint8_t iev_type; /* IEEE80211_NOTIFY_CAC_* */ 458 }; 459 460 struct ieee80211_radar_event { 461 uint32_t iev_flags; /* channel flags */ 462 uint16_t iev_freq; /* setting in Mhz */ 463 uint8_t iev_ieee; /* IEEE channel number */ 464 /* XXX timestamp? */ 465 }; 466 467 struct ieee80211_auth_event { 468 uint8_t iev_addr[6]; 469 }; 470 471 struct ieee80211_deauth_event { 472 uint8_t iev_addr[6]; 473 }; 474 475 struct ieee80211_country_event { 476 uint8_t iev_addr[6]; 477 uint8_t iev_cc[2]; /* ISO country code */ 478 }; 479 480 struct ieee80211_radio_event { 481 uint8_t iev_state; /* 1 on, 0 off */ 482 }; 483 484 #define RTM_IEEE80211_ASSOC 100 /* station associate (bss mode) */ 485 #define RTM_IEEE80211_REASSOC 101 /* station re-associate (bss mode) */ 486 #define RTM_IEEE80211_DISASSOC 102 /* station disassociate (bss mode) */ 487 #define RTM_IEEE80211_JOIN 103 /* station join (ap mode) */ 488 #define RTM_IEEE80211_LEAVE 104 /* station leave (ap mode) */ 489 #define RTM_IEEE80211_SCAN 105 /* scan complete, results available */ 490 #define RTM_IEEE80211_REPLAY 106 /* sequence counter replay detected */ 491 #define RTM_IEEE80211_MICHAEL 107 /* Michael MIC failure detected */ 492 #define RTM_IEEE80211_REJOIN 108 /* station re-associate (ap mode) */ 493 #define RTM_IEEE80211_WDS 109 /* WDS discovery (ap mode) */ 494 #define RTM_IEEE80211_CSA 110 /* Channel Switch Announcement event */ 495 #define RTM_IEEE80211_RADAR 111 /* radar event */ 496 #define RTM_IEEE80211_CAC 112 /* Channel Availability Check event */ 497 #define RTM_IEEE80211_DEAUTH 113 /* station deauthenticate */ 498 #define RTM_IEEE80211_AUTH 114 /* station authenticate (ap mode) */ 499 #define RTM_IEEE80211_COUNTRY 115 /* discovered country code (sta mode) */ 500 #define RTM_IEEE80211_RADIO 116 /* RF kill switch state change */ 501 502 /* 503 * Structure prepended to raw packets sent through the bpf 504 * interface when set to DLT_IEEE802_11_RADIO. This allows 505 * user applications to specify pretty much everything in 506 * an Atheros tx descriptor. XXX need to generalize. 507 * 508 * XXX cannot be more than 14 bytes as it is copied to a sockaddr's 509 * XXX sa_data area. 510 */ 511 struct ieee80211_bpf_params { 512 uint8_t ibp_vers; /* version */ 513 #define IEEE80211_BPF_VERSION 0 514 uint8_t ibp_len; /* header length in bytes */ 515 uint8_t ibp_flags; 516 #define IEEE80211_BPF_SHORTPRE 0x01 /* tx with short preamble */ 517 #define IEEE80211_BPF_NOACK 0x02 /* tx with no ack */ 518 #define IEEE80211_BPF_CRYPTO 0x04 /* tx with h/w encryption */ 519 #define IEEE80211_BPF_FCS 0x10 /* frame incldues FCS */ 520 #define IEEE80211_BPF_DATAPAD 0x20 /* frame includes data padding */ 521 #define IEEE80211_BPF_RTS 0x40 /* tx with RTS/CTS */ 522 #define IEEE80211_BPF_CTS 0x80 /* tx with CTS only */ 523 uint8_t ibp_pri; /* WME/WMM AC+tx antenna */ 524 uint8_t ibp_try0; /* series 1 try count */ 525 uint8_t ibp_rate0; /* series 1 IEEE tx rate */ 526 uint8_t ibp_power; /* tx power (device units) */ 527 uint8_t ibp_ctsrate; /* IEEE tx rate for CTS */ 528 uint8_t ibp_try1; /* series 2 try count */ 529 uint8_t ibp_rate1; /* series 2 IEEE tx rate */ 530 uint8_t ibp_try2; /* series 3 try count */ 531 uint8_t ibp_rate2; /* series 3 IEEE tx rate */ 532 uint8_t ibp_try3; /* series 4 try count */ 533 uint8_t ibp_rate3; /* series 4 IEEE tx rate */ 534 }; 535 #endif /* _NET80211_IEEE80211_FREEBSD_H_ */ 536