summaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_input.c
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2020-12-09 21:54:12 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2020-12-09 21:54:12 +0000
commit4a4edd0503bfc93644b7bdf36775ad3d08cd60b1 (patch)
tree8c538d466639619d907bfa020e65b61825153575 /sys/net80211/ieee80211_input.c
parentc1262a2f42694e18e6e9179f755a231935f2b710 (diff)
Ignore trailing data in A-MSDU frame buffers if it is smaller than the
Ethernet header size. Avoids spurious "input packet decapsulations failed" errors in 'netstat -W' with A-MSDU enabled (currently disabled in-tree). Problem observed and fix verified on iwm(4) 8260 by me and 7260 by tobhe. ok phessler@ tobhe@
Diffstat (limited to 'sys/net80211/ieee80211_input.c')
-rw-r--r--sys/net80211/ieee80211_input.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index 50def5628b9..924608b6724 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_input.c,v 1.226 2020/12/09 15:50:58 stsp Exp $ */
+/* $OpenBSD: ieee80211_input.c,v 1.227 2020/12/09 21:54:11 stsp Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
@@ -1153,14 +1153,12 @@ ieee80211_amsdu_decap(struct ieee80211com *ic, struct mbuf *m,
/* strip 802.11 header */
m_adj(m, hdrlen);
- for (;;) {
+ while (m->m_pkthdr.len >= ETHER_HDR_LEN + LLC_SNAPFRAMELEN) {
/* process an A-MSDU subframe */
- if (m->m_len < ETHER_HDR_LEN + LLC_SNAPFRAMELEN) {
- m = m_pullup(m, ETHER_HDR_LEN + LLC_SNAPFRAMELEN);
- if (m == NULL) {
- ic->ic_stats.is_rx_decap++;
- break;
- }
+ m = m_pullup(m, ETHER_HDR_LEN + LLC_SNAPFRAMELEN);
+ if (m == NULL) {
+ ic->ic_stats.is_rx_decap++;
+ break;
}
eh = mtod(m, struct ether_header *);
/* examine 802.3 header */
@@ -1207,15 +1205,13 @@ ieee80211_amsdu_decap(struct ieee80211com *ic, struct mbuf *m,
}
ieee80211_enqueue_data(ic, m, ni, mcast, ml);
- if (n->m_pkthdr.len == 0) {
- m_freem(n);
- break;
- }
m = n;
/* remove padding */
pad = ((len + 3) & ~3) - len;
m_adj(m, pad);
}
+
+ m_freem(m);
}
/*