summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_ipcomp.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2018-08-28 15:15:02 +0000
committermpi <mpi@openbsd.org>2018-08-28 15:15:02 +0000
commit2edaa7bab8dc7eebcf170add906583e7aa0263bf (patch)
tree022ca6608cd2070d6ae97cb592e4d9e14f734a90 /sys/netinet/ip_ipcomp.c
parentDrop SSLv2, SSLv3 support. (diff)
downloadwireguard-openbsd-2edaa7bab8dc7eebcf170add906583e7aa0263bf.tar.xz
wireguard-openbsd-2edaa7bab8dc7eebcf170add906583e7aa0263bf.zip
Add per-TDB counters and a new SADB extension to export them to
userland. Inputs from markus@, ok sthen@
Diffstat (limited to 'sys/netinet/ip_ipcomp.c')
-rw-r--r--sys/netinet/ip_ipcomp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c
index a5770ae44d4..7c3a10536f6 100644
--- a/sys/netinet/ip_ipcomp.c
+++ b/sys/netinet/ip_ipcomp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipcomp.c,v 1.64 2018/07/16 07:49:31 mpi Exp $ */
+/* $OpenBSD: ip_ipcomp.c,v 1.65 2018/08/28 15:15:02 mpi Exp $ */
/*
* Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)
@@ -186,6 +186,7 @@ ipcomp_input_cb(struct tdb *tdb, struct tdb_crypto *tc, struct mbuf *m, int clen
{
int skip, protoff, roff, hlen = IPCOMP_HLENGTH;
u_int8_t nproto;
+ u_int64_t ibytes;
struct mbuf *m1, *mo;
struct ipcomp *ipcomp;
caddr_t addr;
@@ -199,8 +200,10 @@ ipcomp_input_cb(struct tdb *tdb, struct tdb_crypto *tc, struct mbuf *m, int clen
protoff = tc->tc_protoff;
/* update the counters */
- tdb->tdb_cur_bytes += m->m_pkthdr.len - (skip + hlen);
- ipcompstat_add(ipcomps_ibytes, m->m_pkthdr.len - (skip + hlen));
+ ibytes = m->m_pkthdr.len - (skip + hlen);
+ tdb->tdb_cur_bytes += ibytes;
+ tdb->tdb_ibytes += ibytes;
+ ipcompstat_add(ipcomps_ibytes, ibytes);
/* Hard expiration */
if ((tdb->tdb_flags & TDBF_BYTES) &&