Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/net Pull up revision 1.16 (requested by itojun):



details:   https://anonhg.NetBSD.org/src/rev/961a807c1feb
branches:  netbsd-1-5
changeset: 491874:961a807c1feb
user:      he <he%NetBSD.org@localhost>
date:      Sun Jun 10 18:35:41 2001 +0000

description:
Pull up revision 1.16 (requested by itojun):
  Inject packets to bpf in outgoing path.

diffstat:

 sys/net/if_stf.c |  26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diffs (40 lines):

diff -r 3155a8bbd15d -r 961a807c1feb sys/net/if_stf.c
--- a/sys/net/if_stf.c  Sun Jun 10 18:33:48 2001 +0000
+++ b/sys/net/if_stf.c  Sun Jun 10 18:35:41 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_stf.c,v 1.4.2.2 2001/05/01 11:55:37 he Exp $        */
+/*     $NetBSD: if_stf.c,v 1.4.2.3 2001/06/10 18:35:41 he Exp $        */
 /*     $KAME: if_stf.c,v 1.39 2000/06/07 23:35:18 itojun Exp $ */
 
 /*
@@ -429,6 +429,30 @@
                return ENETUNREACH;
        }
 
+#if NBPFILTER > 0
+       if (ifp->if_bpf) {
+               /*
+                * We need to prepend the address family as
+                * a four byte field.  Cons up a dummy header
+                * to pacify bpf.  This is safe because bpf
+                * will only read from the mbuf (i.e., it won't
+                * try to free it or keep a pointer a to it).
+                */
+               struct mbuf m0;
+               u_int32_t af = AF_INET6;
+               
+               m0.m_next = m;
+               m0.m_len = 4;
+               m0.m_data = (char *)&af;
+               
+#ifdef HAVE_OLD_BPF
+               bpf_mtap(ifp, &m0);
+#else
+               bpf_mtap(ifp->if_bpf, &m0);
+#endif
+       }
+#endif /*NBPFILTER > 0*/
+
        M_PREPEND(m, sizeof(struct ip), M_DONTWAIT);
        if (m && m->m_len < sizeof(struct ip))
                m = m_pullup(m, sizeof(struct ip));



Home | Main Index | Thread Index | Old Index