From b1acbdbbbbf18f18bf4dfb66f28059fcc10dd99a Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Wed, 5 Sep 2007 20:22:59 +0000 Subject: [PATCH] o add M_WEP mbuf flag so drivers can mark frames that are decrypted by the device and have had the crypto bits stripped from the 802.11 header o strip mbuf flags in the rx path before passing up the stack Reviewed by: thompsa, sephe, avatar Approved by: re (blanket wireless) --- sys/net80211/ieee80211_freebsd.h | 5 +++++ sys/net80211/ieee80211_input.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h index 46a15d5a05e..005f61dadb0 100644 --- a/sys/net80211/ieee80211_freebsd.h +++ b/sys/net80211/ieee80211_freebsd.h @@ -184,14 +184,19 @@ void ieee80211_drain_ifq(struct ifqueue *); #define time_before_eq(a,b) time_after_eq(b,a) struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen); + /* tx path usage */ #define M_LINK0 M_PROTO1 /* WEP requested */ #define M_PWR_SAV M_PROTO4 /* bypass PS handling */ #define M_MORE_DATA M_PROTO5 /* more data frames to follow */ #define M_FF 0x20000 /* fast frame */ #define M_TXCB 0x40000 /* do tx complete callback */ +#define M_80211_TX (0x60000|M_PROTO1|M_WME_AC_MASK|M_PROTO4|M_PROTO5) + /* rx path usage */ #define M_AMPDU M_PROTO1 /* A-MPDU processing done */ +#define M_WEP M_PROTO2 /* WEP done by hardware */ +#define M_80211_RX (M_AMPDU|M_WEP) /* * Encode WME access control bits in the PROTO flags. * This is safe since it's passed directly in to the diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index d756041a50d..b8f70dce513 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -393,6 +393,7 @@ ieee80211_input(struct ieee80211com *ic, struct mbuf *m, wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] &= ~IEEE80211_FC1_WEP; } else { + /* XXX M_WEP and IEEE80211_F_PRIVACY */ key = NULL; } @@ -474,7 +475,7 @@ ieee80211_input(struct ieee80211com *ic, struct mbuf *m, * any non-PAE frames received without encryption. */ if ((ic->ic_flags & IEEE80211_F_DROPUNENC) && - key == NULL && + (key == NULL && (m->m_flags & M_WEP) == 0) && eh->ether_type != htons(ETHERTYPE_PAE)) { /* * Drop unencrypted frames. @@ -722,6 +723,9 @@ ieee80211_deliver_data(struct ieee80211com *ic, } else IEEE80211_NODE_STAT(ni, rx_ucast); + /* clear driver/net80211 flags before passing up */ + m->m_flags &= ~M_80211_RX; + /* perform as a bridge within the AP */ if (ic->ic_opmode == IEEE80211_M_HOSTAP && (ic->ic_flags & IEEE80211_F_NOBRIDGE) == 0) {