42#include <sys/malloc.h>
43#include <sys/kernel.h>
45#include <sys/socket.h>
46#include <sys/sockio.h>
47#include <sys/endian.h>
50#include <sys/sysctl.h>
53#include <net/if_var.h>
54#include <net/if_media.h>
55#include <net/if_llc.h>
56#include <net/ethernet.h>
63#ifdef IEEE80211_SUPPORT_SUPERG
108 struct mbuf *m, *next;
117 "%s",
"flush wds queue");
119 for (; m != NULL; m = next) {
134 "%s: creating link to %s on channel %u\n", __func__,
162 "%s: station %s went away\n",
174 "%s: station %s in use with %s\n",
228 return (ni == NULL ? ENOENT : 0);
239 const struct ether_header *eh = mtod(m,
const struct ether_header *);
246 KASSERT(ETHER_IS_MULTICAST(eh->ether_dhost),
247 (
"%s not mcast", ether_sprintf(eh->ether_dhost)));
250 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
257 if (ifp == m->m_pkthdr.rcvif)
262 mcopy = m_copypacket(m, M_NOWAIT);
264 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
271 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
279 eh->ether_dhost, NULL,
280 "%s",
"classification failure");
282 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
301 mcopy->m_flags |= M_MCAST;
302 MPASS((mcopy->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0);
303 mcopy->m_pkthdr.rcvif = (
void *) ni;
308 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
309 if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
310 if_inc_counter(ifp, IFCOUNTER_OBYTES,
336 MPASS((m->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0);
337 m->m_pkthdr.rcvif = (
void *)(uintptr_t)
418 struct ifnet *ifp = vap->
iv_ifp;
421 struct ether_header *eh;
422 int hdrspace, need_tap = 1;
423 uint8_t dir, type, subtype, qos;
424 int is_hw_decrypted = 0;
425 int has_decrypted = 0;
452 KASSERT(ni != NULL, (
"null node"));
459 "too short (1): len %u", m->m_pkthdr.len);
477 ni->
ni_macaddr, NULL,
"wrong version, fc %02x:%02x",
491 "too short (3): len %u", m->m_pkthdr.len);
500 wh->
i_addr1, NULL,
"%s",
"not to bss");
517 if (m->m_len < hdrspace &&
518 (m = m_pullup(m, hdrspace)) == NULL) {
521 "data too short: expecting %u", hdrspace);
527 wh,
"data",
"incorrect dir 0x%x", dir);
536 wh,
"data",
"%s",
"not legacy wds");
567 wh,
"WEP",
"%s",
"PRIVACY off");
578 wh->
i_fc[1] &= ~IEEE80211_FC1_PROTECTED;
638 eh = mtod(m,
struct ether_header *);
651 eh->ether_type != htons(ETHERTYPE_PAE)) {
654 "unknown port: ether type 0x%x len %u",
655 eh == NULL ? -1 : eh->ether_type,
667 ((has_decrypted == 0) && (m->m_flags &
M_WEP) == 0) &&
668 (is_hw_decrypted == 0) &&
670 eh->ether_type != htons(ETHERTYPE_PAE))) {
685#ifdef IEEE80211_SUPPORT_SUPERG
699 wh,
"data",
"incorrect dir 0x%x", dir);
710#ifdef IEEE80211_DEBUG
712 if_printf(ifp,
"received %s from %s rssi %d\n",
714 ether_sprintf(wh->
i_addr2), rssi);
719 wh, NULL,
"%s",
"WEP set but not permitted");
733 wh,
"bad",
"frame type 0x%x", type);
738 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
755 u_int8_t *frm, *efrm;
758 frm = (u_int8_t *)&wh[1];
759 efrm = mtod(m0, u_int8_t *) + m0->m_len;
765 wh, NULL,
"%s",
"unknown node");
770 wh, NULL,
"%s",
"not for us");
774 wh, NULL,
"wrong state %s",
796 wh, NULL,
"%s",
"not handled");
802 wh,
"mgt",
"subtype 0x%x not handled", subtype);
#define IEEE80211_RX_F_DECRYPTED
int ieee80211_chan2ieee(struct ieee80211com *ic, const struct ieee80211_channel *c)
uint32_t ieee80211_mac_hash(const struct ieee80211com *ic, const uint8_t addr[IEEE80211_ADDR_LEN])
#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ
#define IEEE80211_FC0_SUBTYPE_ACTION
#define IEEE80211_FC0_TYPE_CTL
#define IEEE80211_FC0_TYPE_MASK
#define IEEE80211_FC0_SUBTYPE_ATIM
#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ
#define IEEE80211_FC0_SUBTYPE_PROBE_REQ
#define IEEE80211_FC1_PROTECTED
#define IEEE80211_HAS_SEQ(type, subtype)
#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP
#define IEEE80211_FC0_VERSION_MASK
#define IEEE80211_FC0_SUBTYPE_DEAUTH
#define IEEE80211_FC1_DIR_DSTODS
#define IEEE80211_FC0_TYPE_MGT
#define IEEE80211_FC0_SUBTYPE_PROBE_RESP
#define IEEE80211_FC0_TYPE_DATA
#define IEEE80211_IS_MULTICAST(_a)
#define IEEE80211_QOS_HAS_SEQ(wh)
#define IEEE80211_FC0_SUBTYPE_TIMING_ADV
#define IEEE80211_FC0_SUBTYPE_DISASSOC
#define TID_TO_WME_AC(_tid)
#define IEEE80211_FC1_DIR_NODS
#define IEEE80211_FC1_DIR_MASK
#define IEEE80211_FC0_VERSION_0
#define IEEE80211_FC0_SUBTYPE_NODATA
#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP
#define IEEE80211_FC0_SUBTYPE_QOS
#define IEEE80211_FC0_SUBTYPE_ACTION_NOACK
#define IEEE80211_FC0_SUBTYPE_QOS_NULL
#define IEEE80211_QOS_AMSDU
#define IEEE80211_FC0_SUBTYPE_MASK
#define IEEE80211_FC0_SUBTYPE_BEACON
#define IEEE80211_FC0_SUBTYPE_AUTH
int ieee80211_ageq_append(struct ieee80211_ageq *aq, struct mbuf *m, int age)
struct mbuf * ieee80211_ageq_remove(struct ieee80211_ageq *aq, struct ieee80211_node *match)
int ieee80211_crypto_decap(struct ieee80211_node *ni, struct mbuf *m, int hdrlen, struct ieee80211_key **key)
int ieee80211_crypto_demic(struct ieee80211vap *vap, struct ieee80211_key *k, struct mbuf *m, int force)
void ieee80211_notify_node_join(struct ieee80211_node *ni, int newassoc)
void ieee80211_notify_wds_discover(struct ieee80211_node *ni)
int ieee80211_parent_xmitpkt(struct ieee80211com *ic, struct mbuf *m)
#define IEEE80211_TX_LOCK(_ic)
#define IEEE80211_LOCK_ASSERT(_ic)
#define IEEE80211_TX_UNLOCK(_ic)
#define IEEE80211_NODE_LOCK(_nt)
#define IEEE80211_NODE_UNLOCK(_nt)
int ieee80211_ampdu_reorder(struct ieee80211_node *ni, struct mbuf *m, const struct ieee80211_rx_stats *rxs)
struct mbuf * ieee80211_decap_amsdu(struct ieee80211_node *ni, struct mbuf *m)
void ieee80211_free_node(struct ieee80211_node *ni)
void ieee80211_reset_bss(struct ieee80211vap *vap)
void ieee80211_node_authorize(struct ieee80211_node *ni)
struct ieee80211_node * ieee80211_find_node_locked(struct ieee80211_node_table *nt, const uint8_t macaddr[IEEE80211_ADDR_LEN])
struct ieee80211_node * ieee80211_find_txnode(struct ieee80211vap *vap, const uint8_t macaddr[IEEE80211_ADDR_LEN])
struct ieee80211_node * ieee80211_node_create_wds(struct ieee80211vap *vap, const uint8_t bssid[IEEE80211_ADDR_LEN], struct ieee80211_channel *chan)
#define IEEE80211_RSSI_LPF(x, y)
static __inline int ieee80211_node_is_authorized(const struct ieee80211_node *ni)
#define IEEE80211_NODE_STAT(ni, stat)
static __inline struct ieee80211_node * ieee80211_ref_node(struct ieee80211_node *ni)
#define IEEE80211_NODE_AREF
struct mbuf * ieee80211_encap(struct ieee80211vap *vap, struct ieee80211_node *ni, struct mbuf *m)
int ieee80211_classify(struct ieee80211_node *ni, struct mbuf *m)
const char * ieee80211_state_name[IEEE80211_S_MAX]
#define ieee80211_input(ni, m, rssi, nf)
static __inline uint8_t ieee80211_gettid(const struct ieee80211_frame *wh)
static __inline uint8_t * ieee80211_getqos(void *data)
static __inline const char * ieee80211_mgt_subtype_name(uint8_t subtype)
void ieee80211_radiotap_rx(struct ieee80211vap *vap0, struct mbuf *m)
void ieee80211_cancel_scan(struct ieee80211vap *vap)
int ieee80211_check_scan_current(struct ieee80211vap *vap)
static __inline struct mbuf * ieee80211_decap_fastframe(struct ieee80211vap *vap, struct ieee80211_node *ni, struct mbuf *m)
static __inline int ieee80211_radiotap_active_vap(const struct ieee80211vap *vap)
#define IEEE80211_MSG_STATE
#define IEEE80211_F_DESBSSID
#define IEEE80211_MSG_OUTPUT
static __inline int ieee80211_hdrspace(struct ieee80211com *ic, const void *data)
#define IEEE80211_MSG_ANY
#define IEEE80211_FEXT_WDSLEGACY
#define IEEE80211_ADDR_EQ(a1, a2)
#define IEEE80211_F_PRIVACY
#define IEEE80211_NOTE(_vap, _m, _ni, _fmt,...)
#define IEEE80211_DISCARD_MAC(_vap, _m, _mac, _type, _fmt,...)
#define IEEE80211_DPRINTF(_vap, _m, _fmt,...)
#define IEEE80211_MSG_INPUT
#define IEEE80211_MSG_WDS
#define IEEE80211_DISCARD(_vap, _m, _wh, _type, _fmt,...)
#define ieee80211_msg_dumppkts(_vap)
#define IEEE80211_F_DROPUNENC
static void wds_vdetach(struct ieee80211vap *vap)
static void wds_recv_mgmt(struct ieee80211_node *, struct mbuf *, int subtype, const struct ieee80211_rx_stats *, int, int)
void ieee80211_wds_attach(struct ieee80211com *ic)
void ieee80211_wds_detach(struct ieee80211com *ic)
static int wds_newstate(struct ieee80211vap *, enum ieee80211_state, int)
static int ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan)
void ieee80211_dwds_discover(struct ieee80211_node *ni, struct mbuf *m)
static int wds_input(struct ieee80211_node *ni, struct mbuf *m, const struct ieee80211_rx_stats *rxs, int, int)
static void wds_vattach(struct ieee80211vap *)
static void wds_flush(struct ieee80211_node *ni)
void ieee80211_dwds_mcast(struct ieee80211vap *vap0, struct mbuf *m)
void(* ia_node_join)(struct ieee80211_node *)
uint8_t i_addr1[IEEE80211_ADDR_LEN]
uint8_t i_addr2[IEEE80211_ADDR_LEN]
struct ieee80211com * ni_ic
uint8_t ni_macaddr[IEEE80211_ADDR_LEN]
struct ieee80211vap * ni_vap
struct ieee80211vap * ni_wdsvap
uint32_t is_rx_badversion
uint32_t is_rx_badsubtype
uint32_t is_rx_mgtdiscard
uint32_t is_rx_unencrypted
void(* ic_node_getsignal)(const struct ieee80211_node *, int8_t *, int8_t *)
ieee80211vap_attach ic_vattach[IEEE80211_OPMODE_MAX]
struct ieee80211_node_table ic_sta
struct ieee80211_ageq ic_stageq
struct ieee80211_wme_state ic_wme
int(* ic_recv_action)(struct ieee80211_node *, const struct ieee80211_frame *, const uint8_t *frm, const uint8_t *efrm)
struct ieee80211_channel * ic_curchan
void(* ic_newassoc)(struct ieee80211_node *, int)
struct ieee80211com * iv_ic
struct ieee80211_node * iv_bss
enum ieee80211_opmode iv_opmode
uint8_t iv_myaddr[IEEE80211_ADDR_LEN]
struct ieee80211_stats iv_stats
void(* iv_recv_mgmt)(struct ieee80211_node *, struct mbuf *, int, const struct ieee80211_rx_stats *, int, int)
const struct ieee80211_authenticator * iv_auth
uint8_t iv_des_bssid[IEEE80211_ADDR_LEN]
enum ieee80211_state iv_state
void(* iv_opdetach)(struct ieee80211vap *)
int(* iv_input)(struct ieee80211_node *, struct mbuf *, const struct ieee80211_rx_stats *, int, int)
struct callout iv_mgtsend
int(* iv_newstate)(struct ieee80211vap *, enum ieee80211_state, int)