xref: /haiku/src/libs/compat/freebsd_wlan/net80211/ieee80211_input.h (revision 86021fd407331bcef948c739a4870ca453f5c6cd)
1753c7e08SAugustin Cavalier /*-
2*86021fd4SAugustin Cavalier  * SPDX-License-Identifier: BSD-2-Clause
38244a9baSAugustin Cavalier  *
4753c7e08SAugustin Cavalier  * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
5753c7e08SAugustin Cavalier  * All rights reserved.
6753c7e08SAugustin Cavalier  *
7753c7e08SAugustin Cavalier  * Redistribution and use in source and binary forms, with or without
8753c7e08SAugustin Cavalier  * modification, are permitted provided that the following conditions
9753c7e08SAugustin Cavalier  * are met:
10753c7e08SAugustin Cavalier  * 1. Redistributions of source code must retain the above copyright
11753c7e08SAugustin Cavalier  *    notice, this list of conditions and the following disclaimer.
12753c7e08SAugustin Cavalier  * 2. Redistributions in binary form must reproduce the above copyright
13753c7e08SAugustin Cavalier  *    notice, this list of conditions and the following disclaimer in the
14753c7e08SAugustin Cavalier  *    documentation and/or other materials provided with the distribution.
15753c7e08SAugustin Cavalier  *
16753c7e08SAugustin Cavalier  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17753c7e08SAugustin Cavalier  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18753c7e08SAugustin Cavalier  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19753c7e08SAugustin Cavalier  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20753c7e08SAugustin Cavalier  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21753c7e08SAugustin Cavalier  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22753c7e08SAugustin Cavalier  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23753c7e08SAugustin Cavalier  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24753c7e08SAugustin Cavalier  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25753c7e08SAugustin Cavalier  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26753c7e08SAugustin Cavalier  */
27753c7e08SAugustin Cavalier #ifndef _NET80211_IEEE80211_INPUT_H_
28753c7e08SAugustin Cavalier #define _NET80211_IEEE80211_INPUT_H_
29753c7e08SAugustin Cavalier 
30753c7e08SAugustin Cavalier /* Verify the existence and length of __elem or get out. */
31753c7e08SAugustin Cavalier #define IEEE80211_VERIFY_ELEMENT(__elem, __maxlen, _action) do {	\
32753c7e08SAugustin Cavalier 	if ((__elem) == NULL) {						\
33753c7e08SAugustin Cavalier 		IEEE80211_DISCARD(vap, IEEE80211_MSG_ELEMID,		\
34753c7e08SAugustin Cavalier 		    wh, NULL, "%s", "no " #__elem );			\
35753c7e08SAugustin Cavalier 		vap->iv_stats.is_rx_elem_missing++;			\
36753c7e08SAugustin Cavalier 		_action;						\
37753c7e08SAugustin Cavalier 	} else if ((__elem)[1] > (__maxlen)) {				\
38753c7e08SAugustin Cavalier 		IEEE80211_DISCARD(vap, IEEE80211_MSG_ELEMID,		\
39753c7e08SAugustin Cavalier 		    wh, NULL, "bad " #__elem " len %d", (__elem)[1]);	\
40753c7e08SAugustin Cavalier 		vap->iv_stats.is_rx_elem_toobig++;			\
41753c7e08SAugustin Cavalier 		_action;						\
42753c7e08SAugustin Cavalier 	}								\
43753c7e08SAugustin Cavalier } while (0)
44753c7e08SAugustin Cavalier 
45753c7e08SAugustin Cavalier #define	IEEE80211_VERIFY_LENGTH(_len, _minlen, _action) do {		\
46753c7e08SAugustin Cavalier 	if ((_len) < (_minlen)) {					\
47753c7e08SAugustin Cavalier 		IEEE80211_DISCARD(vap, IEEE80211_MSG_ELEMID,		\
48753c7e08SAugustin Cavalier 		    wh, NULL, "ie too short, got %d, expected %d",	\
49753c7e08SAugustin Cavalier 		    (_len), (_minlen));					\
50753c7e08SAugustin Cavalier 		vap->iv_stats.is_rx_elem_toosmall++;			\
51753c7e08SAugustin Cavalier 		_action;						\
52753c7e08SAugustin Cavalier 	}								\
53753c7e08SAugustin Cavalier } while (0)
54753c7e08SAugustin Cavalier 
55753c7e08SAugustin Cavalier #ifdef IEEE80211_DEBUG
56753c7e08SAugustin Cavalier void	ieee80211_ssid_mismatch(struct ieee80211vap *, const char *tag,
57753c7e08SAugustin Cavalier 	uint8_t mac[IEEE80211_ADDR_LEN], uint8_t *ssid);
58753c7e08SAugustin Cavalier 
59753c7e08SAugustin Cavalier #define	IEEE80211_VERIFY_SSID(_ni, _ssid, _action) do {			\
60753c7e08SAugustin Cavalier 	if ((_ssid)[1] != 0 &&						\
61753c7e08SAugustin Cavalier 	    ((_ssid)[1] != (_ni)->ni_esslen ||				\
62753c7e08SAugustin Cavalier 	    memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) {	\
63753c7e08SAugustin Cavalier 		if (ieee80211_msg_input(vap))				\
64753c7e08SAugustin Cavalier 			ieee80211_ssid_mismatch(vap, 			\
65753c7e08SAugustin Cavalier 			    ieee80211_mgt_subtype_name(subtype),	\
66753c7e08SAugustin Cavalier 				wh->i_addr2, _ssid);			\
67753c7e08SAugustin Cavalier 		vap->iv_stats.is_rx_ssidmismatch++;			\
68753c7e08SAugustin Cavalier 		_action;						\
69753c7e08SAugustin Cavalier 	}								\
70753c7e08SAugustin Cavalier } while (0)
71753c7e08SAugustin Cavalier #else /* !IEEE80211_DEBUG */
72753c7e08SAugustin Cavalier #define	IEEE80211_VERIFY_SSID(_ni, _ssid, _action) do {			\
73753c7e08SAugustin Cavalier 	if ((_ssid)[1] != 0 &&						\
74753c7e08SAugustin Cavalier 	    ((_ssid)[1] != (_ni)->ni_esslen ||				\
75753c7e08SAugustin Cavalier 	    memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) {	\
76753c7e08SAugustin Cavalier 		vap->iv_stats.is_rx_ssidmismatch++;			\
77753c7e08SAugustin Cavalier 		_action;						\
78753c7e08SAugustin Cavalier 	}								\
79753c7e08SAugustin Cavalier } while (0)
80753c7e08SAugustin Cavalier #endif /* !IEEE80211_DEBUG */
81753c7e08SAugustin Cavalier 
82753c7e08SAugustin Cavalier #include <sys/endian.h>		/* For le16toh() / le32dec() */
83753c7e08SAugustin Cavalier 
84753c7e08SAugustin Cavalier static __inline int
iswpaoui(const uint8_t * frm)85753c7e08SAugustin Cavalier iswpaoui(const uint8_t *frm)
86753c7e08SAugustin Cavalier {
87753c7e08SAugustin Cavalier 	return frm[1] > 3 && le32dec(frm+2) == ((WPA_OUI_TYPE<<24)|WPA_OUI);
88753c7e08SAugustin Cavalier }
89753c7e08SAugustin Cavalier 
90753c7e08SAugustin Cavalier static __inline int
iswmeoui(const uint8_t * frm)91753c7e08SAugustin Cavalier iswmeoui(const uint8_t *frm)
92753c7e08SAugustin Cavalier {
93753c7e08SAugustin Cavalier 	return frm[1] > 3 && le32dec(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI);
94753c7e08SAugustin Cavalier }
95753c7e08SAugustin Cavalier 
96753c7e08SAugustin Cavalier static __inline int
iswmeparam(const uint8_t * frm)97753c7e08SAugustin Cavalier iswmeparam(const uint8_t *frm)
98753c7e08SAugustin Cavalier {
99753c7e08SAugustin Cavalier 	return frm[1] > 5 && le32dec(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI) &&
100753c7e08SAugustin Cavalier 		frm[6] == WME_PARAM_OUI_SUBTYPE;
101753c7e08SAugustin Cavalier }
102753c7e08SAugustin Cavalier 
103753c7e08SAugustin Cavalier static __inline int
iswmeinfo(const uint8_t * frm)104753c7e08SAugustin Cavalier iswmeinfo(const uint8_t *frm)
105753c7e08SAugustin Cavalier {
106753c7e08SAugustin Cavalier 	return frm[1] > 5 && le32dec(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI) &&
107753c7e08SAugustin Cavalier 		frm[6] == WME_INFO_OUI_SUBTYPE;
108753c7e08SAugustin Cavalier }
109753c7e08SAugustin Cavalier 
110753c7e08SAugustin Cavalier static __inline int
isatherosoui(const uint8_t * frm)111753c7e08SAugustin Cavalier isatherosoui(const uint8_t *frm)
112753c7e08SAugustin Cavalier {
113753c7e08SAugustin Cavalier 	return frm[1] > 3 && le32dec(frm+2) == ((ATH_OUI_TYPE<<24)|ATH_OUI);
114753c7e08SAugustin Cavalier }
115753c7e08SAugustin Cavalier 
116753c7e08SAugustin Cavalier static __inline int
istdmaoui(const uint8_t * frm)117753c7e08SAugustin Cavalier istdmaoui(const uint8_t *frm)
118753c7e08SAugustin Cavalier {
119753c7e08SAugustin Cavalier 	return frm[1] > 3 && le32dec(frm+2) == ((TDMA_OUI_TYPE<<24)|TDMA_OUI);
120753c7e08SAugustin Cavalier }
121753c7e08SAugustin Cavalier 
122753c7e08SAugustin Cavalier static __inline int
ishtcapoui(const uint8_t * frm)123753c7e08SAugustin Cavalier ishtcapoui(const uint8_t *frm)
124753c7e08SAugustin Cavalier {
125753c7e08SAugustin Cavalier 	return frm[1] > 3 && le32dec(frm+2) == ((BCM_OUI_HTCAP<<24)|BCM_OUI);
126753c7e08SAugustin Cavalier }
127753c7e08SAugustin Cavalier 
128753c7e08SAugustin Cavalier static __inline int
ishtinfooui(const uint8_t * frm)129753c7e08SAugustin Cavalier ishtinfooui(const uint8_t *frm)
130753c7e08SAugustin Cavalier {
131753c7e08SAugustin Cavalier 	return frm[1] > 3 && le32dec(frm+2) == ((BCM_OUI_HTINFO<<24)|BCM_OUI);
132753c7e08SAugustin Cavalier }
133753c7e08SAugustin Cavalier 
1348244a9baSAugustin Cavalier static __inline int
ieee80211_check_rxseq_amsdu(const struct ieee80211_rx_stats * rxs)1358244a9baSAugustin Cavalier ieee80211_check_rxseq_amsdu(const struct ieee80211_rx_stats *rxs)
1368244a9baSAugustin Cavalier {
1375cad57c4SJérôme Duval 	if (rxs == NULL)
1385cad57c4SJérôme Duval 		return 0;
1398244a9baSAugustin Cavalier 	return (!! (rxs->c_pktflags & IEEE80211_RX_F_AMSDU));
1408244a9baSAugustin Cavalier }
1418244a9baSAugustin Cavalier 
1428244a9baSAugustin Cavalier /*
1438244a9baSAugustin Cavalier  * Return 1 if the rxseq check should increment the sequence
1448244a9baSAugustin Cavalier  * number. Return 0 if it's part of an AMSDU batch and it isn't
1458244a9baSAugustin Cavalier  * the final frame in the decap'ed burst.
1468244a9baSAugustin Cavalier  */
1478244a9baSAugustin Cavalier static __inline int
ieee80211_check_rxseq_amsdu_more(const struct ieee80211_rx_stats * rxs)1488244a9baSAugustin Cavalier ieee80211_check_rxseq_amsdu_more(const struct ieee80211_rx_stats *rxs)
1498244a9baSAugustin Cavalier {
1508244a9baSAugustin Cavalier 	/* No state? ok */
1518244a9baSAugustin Cavalier 	if (rxs == NULL)
1528244a9baSAugustin Cavalier 		return (1);
1538244a9baSAugustin Cavalier 
1548244a9baSAugustin Cavalier 	/* State but no AMSDU set? ok */
1558244a9baSAugustin Cavalier 	if ((rxs->c_pktflags & IEEE80211_RX_F_AMSDU) == 0)
1568244a9baSAugustin Cavalier 		return (1);
1578244a9baSAugustin Cavalier 
1588244a9baSAugustin Cavalier 	/* State, AMSDU set, then _MORE means "don't inc yet" */
1598244a9baSAugustin Cavalier 	if (rxs->c_pktflags & IEEE80211_RX_F_AMSDU_MORE) {
1608244a9baSAugustin Cavalier 		return (0);
1618244a9baSAugustin Cavalier 	}
1628244a9baSAugustin Cavalier 
1638244a9baSAugustin Cavalier 	/* Both are set, so return ok */
1648244a9baSAugustin Cavalier 	return (1);
1658244a9baSAugustin Cavalier }
1668244a9baSAugustin Cavalier 
167753c7e08SAugustin Cavalier /*
168753c7e08SAugustin Cavalier  * Check the current frame sequence number against the current TID
169753c7e08SAugustin Cavalier  * state and return whether it's in sequence or should be dropped.
170753c7e08SAugustin Cavalier  *
171753c7e08SAugustin Cavalier  * Since out of order packet and duplicate packet eliminations should
172753c7e08SAugustin Cavalier  * be done by the AMPDU RX code, this routine blindly accepts all
173753c7e08SAugustin Cavalier  * frames from a HT station w/ a TID that is currently doing AMPDU-RX.
174753c7e08SAugustin Cavalier  * HT stations without WME or where the TID is not doing AMPDU-RX
175753c7e08SAugustin Cavalier  * are checked like non-HT stations.
176753c7e08SAugustin Cavalier  *
177753c7e08SAugustin Cavalier  * The routine only eliminates packets whose sequence/fragment
178753c7e08SAugustin Cavalier  * match or are less than the last seen sequence/fragment number
179*86021fd4SAugustin Cavalier  * AND are retransmits. It doesn't try to eliminate out of order packets.
180753c7e08SAugustin Cavalier  *
181753c7e08SAugustin Cavalier  * Since all frames after sequence number 4095 will be less than 4095
182753c7e08SAugustin Cavalier  * (as the seqnum wraps), handle that special case so packets aren't
183753c7e08SAugustin Cavalier  * incorrectly dropped - ie, if the next packet is sequence number 0
184753c7e08SAugustin Cavalier  * but a retransmit since the initial packet didn't make it.
1858244a9baSAugustin Cavalier  *
1868244a9baSAugustin Cavalier  * XXX TODO: handle sequence number space wrapping with dropped frames;
1878244a9baSAugustin Cavalier  * especially in high interference conditions under high traffic load
1888244a9baSAugustin Cavalier  * The RX AMPDU reorder code also needs it.
1898244a9baSAugustin Cavalier  *
1908244a9baSAugustin Cavalier  * XXX TODO: update for 802.11-2012 9.3.2.10 Duplicate Detection and Recovery.
191753c7e08SAugustin Cavalier  */
192753c7e08SAugustin Cavalier static __inline int
ieee80211_check_rxseq(struct ieee80211_node * ni,struct ieee80211_frame * wh,uint8_t * bssid,const struct ieee80211_rx_stats * rxs)193753c7e08SAugustin Cavalier ieee80211_check_rxseq(struct ieee80211_node *ni, struct ieee80211_frame *wh,
1948244a9baSAugustin Cavalier     uint8_t *bssid, const struct ieee80211_rx_stats *rxs)
195753c7e08SAugustin Cavalier {
196753c7e08SAugustin Cavalier #define	SEQ_LEQ(a,b)	((int)((a)-(b)) <= 0)
197753c7e08SAugustin Cavalier #define	SEQ_EQ(a,b)	((int)((a)-(b)) == 0)
198753c7e08SAugustin Cavalier #define	SEQNO(a)	((a) >> IEEE80211_SEQ_SEQ_SHIFT)
199753c7e08SAugustin Cavalier #define	FRAGNO(a)	((a) & IEEE80211_SEQ_FRAG_MASK)
200753c7e08SAugustin Cavalier 	struct ieee80211vap *vap = ni->ni_vap;
201753c7e08SAugustin Cavalier 	uint16_t rxseq;
202753c7e08SAugustin Cavalier 	uint8_t type, subtype;
203753c7e08SAugustin Cavalier 	uint8_t tid;
204753c7e08SAugustin Cavalier 	struct ieee80211_rx_ampdu *rap;
205753c7e08SAugustin Cavalier 
206753c7e08SAugustin Cavalier 	rxseq = le16toh(*(uint16_t *)wh->i_seq);
207753c7e08SAugustin Cavalier 	type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
208753c7e08SAugustin Cavalier 	subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
209753c7e08SAugustin Cavalier 
210753c7e08SAugustin Cavalier 	/*
211753c7e08SAugustin Cavalier 	 * Types with no sequence number (or QoS (+)Null frames)
212753c7e08SAugustin Cavalier 	 * are always treated valid.
213753c7e08SAugustin Cavalier 	 */
214753c7e08SAugustin Cavalier 	if (! IEEE80211_HAS_SEQ(type, subtype))
215753c7e08SAugustin Cavalier 		return 1;
216753c7e08SAugustin Cavalier 
2178244a9baSAugustin Cavalier 	/*
2188244a9baSAugustin Cavalier 	 * Always allow multicast frames for now - QoS (any TID)
2198244a9baSAugustin Cavalier 	 * or not.
2208244a9baSAugustin Cavalier 	 */
2218244a9baSAugustin Cavalier 	if (IEEE80211_IS_MULTICAST(wh->i_addr1))
2228244a9baSAugustin Cavalier 		return 1;
2238244a9baSAugustin Cavalier 
224753c7e08SAugustin Cavalier 	tid = ieee80211_gettid(wh);
225753c7e08SAugustin Cavalier 
226753c7e08SAugustin Cavalier 	/*
227753c7e08SAugustin Cavalier 	 * Only do the HT AMPDU check for WME stations; non-WME HT stations
228753c7e08SAugustin Cavalier 	 * shouldn't exist outside of debugging. We should at least
229753c7e08SAugustin Cavalier 	 * handle that.
230753c7e08SAugustin Cavalier 	 */
231753c7e08SAugustin Cavalier 	if (tid < WME_NUM_TID) {
232753c7e08SAugustin Cavalier 		rap = &ni->ni_rx_ampdu[tid];
233753c7e08SAugustin Cavalier 		/* HT nodes currently doing RX AMPDU are always valid */
234753c7e08SAugustin Cavalier 		if ((ni->ni_flags & IEEE80211_NODE_HT) &&
235753c7e08SAugustin Cavalier 		    (rap->rxa_flags & IEEE80211_AGGR_RUNNING))
236753c7e08SAugustin Cavalier 			goto ok;
237753c7e08SAugustin Cavalier 	}
238753c7e08SAugustin Cavalier 
239753c7e08SAugustin Cavalier 	/*
240753c7e08SAugustin Cavalier 	 * Otherwise, retries for packets below or equal to the last
241753c7e08SAugustin Cavalier 	 * seen sequence number should be dropped.
242753c7e08SAugustin Cavalier 	 */
243753c7e08SAugustin Cavalier 
244753c7e08SAugustin Cavalier 	/*
245753c7e08SAugustin Cavalier 	 * Treat frame seqnum 4095 as special due to boundary
246753c7e08SAugustin Cavalier 	 * wrapping conditions.
247753c7e08SAugustin Cavalier 	 */
248753c7e08SAugustin Cavalier 	if (SEQNO(ni->ni_rxseqs[tid]) == 4095) {
249753c7e08SAugustin Cavalier 		/*
250753c7e08SAugustin Cavalier 		 * Drop retransmits on seqnum 4095/current fragment for itself.
251753c7e08SAugustin Cavalier 		 */
252753c7e08SAugustin Cavalier 		if (SEQ_EQ(rxseq, ni->ni_rxseqs[tid]) &&
253753c7e08SAugustin Cavalier 		    (wh->i_fc[1] & IEEE80211_FC1_RETRY))
254753c7e08SAugustin Cavalier 			goto fail;
255753c7e08SAugustin Cavalier 		/*
256753c7e08SAugustin Cavalier 		 * Treat any subsequent frame as fine if the last seen frame
257753c7e08SAugustin Cavalier 		 * is 4095 and it's not a retransmit for the same sequence
258753c7e08SAugustin Cavalier 		 * number. However, this doesn't capture incorrectly ordered
259753c7e08SAugustin Cavalier 	 	 * fragments w/ sequence number 4095. It shouldn't be seen
260753c7e08SAugustin Cavalier 		 * in practice, but see the comment above for further info.
261753c7e08SAugustin Cavalier 		 */
262753c7e08SAugustin Cavalier 		goto ok;
263753c7e08SAugustin Cavalier 	}
264753c7e08SAugustin Cavalier 
265753c7e08SAugustin Cavalier 	/*
266753c7e08SAugustin Cavalier 	 * At this point we assume that retransmitted seq/frag numbers below
267753c7e08SAugustin Cavalier 	 * the current can simply be eliminated.
268753c7e08SAugustin Cavalier 	 */
269753c7e08SAugustin Cavalier 	if ((wh->i_fc[1] & IEEE80211_FC1_RETRY) &&
270753c7e08SAugustin Cavalier 	    SEQ_LEQ(rxseq, ni->ni_rxseqs[tid]))
271753c7e08SAugustin Cavalier 		goto fail;
272753c7e08SAugustin Cavalier 
273753c7e08SAugustin Cavalier ok:
2748244a9baSAugustin Cavalier 	/*
2758244a9baSAugustin Cavalier 	 * Only bump the sequence number if it's the last frame
2768244a9baSAugustin Cavalier 	 * in a batch.  That way frames in the rest of the batch
2778244a9baSAugustin Cavalier 	 * get included, and the last frame in the batch kicks
2788244a9baSAugustin Cavalier 	 * it next.
2798244a9baSAugustin Cavalier 	 */
2808244a9baSAugustin Cavalier 	if (ieee80211_check_rxseq_amsdu_more(rxs)) {
281753c7e08SAugustin Cavalier 		ni->ni_rxseqs[tid] = rxseq;
2828244a9baSAugustin Cavalier 		if ((rxs != NULL) && ieee80211_check_rxseq_amsdu(rxs))
2838244a9baSAugustin Cavalier 			IEEE80211_NODE_STAT(ni, rx_amsdu_more_end);
2848244a9baSAugustin Cavalier 	} else {
2858244a9baSAugustin Cavalier 		/* .. still waiting */
2868244a9baSAugustin Cavalier 		IEEE80211_NODE_STAT(ni, rx_amsdu_more);
2878244a9baSAugustin Cavalier 	}
288753c7e08SAugustin Cavalier 
289753c7e08SAugustin Cavalier 	return 1;
290753c7e08SAugustin Cavalier 
291753c7e08SAugustin Cavalier fail:
292753c7e08SAugustin Cavalier 	/* duplicate, discard */
293753c7e08SAugustin Cavalier 	IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, bssid, "duplicate",
294753c7e08SAugustin Cavalier 	    "seqno <%u,%u> fragno <%u,%u> tid %u",
295753c7e08SAugustin Cavalier 	     SEQNO(rxseq),  SEQNO(ni->ni_rxseqs[tid]),
296753c7e08SAugustin Cavalier 	    FRAGNO(rxseq), FRAGNO(ni->ni_rxseqs[tid]), tid);
297753c7e08SAugustin Cavalier 	vap->iv_stats.is_rx_dup++;
298753c7e08SAugustin Cavalier 	IEEE80211_NODE_STAT(ni, rx_dup);
299753c7e08SAugustin Cavalier 
300753c7e08SAugustin Cavalier 	return 0;
301753c7e08SAugustin Cavalier #undef	SEQ_LEQ
302753c7e08SAugustin Cavalier #undef	SEQ_EQ
303753c7e08SAugustin Cavalier #undef	SEQNO
304753c7e08SAugustin Cavalier #undef	FRAGNO
305753c7e08SAugustin Cavalier }
306753c7e08SAugustin Cavalier 
307753c7e08SAugustin Cavalier void	ieee80211_deliver_data(struct ieee80211vap *,
308753c7e08SAugustin Cavalier 		struct ieee80211_node *, struct mbuf *);
309753c7e08SAugustin Cavalier struct mbuf *ieee80211_defrag(struct ieee80211_node *,
310*86021fd4SAugustin Cavalier 		struct mbuf *, int, int);
311753c7e08SAugustin Cavalier struct mbuf *ieee80211_realign(struct ieee80211vap *, struct mbuf *, size_t);
312*86021fd4SAugustin Cavalier struct mbuf *ieee80211_decap(struct ieee80211vap *, struct mbuf *, int,
313*86021fd4SAugustin Cavalier 		uint8_t);
314753c7e08SAugustin Cavalier struct mbuf *ieee80211_decap1(struct mbuf *, int *);
315753c7e08SAugustin Cavalier int	ieee80211_setup_rates(struct ieee80211_node *ni,
316753c7e08SAugustin Cavalier 		const uint8_t *rates, const uint8_t *xrates, int flags);
317753c7e08SAugustin Cavalier void ieee80211_send_error(struct ieee80211_node *,
318753c7e08SAugustin Cavalier 		const uint8_t mac[IEEE80211_ADDR_LEN], int subtype, int arg);
319753c7e08SAugustin Cavalier int	ieee80211_alloc_challenge(struct ieee80211_node *);
320753c7e08SAugustin Cavalier int	ieee80211_parse_beacon(struct ieee80211_node *, struct mbuf *,
321753c7e08SAugustin Cavalier 		struct ieee80211_channel *,
322753c7e08SAugustin Cavalier 		struct ieee80211_scanparams *);
323753c7e08SAugustin Cavalier int	ieee80211_parse_action(struct ieee80211_node *, struct mbuf *);
324753c7e08SAugustin Cavalier #endif /* _NET80211_IEEE80211_INPUT_H_ */
325