support bpf
This commit is contained in:
parent
8189b574e4
commit
29ca934b44
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.14 2009/10/14 18:18:53 pooka Exp $");
|
|||
#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 @@ __KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.14 2009/10/14 18:18:53 pooka Exp $");
|
|||
#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 @@ virtif_worker(void *arg)
|
|||
}
|
||||
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 @@ virtif_sender(void *arg)
|
|||
}
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue