diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2014-07-09 09:30:50 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2014-07-09 09:30:50 +0000 |
commit | f254be81afb848372994ebd35f0ea34a274acbc8 (patch) | |
tree | bf3c15ba2e1cb64cd763ce82c78c59fbb01d7377 /sys/netinet | |
parent | 07edae74825f47a40c1c4573651c84db9a7865ed (diff) |
bpf code surgery / shuffling / simplification.
the various bpf_mtap_* are very similiar, they differ in what (and to some
extent how) they prepend something, and what copy function they pass to
bpf_catchpacket.
use an internal _bpf_mtap as "backend" for bpf_mtap and friends.
extend bpf_mtap_hdr so that it covers all common cases:
if dlen is 0, nothing gets prepended.
copy function can be given, if NULL the default bpf_mcopy is used.
adjust the existing bpf_mtap_hdr users to pass a NULL ptr for the copy fn.
re-implement bpf_mtap_af as simple wrapper for bpf_mtap_hdr.
re-implement bpf_mtap_ether using bpf_map_hdr
re-implement bpf_mtap_pflog as trivial bpf_mtap_hdr wrapper
ok bluhm benno
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ip_ah.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_carp.c | 6 | ||||
-rw-r--r-- | sys/netinet/ip_esp.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_ipcomp.c | 4 | ||||
-rw-r--r-- | sys/netinet/ipsec_input.c | 4 |
5 files changed, 11 insertions, 11 deletions
diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c index 64f5f198d72..8473c301549 100644 --- a/sys/netinet/ip_ah.c +++ b/sys/netinet/ip_ah.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah.c,v 1.108 2014/01/09 06:29:05 tedu Exp $ */ +/* $OpenBSD: ip_ah.c,v 1.109 2014/07/09 09:30:49 henning Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -1016,7 +1016,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, hdr.flags |= M_AUTH; bpf_mtap_hdr(encif->if_bpf, (char *)&hdr, - ENC_HDRLEN, m, BPF_DIRECTION_OUT); + ENC_HDRLEN, m, BPF_DIRECTION_OUT, NULL); } } #endif diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 0c50adc9d53..608205c1990 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.230 2014/06/30 07:02:22 mpi Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.231 2014/07/09 09:30:49 henning Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -1454,7 +1454,7 @@ carp_input(struct ifnet *ifp0, struct ether_header *eh0, struct mbuf *m) #if NBPFILTER > 0 if (vh->sc_if.if_bpf) bpf_mtap_hdr(vh->sc_if.if_bpf, (char *)&eh, - ETHER_HDR_LEN, m0, BPF_DIRECTION_IN); + ETHER_HDR_LEN, m0, BPF_DIRECTION_IN, NULL); #endif vh->sc_if.if_ipackets++; ether_input(&vh->sc_if, &eh, m0); @@ -1470,7 +1470,7 @@ carp_input(struct ifnet *ifp0, struct ether_header *eh0, struct mbuf *m) #if NBPFILTER > 0 if (ifp->if_bpf) bpf_mtap_hdr(ifp->if_bpf, (char *)&eh, ETHER_HDR_LEN, m, - BPF_DIRECTION_IN); + BPF_DIRECTION_IN, NULL); #endif ifp->if_ipackets++; ether_input(ifp, &eh, m); diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c index 9df5825cf31..bf29436a217 100644 --- a/sys/netinet/ip_esp.c +++ b/sys/netinet/ip_esp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp.c,v 1.123 2014/01/09 06:29:06 tedu Exp $ */ +/* $OpenBSD: ip_esp.c,v 1.124 2014/07/09 09:30:49 henning Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -803,7 +803,7 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, hdr.flags |= M_AUTH; bpf_mtap_hdr(encif->if_bpf, (char *)&hdr, - ENC_HDRLEN, m, BPF_DIRECTION_OUT); + ENC_HDRLEN, m, BPF_DIRECTION_OUT, NULL); } } #endif diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c index f0dba810a49..6e753eb8d51 100644 --- a/sys/netinet/ip_ipcomp.c +++ b/sys/netinet/ip_ipcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipcomp.c,v 1.33 2014/01/09 06:29:06 tedu Exp $ */ +/* $OpenBSD: ip_ipcomp.c,v 1.34 2014/07/09 09:30:49 henning Exp $ */ /* * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) @@ -402,7 +402,7 @@ ipcomp_output(m, tdb, mp, skip, protoff) hdr.spi = tdb->tdb_spi; bpf_mtap_hdr(encif->if_bpf, (char *)&hdr, - ENC_HDRLEN, m, BPF_DIRECTION_OUT); + ENC_HDRLEN, m, BPF_DIRECTION_OUT, NULL); } } #endif diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index 40f7afbae36..6b1eb7ee1d7 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.120 2014/04/14 09:06:42 mpi Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.121 2014/07/09 09:30:49 henning Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -702,7 +702,7 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff, hdr.flags = m->m_flags & (M_AUTH|M_CONF); bpf_mtap_hdr(encif->if_bpf, (char *)&hdr, - ENC_HDRLEN, m, BPF_DIRECTION_IN); + ENC_HDRLEN, m, BPF_DIRECTION_IN, NULL); } } #endif |