summaryrefslogtreecommitdiff
path: root/sys
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
parent792cd8995a3ff228d1043276abe11088caf014ea (diff)
Pass the interface (if any) to ipip_input(), so it can be used in
BPF. Closes PR 2000.
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/in_gif.c4
-rw-r--r--sys/netinet/ip_ipip.c33
-rw-r--r--sys/netinet/ip_ipsp.h4
-rw-r--r--sys/netinet6/in6_gif.c4
4 files changed, 31 insertions, 14 deletions
diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c
index 7b48276257c..2c60cd911d6 100644
--- a/sys/netinet/in_gif.c
+++ b/sys/netinet/in_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_gif.c,v 1.20 2001/07/27 15:48:38 itojun Exp $ */
+/* $OpenBSD: in_gif.c,v 1.21 2001/08/19 06:31:56 angelos Exp $ */
/* $KAME: in_gif.c,v 1.50 2001/01/22 07:27:16 itojun Exp $ */
/*
@@ -229,7 +229,7 @@ in_gif_input(m, va_alist)
m->m_pkthdr.rcvif = gifp;
gifp->if_ipackets++;
gifp->if_ibytes += m->m_pkthdr.len;
- ipip_input(m, off); /* We have a configured GIF */
+ ipip_input(m, off, gifp); /* We have a configured GIF */
return;
}
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);
diff --git a/sys/netinet/ip_ipsp.h b/sys/netinet/ip_ipsp.h
index a9528c0656a..dd412becda5 100644
--- a/sys/netinet/ip_ipsp.h
+++ b/sys/netinet/ip_ipsp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipsp.h,v 1.117 2001/07/05 08:42:57 angelos Exp $ */
+/* $OpenBSD: ip_ipsp.h,v 1.118 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),
@@ -529,7 +529,7 @@ extern int ipe4_init(struct tdb *, struct xformsw *, struct ipsecinit *);
extern int ipe4_zeroize(struct tdb *);
extern int ipip_output(struct mbuf *, struct tdb *, struct mbuf **, int, int);
extern void ipe4_input __P((struct mbuf *, ...));
-extern void ipip_input __P((struct mbuf *, int));
+extern void ipip_input __P((struct mbuf *, int, struct ifnet *));
#ifdef INET
extern void ip4_input __P((struct mbuf *, ...));
diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c
index 591a8c45aa9..24c30aed2d2 100644
--- a/sys/netinet6/in6_gif.c
+++ b/sys/netinet6/in6_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_gif.c,v 1.17 2001/07/27 15:48:38 itojun Exp $ */
+/* $OpenBSD: in6_gif.c,v 1.18 2001/08/19 06:31:56 angelos Exp $ */
/* $KAME: in6_gif.c,v 1.43 2001/01/22 07:27:17 itojun Exp $ */
/*
@@ -250,7 +250,7 @@ int in6_gif_input(mp, offp, proto)
m->m_pkthdr.rcvif = gifp;
gifp->if_ipackets++;
gifp->if_ibytes += m->m_pkthdr.len;
- ipip_input(m, *offp);
+ ipip_input(m, *offp, gifp);
return IPPROTO_DONE;
}