Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/net/lib/libvirtif support bpf



details:   https://anonhg.NetBSD.org/src/rev/1a8cd9b89a13
branches:  trunk
changeset: 750848:1a8cd9b89a13
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sat Jan 16 17:55:50 2010 +0000

description:
support bpf

diffstat:

 sys/rump/net/lib/libvirtif/if_virt.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (59 lines):

diff -r 9ba9c2e14c67 -r 1a8cd9b89a13 sys/rump/net/lib/libvirtif/if_virt.c
--- a/sys/rump/net/lib/libvirtif/if_virt.c      Sat Jan 16 17:03:03 2010 +0000
+++ b/sys/rump/net/lib/libvirtif/if_virt.c      Sat Jan 16 17:55:50 2010 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index