aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if_stf.c
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2001-06-24 14:52:55 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2001-06-24 14:52:55 +0000
commit8acb22906f4e4869e95265f7cd9f6bf7d24867d0 (patch)
tree32c402ef27fcff5e1d200bfb75e2d622ae87c93a /sys/net/if_stf.c
parent0afcb0871da6a09c7100ad4ab000ddeb11a305c2 (diff)
downloadsrc-8acb22906f4e4869e95265f7cd9f6bf7d24867d0.tar.gz
src-8acb22906f4e4869e95265f7cd9f6bf7d24867d0.zip
inject outbound packet to BPF.
Submitted by: itojun Obtained from: KAME MFC after: 10 days
Notes
Notes: svn path=/head/; revision=78701
Diffstat (limited to 'sys/net/if_stf.c')
-rw-r--r--sys/net/if_stf.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c
index 979e6c5ea778..13a67f93fc1d 100644
--- a/sys/net/if_stf.c
+++ b/sys/net/if_stf.c
@@ -1,5 +1,5 @@
/* $FreeBSD$ */
-/* $KAME: if_stf.c,v 1.60 2001/05/03 14:51:47 itojun Exp $ */
+/* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
/*
* Copyright (C) 2000 WIDE Project.
@@ -376,6 +376,30 @@ stf_output(ifp, m, dst, rt)
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));