Deleted Added
full compact
ieee80211_input.h (296254) ieee80211_input.h (298359)
1/*-
2 * Copyright (c) 2007-2009 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

--- 8 unchanged lines hidden (view full) ---

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 *
1/*-
2 * Copyright (c) 2007-2009 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

--- 8 unchanged lines hidden (view full) ---

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: head/sys/net80211/ieee80211_input.h 296254 2016-03-01 06:47:21Z avos $
25 * $FreeBSD: head/sys/net80211/ieee80211_input.h 298359 2016-04-20 18:29:30Z avos $
26 */
27#ifndef _NET80211_IEEE80211_INPUT_H_
28#define _NET80211_IEEE80211_INPUT_H_
29
30/* Verify the existence and length of __elem or get out. */
31#define IEEE80211_VERIFY_ELEMENT(__elem, __maxlen, _action) do { \
32 if ((__elem) == NULL) { \
33 IEEE80211_DISCARD(vap, IEEE80211_MSG_ELEMID, \

--- 41 unchanged lines hidden (view full) ---

75 ((_ssid)[1] != (_ni)->ni_esslen || \
76 memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) { \
77 vap->iv_stats.is_rx_ssidmismatch++; \
78 _action; \
79 } \
80} while (0)
81#endif /* !IEEE80211_DEBUG */
82
26 */
27#ifndef _NET80211_IEEE80211_INPUT_H_
28#define _NET80211_IEEE80211_INPUT_H_
29
30/* Verify the existence and length of __elem or get out. */
31#define IEEE80211_VERIFY_ELEMENT(__elem, __maxlen, _action) do { \
32 if ((__elem) == NULL) { \
33 IEEE80211_DISCARD(vap, IEEE80211_MSG_ELEMID, \

--- 41 unchanged lines hidden (view full) ---

75 ((_ssid)[1] != (_ni)->ni_esslen || \
76 memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) { \
77 vap->iv_stats.is_rx_ssidmismatch++; \
78 _action; \
79 } \
80} while (0)
81#endif /* !IEEE80211_DEBUG */
82
83/* unalligned little endian access */
84#define LE_READ_2(p) \
85 ((uint16_t) \
86 ((((const uint8_t *)(p))[0] ) | \
87 (((const uint8_t *)(p))[1] << 8)))
88#define LE_READ_4(p) \
89 ((uint32_t) \
90 ((((const uint8_t *)(p))[0] ) | \
91 (((const uint8_t *)(p))[1] << 8) | \
92 (((const uint8_t *)(p))[2] << 16) | \
93 (((const uint8_t *)(p))[3] << 24)))
83#include <sys/endian.h> /* For le16toh() / le32dec() */
94
95static __inline int
96iswpaoui(const uint8_t *frm)
97{
84
85static __inline int
86iswpaoui(const uint8_t *frm)
87{
98 return frm[1] > 3 && LE_READ_4(frm+2) == ((WPA_OUI_TYPE<<24)|WPA_OUI);
88 return frm[1] > 3 && le32dec(frm+2) == ((WPA_OUI_TYPE<<24)|WPA_OUI);
99}
100
101static __inline int
102iswmeoui(const uint8_t *frm)
103{
89}
90
91static __inline int
92iswmeoui(const uint8_t *frm)
93{
104 return frm[1] > 3 && LE_READ_4(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI);
94 return frm[1] > 3 && le32dec(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI);
105}
106
107static __inline int
108iswmeparam(const uint8_t *frm)
109{
95}
96
97static __inline int
98iswmeparam(const uint8_t *frm)
99{
110 return frm[1] > 5 && LE_READ_4(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI) &&
100 return frm[1] > 5 && le32dec(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI) &&
111 frm[6] == WME_PARAM_OUI_SUBTYPE;
112}
113
114static __inline int
115iswmeinfo(const uint8_t *frm)
116{
101 frm[6] == WME_PARAM_OUI_SUBTYPE;
102}
103
104static __inline int
105iswmeinfo(const uint8_t *frm)
106{
117 return frm[1] > 5 && LE_READ_4(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI) &&
107 return frm[1] > 5 && le32dec(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI) &&
118 frm[6] == WME_INFO_OUI_SUBTYPE;
119}
120
121static __inline int
122isatherosoui(const uint8_t *frm)
123{
108 frm[6] == WME_INFO_OUI_SUBTYPE;
109}
110
111static __inline int
112isatherosoui(const uint8_t *frm)
113{
124 return frm[1] > 3 && LE_READ_4(frm+2) == ((ATH_OUI_TYPE<<24)|ATH_OUI);
114 return frm[1] > 3 && le32dec(frm+2) == ((ATH_OUI_TYPE<<24)|ATH_OUI);
125}
126
127static __inline int
128istdmaoui(const uint8_t *frm)
129{
115}
116
117static __inline int
118istdmaoui(const uint8_t *frm)
119{
130 return frm[1] > 3 && LE_READ_4(frm+2) == ((TDMA_OUI_TYPE<<24)|TDMA_OUI);
120 return frm[1] > 3 && le32dec(frm+2) == ((TDMA_OUI_TYPE<<24)|TDMA_OUI);
131}
132
133static __inline int
134ishtcapoui(const uint8_t *frm)
135{
121}
122
123static __inline int
124ishtcapoui(const uint8_t *frm)
125{
136 return frm[1] > 3 && LE_READ_4(frm+2) == ((BCM_OUI_HTCAP<<24)|BCM_OUI);
126 return frm[1] > 3 && le32dec(frm+2) == ((BCM_OUI_HTCAP<<24)|BCM_OUI);
137}
138
139static __inline int
140ishtinfooui(const uint8_t *frm)
141{
127}
128
129static __inline int
130ishtinfooui(const uint8_t *frm)
131{
142 return frm[1] > 3 && LE_READ_4(frm+2) == ((BCM_OUI_HTINFO<<24)|BCM_OUI);
132 return frm[1] > 3 && le32dec(frm+2) == ((BCM_OUI_HTINFO<<24)|BCM_OUI);
143}
144
133}
134
145#include <sys/endian.h> /* For le16toh() */
146
147/*
148 * Check the current frame sequence number against the current TID
149 * state and return whether it's in sequence or should be dropped.
150 *
151 * Since out of order packet and duplicate packet eliminations should
152 * be done by the AMPDU RX code, this routine blindly accepts all
153 * frames from a HT station w/ a TID that is currently doing AMPDU-RX.
154 * HT stations without WME or where the TID is not doing AMPDU-RX

--- 123 unchanged lines hidden ---
135/*
136 * Check the current frame sequence number against the current TID
137 * state and return whether it's in sequence or should be dropped.
138 *
139 * Since out of order packet and duplicate packet eliminations should
140 * be done by the AMPDU RX code, this routine blindly accepts all
141 * frames from a HT station w/ a TID that is currently doing AMPDU-RX.
142 * HT stations without WME or where the TID is not doing AMPDU-RX

--- 123 unchanged lines hidden ---