summaryrefslogtreecommitdiffstats
path: root/sys/netipsec/xform_ipip.c
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2013-06-20 11:44:16 +0000
committerae <ae@FreeBSD.org>2013-06-20 11:44:16 +0000
commitb05df49af65d3ab697c586f71af5d5fe6f368656 (patch)
tree3928f332f78b418bcf02494aa8434e53a06aa4b4 /sys/netipsec/xform_ipip.c
parent1e4c88cc8b89f670f8e6f11dd0db6d4cc0f53c16 (diff)
downloadFreeBSD-src-b05df49af65d3ab697c586f71af5d5fe6f368656.zip
FreeBSD-src-b05df49af65d3ab697c586f71af5d5fe6f368656.tar.gz
Use corresponding macros to update statistics for AH, ESP, IPIP, IPCOMP,
PFKEY. MFC after: 2 weeks
Diffstat (limited to 'sys/netipsec/xform_ipip.c')
-rw-r--r--sys/netipsec/xform_ipip.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/sys/netipsec/xform_ipip.c b/sys/netipsec/xform_ipip.c
index fc3b1d2..8d00228 100644
--- a/sys/netipsec/xform_ipip.c
+++ b/sys/netipsec/xform_ipip.c
@@ -115,7 +115,7 @@ ip4_input6(struct mbuf **m, int *offp, int proto)
/* If we do not accept IP-in-IP explicitly, drop. */
if (!V_ipip_allow && ((*m)->m_flags & M_IPSEC) == 0) {
DPRINTF(("%s: dropped due to policy\n", __func__));
- V_ipipstat.ipips_pdrops++;
+ IPIPSTAT_INC(ipips_pdrops);
m_freem(*m);
return IPPROTO_DONE;
}
@@ -136,7 +136,7 @@ ip4_input(struct mbuf *m, int off)
/* If we do not accept IP-in-IP explicitly, drop. */
if (!V_ipip_allow && (m->m_flags & M_IPSEC) == 0) {
DPRINTF(("%s: dropped due to policy\n", __func__));
- V_ipipstat.ipips_pdrops++;
+ IPIPSTAT_INC(ipips_pdrops);
m_freem(m);
return;
}
@@ -172,7 +172,7 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
u_int8_t v;
int hlen;
- V_ipipstat.ipips_ipackets++;
+ IPIPSTAT_INC(ipips_ipackets);
m_copydata(m, 0, 1, &v);
@@ -188,7 +188,7 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
break;
#endif
default:
- V_ipipstat.ipips_family++;
+ IPIPSTAT_INC(ipips_family);
m_freem(m);
return /* EAFNOSUPPORT */;
}
@@ -197,7 +197,7 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
if (m->m_len < hlen) {
if ((m = m_pullup(m, hlen)) == NULL) {
DPRINTF(("%s: m_pullup (1) failed\n", __func__));
- V_ipipstat.ipips_hdrops++;
+ IPIPSTAT_INC(ipips_hdrops);
return;
}
}
@@ -234,7 +234,7 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
/* Sanity check */
if (m->m_pkthdr.len < sizeof(struct ip)) {
- V_ipipstat.ipips_hdrops++;
+ IPIPSTAT_INC(ipips_hdrops);
m_freem(m);
return;
}
@@ -254,7 +254,7 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
break;
#endif
default:
- V_ipipstat.ipips_family++;
+ IPIPSTAT_INC(ipips_family);
m_freem(m);
return; /* EAFNOSUPPORT */
}
@@ -265,7 +265,7 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
if (m->m_len < hlen) {
if ((m = m_pullup(m, hlen)) == NULL) {
DPRINTF(("%s: m_pullup (2) failed\n", __func__));
- V_ipipstat.ipips_hdrops++;
+ IPIPSTAT_INC(ipips_hdrops);
return;
}
}
@@ -316,7 +316,7 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
if (sin->sin_addr.s_addr ==
ipo->ip_src.s_addr) {
- V_ipipstat.ipips_spoof++;
+ IPIPSTAT_INC(ipips_spoof);
m_freem(m);
IFNET_RUNLOCK_NOSLEEP();
return;
@@ -333,7 +333,7 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
sin6 = (struct sockaddr_in6 *) ifa->ifa_addr;
if (IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr, &ip6->ip6_src)) {
- V_ipipstat.ipips_spoof++;
+ IPIPSTAT_INC(ipips_spoof);
m_freem(m);
IFNET_RUNLOCK_NOSLEEP();
return;
@@ -347,7 +347,7 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
}
/* Statistics */
- V_ipipstat.ipips_ibytes += m->m_pkthdr.len - iphlen;
+ IPIPSTAT_ADD(ipips_ibytes, m->m_pkthdr.len - iphlen);
#ifdef DEV_ENC
switch (v >> 4) {
@@ -393,7 +393,7 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
}
if (netisr_queue(isr, m)) { /* (0) on success. */
- V_ipipstat.ipips_qfull++;
+ IPIPSTAT_INC(ipips_qfull);
DPRINTF(("%s: packet dropped because of full queue\n",
__func__));
}
@@ -442,7 +442,7 @@ ipip_output(
"address in SA %s/%08lx\n", __func__,
ipsec_address(&saidx->dst),
(u_long) ntohl(sav->spi)));
- V_ipipstat.ipips_unspec++;
+ IPIPSTAT_INC(ipips_unspec);
error = EINVAL;
goto bad;
}
@@ -450,7 +450,7 @@ ipip_output(
M_PREPEND(m, sizeof(struct ip), M_NOWAIT);
if (m == 0) {
DPRINTF(("%s: M_PREPEND failed\n", __func__));
- V_ipipstat.ipips_hdrops++;
+ IPIPSTAT_INC(ipips_hdrops);
error = ENOBUFS;
goto bad;
}
@@ -522,7 +522,7 @@ ipip_output(
"address in SA %s/%08lx\n", __func__,
ipsec_address(&saidx->dst),
(u_long) ntohl(sav->spi)));
- V_ipipstat.ipips_unspec++;
+ IPIPSTAT_INC(ipips_unspec);
error = ENOBUFS;
goto bad;
}
@@ -537,7 +537,7 @@ ipip_output(
M_PREPEND(m, sizeof(struct ip6_hdr), M_NOWAIT);
if (m == 0) {
DPRINTF(("%s: M_PREPEND failed\n", __func__));
- V_ipipstat.ipips_hdrops++;
+ IPIPSTAT_INC(ipips_hdrops);
error = ENOBUFS;
goto bad;
}
@@ -591,12 +591,12 @@ ipip_output(
nofamily:
DPRINTF(("%s: unsupported protocol family %u\n", __func__,
saidx->dst.sa.sa_family));
- V_ipipstat.ipips_family++;
+ IPIPSTAT_INC(ipips_family);
error = EAFNOSUPPORT; /* XXX diffs from openbsd */
goto bad;
}
- V_ipipstat.ipips_opackets++;
+ IPIPSTAT_INC(ipips_opackets);
*mp = m;
#ifdef INET
@@ -606,7 +606,8 @@ nofamily:
tdb->tdb_cur_bytes +=
m->m_pkthdr.len - sizeof(struct ip);
#endif
- V_ipipstat.ipips_obytes += m->m_pkthdr.len - sizeof(struct ip);
+ IPIPSTAT_ADD(ipips_obytes,
+ m->m_pkthdr.len - sizeof(struct ip));
}
#endif /* INET */
@@ -617,8 +618,8 @@ nofamily:
tdb->tdb_cur_bytes +=
m->m_pkthdr.len - sizeof(struct ip6_hdr);
#endif
- V_ipipstat.ipips_obytes +=
- m->m_pkthdr.len - sizeof(struct ip6_hdr);
+ IPIPSTAT_ADD(ipips_obytes,
+ m->m_pkthdr.len - sizeof(struct ip6_hdr));
}
#endif /* INET6 */
OpenPOWER on IntegriCloud