summaryrefslogtreecommitdiffstats
path: root/sys/net/if_ethersubr.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-09-27 18:57:47 +0000
committerphk <phk@FreeBSD.org>2002-09-27 18:57:47 +0000
commitd61cac74b0dc667b645880b386219cacfb3c53f6 (patch)
tree2e0b7f0095d2053a63219572fbeafde682841ff6 /sys/net/if_ethersubr.c
parent834ddd1bcc092e4a26f16724892636b249316d70 (diff)
downloadFreeBSD-src-d61cac74b0dc667b645880b386219cacfb3c53f6.zip
FreeBSD-src-d61cac74b0dc667b645880b386219cacfb3c53f6.tar.gz
Add the "Monitor" interface flag.
Setting this flag on an ethernet interface blocks transmission of packets and discards incoming packets after BPF processing. This is useful if you want to monitor network trafic but not interact with the network in question. Sponsored by: http://www.babeltech.dk
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r--sys/net/if_ethersubr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index d92f405..0983724 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -162,6 +162,8 @@ ether_output(ifp, m, dst, rt0)
senderr(error);
#endif
+ if (ifp->if_flags & IFF_MONITOR)
+ senderr(ENETDOWN);
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
senderr(ENETDOWN);
rt = rt0;
@@ -583,6 +585,11 @@ ether_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
bpf_mtap(ifp, (struct mbuf *)&mh);
}
+ if (ifp->if_flags & IFF_MONITOR) {
+ m_freem(m);
+ return;
+ }
+
#ifdef MAC
mac_create_mbuf_from_ifnet(ifp, m);
#endif
OpenPOWER on IntegriCloud