Module Name: src
Committed By: pooka
Date: Sat Jan 16 17:55:50 UTC 2010
Modified Files:
src/sys/rump/net/lib/libvirtif: if_virt.c
Log Message:
support bpf
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/rump/net/lib/libvirtif/if_virt.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/net/lib/libvirtif/if_virt.c
diff -u src/sys/rump/net/lib/libvirtif/if_virt.c:1.14 src/sys/rump/net/lib/libvirtif/if_virt.c:1.15
--- src/sys/rump/net/lib/libvirtif/if_virt.c:1.14 Wed Oct 14 18:18:53 2009
+++ src/sys/rump/net/lib/libvirtif/if_virt.c Sat Jan 16 17:55:50 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: if_virt.c,v 1.14 2009/10/14 18:18:53 pooka Exp $ */
+/* $NetBSD: if_virt.c,v 1.15 2010/01/16 17:55:50 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.14 2009/10/14 18:18:53 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.15 2010/01/16 17:55:50 pooka Exp $");
#include <sys/param.h>
#include <sys/condvar.h>
@@ -38,6 +38,7 @@
#include <sys/sockio.h>
#include <sys/socketvar.h>
+#include <net/bpf.h>
#include <net/if.h>
#include <net/if_ether.h>
#include <net/if_tap.h>
@@ -51,6 +52,8 @@
#include "rump_private.h"
#include "rump_net_private.h"
+#include "bpfilter.h"
+
/*
* Virtual interface for userspace purposes. Uses tap(4) to
* interface with the kernel and just simply shovels data
@@ -231,6 +234,11 @@
}
m->m_len = m->m_pkthdr.len = n;
m->m_pkthdr.rcvif = ifp;
+#if NBPFILTER > 0
+ if (ifp->if_bpf) {
+ bpf_mtap(ifp->if_bpf, m);
+ }
+#endif
ether_input(ifp, m);
}
@@ -265,6 +273,11 @@
}
if (i == LB_SH)
panic("lazy bum");
+#if NBPFILTER > 0
+ if (ifp->if_bpf) {
+ bpf_mtap(ifp->if_bpf, m0);
+ }
+#endif
rumpuser_writev(sc->sc_tapfd, io, i, &error);
m_freem(m0);
mutex_enter(&sc->sc_sendmtx);