summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2009-03-24 19:28:32 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2009-03-24 19:28:32 +0000
commit03320bef907127bb3763c332a263cca0851b6cb1 (patch)
treebaff57f19e6797eb2e2173d7ee61af2f31cd5bbd /sys/dev
parent55cbfa02b07b89c549e6771b491b59af0985a277 (diff)
report Michael MIC failures to net80211 (can't happen yet since we do
crypto in software.) increment if_ierrors in Rx error paths.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/if_otus.c13
-rw-r--r--sys/dev/usb/if_otusreg.h8
2 files changed, 18 insertions, 3 deletions
diff --git a/sys/dev/usb/if_otus.c b/sys/dev/usb/if_otus.c
index 7b67ace48c7..1f5e5bfe1e3 100644
--- a/sys/dev/usb/if_otus.c
+++ b/sys/dev/usb/if_otus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_otus.c,v 1.2 2009/03/24 19:18:28 damien Exp $ */
+/* $OpenBSD: if_otus.c,v 1.3 2009/03/24 19:28:31 damien Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -1058,6 +1058,7 @@ otus_sub_rxeof(struct otus_softc *sc, uint8_t *buf, int len)
/* Received MPDU. */
if (__predict_false(len < AR_PLCP_HDR_LEN + sizeof (*tail))) {
DPRINTF(("MPDU too short %d\n", len));
+ ifp->if_ierrors++;
return;
}
tail = (struct ar_rx_tail *)(plcp + len - sizeof (*tail));
@@ -1065,13 +1066,21 @@ otus_sub_rxeof(struct otus_softc *sc, uint8_t *buf, int len)
/* Discard error frames. */
if (__predict_false(tail->error != 0)) {
DPRINTF(("error frame 0x%02x\n", tail->error));
+ if (tail->error & AR_RX_ERROR_MMIC) {
+ /* Report Michael MIC failures to net80211. */
+ ic->ic_stats.is_rx_locmicfail++;
+ ieee80211_michael_mic_failure(ic, 0);
+ }
+ ifp->if_ierrors++;
return;
}
/* Compute MPDU's length. */
mlen = len - AR_PLCP_HDR_LEN - sizeof (*tail);
/* Make sure there's room for an 802.11 header + FCS. */
- if (__predict_false(mlen < IEEE80211_MIN_LEN))
+ if (__predict_false(mlen < IEEE80211_MIN_LEN)) {
+ ifp->if_ierrors++;
return;
+ }
mlen -= IEEE80211_CRC_LEN; /* strip 802.11 FCS */
wh = (struct ieee80211_frame *)(plcp + AR_PLCP_HDR_LEN);
diff --git a/sys/dev/usb/if_otusreg.h b/sys/dev/usb/if_otusreg.h
index 531c9273d56..d5dc8c6c0cc 100644
--- a/sys/dev/usb/if_otusreg.h
+++ b/sys/dev/usb/if_otusreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_otusreg.h,v 1.2 2009/03/24 19:18:28 damien Exp $ */
+/* $OpenBSD: if_otusreg.h,v 1.3 2009/03/24 19:28:31 damien Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -144,7 +144,13 @@ struct ar_rx_tail {
uint8_t sa_idx;
uint8_t da_idx;
uint8_t error;
+#define AR_RX_ERROR_TIMEOUT (1 << 0)
+#define AR_RX_ERROR_OVERRUN (1 << 1)
+#define AR_RX_ERROR_DECRYPT (1 << 2)
#define AR_RX_ERROR_FCS (1 << 3)
+#define AR_RX_ERROR_BAD_RA (1 << 4)
+#define AR_RX_ERROR_PLCP (1 << 5)
+#define AR_RX_ERROR_MMIC (1 << 6)
uint8_t status;
/* Modulation type (same as AR_TX_PHY_MT). */