summaryrefslogtreecommitdiffstats
path: root/sys/net/if_ethersubr.c
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2006-03-03 17:21:08 +0000
committercsjp <csjp@FreeBSD.org>2006-03-03 17:21:08 +0000
commit06a09c2bf7da392735f358340019a56d53e54e2e (patch)
treed069cb7bca089d5106189aa186827d9f416e4735 /sys/net/if_ethersubr.c
parent775429c0bc511a763835c34e9050410c7013c448 (diff)
downloadFreeBSD-src-06a09c2bf7da392735f358340019a56d53e54e2e.zip
FreeBSD-src-06a09c2bf7da392735f358340019a56d53e54e2e.tar.gz
Unbreak byte counters when network interfaces are in monitor mode by
re-organizing the monitor return logic. We perform interface monitoring checks after we have determined if the CRC is still on the packet, if it is, m_adj() is called which will adjust the packet length. This ensures that we are not including CRC lengths in the byte counters for each packet. Discussed with: andre, glebius
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r--sys/net/if_ethersubr.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index ed0f270..9a9782a 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -549,14 +549,6 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
*/
BPF_MTAP(ifp, m);
- if (ifp->if_flags & IFF_MONITOR) {
- /*
- * Interface marked for monitoring; discard packet.
- */
- m_freem(m);
- return;
- }
-
/* If the CRC is still on the packet, trim it off. */
if (m->m_flags & M_HASFCS) {
m_adj(m, -ETHER_CRC_LEN);
@@ -565,6 +557,14 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
ifp->if_ibytes += m->m_pkthdr.len;
+ if (ifp->if_flags & IFF_MONITOR) {
+ /*
+ * Interface marked for monitoring; discard packet.
+ */
+ m_freem(m);
+ return;
+ }
+
/* Handle ng_ether(4) processing, if any */
if (IFP2AC(ifp)->ac_netgraph != NULL) {
KASSERT(ng_ether_input_p != NULL,
OpenPOWER on IntegriCloud