summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_ipcomp.c
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2010-06-29 21:28:37 +0000
committerreyk <reyk@openbsd.org>2010-06-29 21:28:37 +0000
commit8ddcae7338d81879e160a78411011d5b81dbde6e (patch)
treea55e7e9f71a6ac595bbe9b67475163d611591810 /sys/netinet/ip_ipcomp.c
parentDuring kernel bootstrap, stop assuming the kernel image has been loaded in (diff)
downloadwireguard-openbsd-8ddcae7338d81879e160a78411011d5b81dbde6e.tar.xz
wireguard-openbsd-8ddcae7338d81879e160a78411011d5b81dbde6e.zip
Replace enc(4) with a new implementation as a cloner device. We still
create enc0 by default, but it is possible to add additional enc interfaces. This will be used later to allow alternative encs per policy or to have an enc per rdomain when IPsec becomes rdomain-aware. manpage bits ok jmc@ input from henning@ deraadt@ toby@ naddy@ ok henning@ claudio@
Diffstat (limited to 'sys/netinet/ip_ipcomp.c')
-rw-r--r--sys/netinet/ip_ipcomp.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c
index f77c5d23dae..9ed501c1aca 100644
--- a/sys/netinet/ip_ipcomp.c
+++ b/sys/netinet/ip_ipcomp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipcomp.c,v 1.23 2008/09/15 21:46:01 chl Exp $ */
+/* $OpenBSD: ip_ipcomp.c,v 1.24 2010/06/29 21:28:37 reyk Exp $ */
/*
* Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)
@@ -382,18 +382,23 @@ ipcomp_output(m, tdb, mp, skip, protoff)
struct tdb_crypto *tc;
struct mbuf *mi, *mo;
#if NBPFILTER > 0
- struct ifnet *ifn = &(encif[0].sc_if);
+ struct ifnet *encif;
- if (ifn->if_bpf) {
- struct enchdr hdr;
+ if ((encif = enc_getif(0)) != NULL) {
+ encif->if_opackets++;
+ encif->if_obytes += m->m_pkthdr.len;
- bzero(&hdr, sizeof(hdr));
+ if (encif->if_bpf) {
+ struct enchdr hdr;
- hdr.af = tdb->tdb_dst.sa.sa_family;
- hdr.spi = tdb->tdb_spi;
+ bzero (&hdr, sizeof(hdr));
- bpf_mtap_hdr(ifn->if_bpf, (char *)&hdr, ENC_HDRLEN, m,
- BPF_DIRECTION_OUT);
+ hdr.af = tdb->tdb_dst.sa.sa_family;
+ hdr.spi = tdb->tdb_spi;
+
+ bpf_mtap_hdr(encif->if_bpf, (char *)&hdr,
+ ENC_HDRLEN, m, BPF_DIRECTION_OUT);
+ }
}
#endif
hlen = IPCOMP_HLENGTH;