summaryrefslogtreecommitdiffstats
path: root/sys/netipsec
diff options
context:
space:
mode:
authorvanhu <vanhu@FreeBSD.org>2008-08-12 09:05:01 +0000
committervanhu <vanhu@FreeBSD.org>2008-08-12 09:05:01 +0000
commit72791f9bc1200815a0f4674c7533c9add019613f (patch)
treebff7efdc5f8a70b1f3d1d6466499631b750014d3 /sys/netipsec
parent0b389f773a9c8f3b051d4428ff2da0e0312ce140 (diff)
downloadFreeBSD-src-72791f9bc1200815a0f4674c7533c9add019613f.zip
FreeBSD-src-72791f9bc1200815a0f4674c7533c9add019613f.tar.gz
Increase statistic counters for enc0 interface when enabled
and processing IPSec traffic. Approved by: gnn (mentor) MFC after: 1 week
Diffstat (limited to 'sys/netipsec')
-rw-r--r--sys/netipsec/ipsec_input.c11
-rw-r--r--sys/netipsec/ipsec_output.c11
2 files changed, 22 insertions, 0 deletions
diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c
index e98f71e..edd2223 100644
--- a/sys/netipsec/ipsec_input.c
+++ b/sys/netipsec/ipsec_input.c
@@ -93,6 +93,11 @@
#include <machine/in_cksum.h>
#include <machine/stdarg.h>
+#ifdef DEV_ENC
+#include <net/if_enc.h>
+#endif
+
+
#define IPSEC_ISTAT(p,x,y,z) ((p) == IPPROTO_ESP ? (x)++ : \
(p) == IPPROTO_AH ? (y)++ : (z)++)
@@ -455,6 +460,9 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav,
key_sa_recordxfer(sav, m); /* record data transfer */
#ifdef DEV_ENC
+ encif->if_ipackets++;
+ encif->if_ibytes += m->m_pkthdr.len;
+
/*
* Pass the mbuf to enc0 for bpf and pfil. We will filter the IPIP
* packet later after it has been decapsulated.
@@ -718,6 +726,9 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, int proto
key_sa_recordxfer(sav, m);
#ifdef DEV_ENC
+ encif->if_ipackets++;
+ encif->if_ibytes += m->m_pkthdr.len;
+
/*
* Pass the mbuf to enc0 for bpf and pfil. We will filter the IPIP
* packet later after it has been decapsulated.
diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c
index ea153d4..72840c2 100644
--- a/sys/netipsec/ipsec_output.c
+++ b/sys/netipsec/ipsec_output.c
@@ -82,6 +82,11 @@
#include <machine/in_cksum.h>
+#ifdef DEV_ENC
+#include <net/if_enc.h>
+#endif
+
+
int
ipsec_process_done(struct mbuf *m, struct ipsecrequest *isr)
{
@@ -364,6 +369,9 @@ ipsec4_process_packet(
sav = isr->sav;
#ifdef DEV_ENC
+ encif->if_opackets++;
+ encif->if_obytes += m->m_pkthdr.len;
+
/* pass the mbuf to enc0 for bpf processing */
ipsec_bpf(m, sav, AF_INET, ENC_OUT|ENC_BEFORE);
/* pass the mbuf to enc0 for packet filtering */
@@ -724,6 +732,9 @@ ipsec6_output_tunnel(struct ipsec_output_state *state, struct secpolicy *sp, int
}
#ifdef DEV_ENC
+ encif->if_opackets++;
+ encif->if_obytes += m->m_pkthdr.len;
+
/* pass the mbuf to enc0 for bpf processing */
ipsec_bpf(m, isr->sav, AF_INET6, ENC_OUT|ENC_BEFORE);
/* pass the mbuf to enc0 for packet filtering */
OpenPOWER on IntegriCloud