Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys Add bpf tap to gre interfaces. Approved by thorpej.



details:   https://anonhg.NetBSD.org/src/rev/8715a63f3856
branches:  netbsd-1-5
changeset: 489239:8715a63f3856
user:      mjl <mjl%NetBSD.org@localhost>
date:      Fri Aug 25 01:13:25 2000 +0000

description:
Add bpf tap to gre interfaces. Approved by thorpej.

diffstat:

 sys/net/if_gre.c     |  10 +++-------
 sys/netinet/ip_gre.c |  32 +++++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 8 deletions(-)

diffs (108 lines):

diff -r 4e4ae192d5e2 -r 8715a63f3856 sys/net/if_gre.c
--- a/sys/net/if_gre.c  Thu Aug 24 13:43:13 2000 +0000
+++ b/sys/net/if_gre.c  Fri Aug 25 01:13:25 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
+/*     $NetBSD: if_gre.c,v 1.9.6.1 2000/08/25 01:13:25 mjl Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -146,10 +146,8 @@
                sc->g_dst.s_addr = sc->g_src.s_addr=INADDR_ANY;
                sc->g_proto = IPPROTO_GRE;
                if_attach(&sc->sc_if);
-#if 0
 #if NBPFILTER > 0
-               bpfattach(&sc->gre_bpf, &sc->sc_if, DLT_RAW, sizeof(u_int32_t) );
-#endif
+               bpfattach(&sc->gre_bpf, &sc->sc_if, DLT_NULL, sizeof(u_int32_t) );
 #endif
 
        }
@@ -182,7 +180,6 @@
        inp = NULL;
        osrc = 0;
 
-#if 0
 #if NBPFILTER >0
 
        if (sc->gre_bpf) {
@@ -194,10 +191,9 @@
                m0.m_len = 4;
                m0.m_data = (char *)&af;
                
-               bpf_mtap(ifp->if_bpf, &m0);
+               bpf_mtap(sc->gre_bpf, &m0);
        }
 #endif
-#endif
 
        ttl = 255;
 
diff -r 4e4ae192d5e2 -r 8715a63f3856 sys/netinet/ip_gre.c
--- a/sys/netinet/ip_gre.c      Thu Aug 24 13:43:13 2000 +0000
+++ b/sys/netinet/ip_gre.c      Fri Aug 25 01:13:25 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_gre.c,v 1.10 2000/03/30 13:24:59 augustss Exp $ */
+/*     $NetBSD: ip_gre.c,v 1.10.4.1 2000/08/25 01:13:26 mjl Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -49,6 +49,7 @@
 #include "opt_inet.h"
 #include "opt_ns.h"
 #include "opt_atalk.h"
+#include "bpfilter.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -61,6 +62,7 @@
 #include <sys/kernel.h>
 #include <sys/ioctl.h>
 #include <sys/syslog.h>
+#include <net/bpf.h>
 #include <net/ethertypes.h>
 #include <net/if.h>
 #include <net/netisr.h>
@@ -207,6 +209,20 @@
        m->m_len -= hlen;
        m->m_pkthdr.len -= hlen;
 
+#if NBPFILTER > 0
+       if (sc->gre_bpf) {
+               /* see comment of other if_foo.c files */
+               struct mbuf m0;
+               u_int32_t af = AF_INET;
+
+               m0.m_next = m;
+               m0.m_len = 4;
+               m0.m_data = (char *)&af;
+
+               bpf_mtap(sc->gre_bpf, &m0);
+               }
+#endif /*NBPFILTER > 0*/
+
        s = splimp();           /* possible */
        if (IF_QFULL(ifq)) {
                IF_DROP(ifq);
@@ -282,6 +298,20 @@
        ip->ip_sum=0;
        ip->ip_sum=in_cksum(m,(ip->ip_hl << 2));
 
+#if NBPFILTER > 0
+       if (sc->gre_bpf) {
+               /* see comment of other if_foo.c files */
+               struct mbuf m0;
+               u_int af = AF_INET;
+
+               m0.m_next = m;
+               m0.m_len = 4;
+               m0.m_data = (char *)&af;
+
+               bpf_mtap(sc->gre_bpf, &m0);
+               }
+#endif /*NBPFILTER > 0*/
+
        ifq = &ipintrq;
        s = splimp();       /* possible */
        if (IF_QFULL(ifq)) {



Home | Main Index | Thread Index | Old Index