summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2012-04-14 09:39:48 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2012-04-14 09:39:48 +0000
commit576433f81918e999d238d312ba1c6e5b71d36280 (patch)
tree23eae77aa3449ca9b39615863b93a77f6b54982c /sys
parent852a7ed231a6296007177e8f5df9ec3978d4dab8 (diff)
Use DLT_LOOP for all tunneling interfaces.
Byte order adjustment for bpf was hidden behind bpf_mtap_af() and sizeof(u_int32_t) is used for length of the bpf header. tested by sebastia and mxb at alumni.chalmers.se. ok claudio
Diffstat (limited to 'sys')
-rw-r--r--sys/net/bpf.c6
-rw-r--r--sys/net/if_faith.c4
-rw-r--r--sys/net/if_gif.c5
-rw-r--r--sys/net/if_gre.c5
-rw-r--r--sys/net/if_loop.c5
-rw-r--r--sys/net/if_mpe.c4
-rw-r--r--sys/net/if_pppx.c4
7 files changed, 16 insertions, 17 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 93eddc654a9..0626359bb1e 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.79 2012/01/16 03:34:58 guenther Exp $ */
+/* $OpenBSD: bpf.c,v 1.80 2012/04/14 09:39:46 yasuoka Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
@@ -1247,11 +1247,13 @@ void
bpf_mtap_af(caddr_t arg, u_int32_t af, struct mbuf *m, u_int direction)
{
struct m_hdr mh;
+ u_int32_t afh;
mh.mh_flags = 0;
mh.mh_next = m;
mh.mh_len = 4;
- mh.mh_data = (caddr_t)&af;
+ afh = htonl(af);
+ mh.mh_data = (caddr_t)&afh;
bpf_mtap(arg, (struct mbuf *) &mh, direction);
m->m_flags |= mh.mh_flags & M_FILDROP;
diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c
index a6c6173d0ca..6761b9ff115 100644
--- a/sys/net/if_faith.c
+++ b/sys/net/if_faith.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_faith.c,v 1.26 2010/05/06 21:38:19 claudio Exp $ */
+/* $OpenBSD: if_faith.c,v 1.27 2012/04/14 09:39:46 yasuoka Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
@@ -112,7 +112,7 @@ faith_clone_create(ifc, unit)
if_attach(ifp);
if_alloc_sadl(ifp);
#if NBPFILTER > 0
- bpfattach(&ifp->if_bpf, ifp, DLT_NULL, sizeof(u_int));
+ bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t));
#endif
return (0);
}
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 3aab9f40093..c638060c32e 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.55 2010/07/03 04:44:51 guenther Exp $ */
+/* $OpenBSD: if_gif.c,v 1.56 2012/04/14 09:39:46 yasuoka Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -111,8 +111,7 @@ gif_clone_create(struct if_clone *ifc, int unit)
if_alloc_sadl(&sc->gif_if);
#if NBPFILTER > 0
- bpfattach(&sc->gif_if.if_bpf, &sc->gif_if, DLT_NULL,
- sizeof(u_int));
+ bpfattach(&sc->gif_if.if_bpf, &sc->gif_if, DLT_LOOP, sizeof(u_int32_t));
#endif
s = splnet();
LIST_INSERT_HEAD(&gif_softc_list, sc, gif_list);
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index ce5956f180a..88f3ba3bd3c 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.57 2011/07/12 15:23:50 jsg Exp $ */
+/* $OpenBSD: if_gre.c,v 1.58 2012/04/14 09:39:47 yasuoka Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -156,8 +156,7 @@ gre_clone_create(struct if_clone *ifc, int unit)
if_alloc_sadl(&sc->sc_if);
#if NBPFILTER > 0
- bpfattach(&sc->sc_if.if_bpf, &sc->sc_if, DLT_NULL,
- sizeof(u_int32_t));
+ bpfattach(&sc->sc_if.if_bpf, &sc->sc_if, DLT_LOOP, sizeof(u_int32_t));
#endif
s = splnet();
LIST_INSERT_HEAD(&gre_softc_list, sc, sc_list);
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index 471c8b8d98f..cd87dbf4176 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_loop.c,v 1.46 2011/07/09 00:47:18 henning Exp $ */
+/* $OpenBSD: if_loop.c,v 1.47 2012/04/14 09:39:47 yasuoka Exp $ */
/* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */
/*
@@ -240,8 +240,7 @@ looutput(ifp, m, dst, rt)
* packets for local use. But don't dup them to bpf.
*/
if (ifp->if_bpf && (ifp->if_flags & IFF_LOOPBACK))
- bpf_mtap_af(ifp->if_bpf, htonl(dst->sa_family), m,
- BPF_DIRECTION_OUT);
+ bpf_mtap_af(ifp->if_bpf, dst->sa_family, m, BPF_DIRECTION_OUT);
#endif
m->m_pkthdr.rcvif = ifp;
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c
index 7be3d4582b4..8018fb93f3e 100644
--- a/sys/net/if_mpe.c
+++ b/sys/net/if_mpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpe.c,v 1.26 2011/08/20 06:21:32 mcbride Exp $ */
+/* $OpenBSD: if_mpe.c,v 1.27 2012/04/14 09:39:47 yasuoka Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -110,7 +110,7 @@ mpe_clone_create(struct if_clone *ifc, int unit)
if_attach(ifp);
if_alloc_sadl(ifp);
#if NBPFILTER > 0
- bpfattach(&ifp->if_bpf, ifp, DLT_NULL, sizeof(u_int32_t));
+ bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t));
#endif
s = splnet();
diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c
index 008f68f7cbe..94ed47f17b8 100644
--- a/sys/net/if_pppx.c
+++ b/sys/net/if_pppx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppx.c,v 1.13 2011/10/25 23:54:58 dlg Exp $ */
+/* $OpenBSD: if_pppx.c,v 1.14 2012/04/14 09:39:47 yasuoka Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
@@ -877,7 +877,7 @@ pppx_add_session(struct pppx_dev *pxd, struct pipex_session_req *req)
if_alloc_sadl(ifp);
#if NBPFILTER > 0
- bpfattach(&ifp->if_bpf, ifp, DLT_NULL, 0);
+ bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t));
#endif
SET(ifp->if_flags, IFF_RUNNING);