summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_ipip.c
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-08-19 06:31:57 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-08-19 06:31:57 +0000
commit17975db97fbd8cd77aede61868ad873359891f37 (patch)
treead4afc63686305ca9c7dd3db2c916bb32905aec6 /sys/netinet/ip_ipip.c
parent792cd8995a3ff228d1043276abe11088caf014ea (diff)
Pass the interface (if any) to ipip_input(), so it can be used in
BPF. Closes PR 2000.
Diffstat (limited to 'sys/netinet/ip_ipip.c')
-rw-r--r--sys/netinet/ip_ipip.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/sys/netinet/ip_ipip.c b/sys/netinet/ip_ipip.c
index 61dcbaaffb8..555c75a1ba3 100644
--- a/sys/netinet/ip_ipip.c
+++ b/sys/netinet/ip_ipip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipip.c,v 1.20 2001/07/04 23:14:55 espie Exp $ */
+/* $OpenBSD: ip_ipip.c,v 1.21 2001/08/19 06:31:56 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -48,6 +48,7 @@
#include <net/if.h>
#include <net/route.h>
#include <net/netisr.h>
+#include <net/bpf.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -64,6 +65,8 @@
#include <netinet/ip_ipsp.h>
#include <netinet/ip_ipip.h>
+#include "bpfilter.h"
+
#ifdef ENCDEBUG
#define DPRINTF(x) if (encdebug) printf x
#else
@@ -93,7 +96,7 @@ ip4_input6(struct mbuf **m, int *offp, int proto)
return IPPROTO_DONE;
}
- ipip_input(*m, *offp);
+ ipip_input(*m, *offp, NULL);
return IPPROTO_DONE;
}
#endif /* INET6 */
@@ -120,7 +123,7 @@ ip4_input(struct mbuf *m, ...)
iphlen = va_arg(ap, int);
va_end(ap);
- ipip_input(m, iphlen);
+ ipip_input(m, iphlen, NULL);
}
#endif /* INET */
@@ -132,7 +135,7 @@ ip4_input(struct mbuf *m, ...)
*/
void
-ipip_input(struct mbuf *m, int iphlen)
+ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
{
register struct sockaddr_in *sin;
register struct ifnet *ifp;
@@ -219,10 +222,6 @@ ipip_input(struct mbuf *m, int iphlen)
hlen = sizeof(struct ip6_hdr);
break;
#endif
-
- default:
- m_freem(m);
- return /* EAFNOSUPPORT */;
}
/*
@@ -334,6 +333,24 @@ ipip_input(struct mbuf *m, int iphlen)
}
#endif /* INET6 */
+#if NBPFILTER > 0
+ if (gifp && gifp->if_bpf) {
+ struct mbuf m0;
+ u_int af;
+
+ if (ipo)
+ af = AF_INET;
+ else
+ af = AF_INET6;
+
+ m0.m_next = m;
+ m0.m_len = 4;
+ m0.m_data = (char *)&af;
+
+ bpf_mtap(gifp->if_bpf, &m0);
+ }
+#endif
+
s = splimp(); /* isn't it already? */
if (IF_QFULL(ifq)) {
IF_DROP(ifq);