summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2017-11-07 16:51:23 +0000
committervisa <visa@openbsd.org>2017-11-07 16:51:23 +0000
commit56b63e1c0470fca8f47d1937a90f3402a2527fb3 (patch)
tree57f81f6656d02c190f02b7af8b36c1a59d8bc45c
parentSerialize access to the IPv6 reassembly queue with a mutex. (diff)
downloadwireguard-openbsd-56b63e1c0470fca8f47d1937a90f3402a2527fb3.tar.xz
wireguard-openbsd-56b63e1c0470fca8f47d1937a90f3402a2527fb3.zip
Convert all the fields of {ah,esp,ipcomp}stat to uint64.
This is a preliminary step for using percpu counters with the data. OK mpi@
-rw-r--r--sys/netinet/ip_ah.h41
-rw-r--r--sys/netinet/ip_esp.h52
-rw-r--r--sys/netinet/ip_ipcomp.h36
-rw-r--r--usr.bin/netstat/inet.c110
4 files changed, 121 insertions, 118 deletions
diff --git a/sys/netinet/ip_ah.h b/sys/netinet/ip_ah.h
index 61ce7afa4fc..c3dd6cfd795 100644
--- a/sys/netinet/ip_ah.h
+++ b/sys/netinet/ip_ah.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ah.h,v 1.34 2017/02/07 18:18:16 bluhm Exp $ */
+/* $OpenBSD: ip_ah.h,v 1.35 2017/11/07 16:51:23 visa Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -39,25 +39,26 @@
#define _NETINET_IP_AH_H_
struct ahstat {
- u_int32_t ahs_hdrops; /* Packet shorter than header shows */
- u_int32_t ahs_nopf; /* Protocol family not supported */
- u_int32_t ahs_notdb;
- u_int32_t ahs_badkcr;
- u_int32_t ahs_badauth;
- u_int32_t ahs_noxform;
- u_int32_t ahs_qfull;
- u_int32_t ahs_wrap;
- u_int32_t ahs_replay;
- u_int32_t ahs_badauthl; /* Bad authenticator length */
- u_int32_t ahs_input; /* Input AH packets */
- u_int32_t ahs_output; /* Output AH packets */
- u_int32_t ahs_invalid; /* Trying to use an invalid TDB */
- u_int64_t ahs_ibytes; /* Input bytes */
- u_int64_t ahs_obytes; /* Output bytes */
- u_int32_t ahs_toobig; /* Packet got larger than IP_MAXPACKET */
- u_int32_t ahs_pdrops; /* Packet blocked due to policy */
- u_int32_t ahs_crypto; /* Crypto processing failure */
- u_int32_t ahs_outfail; /* Packet output failure */
+ uint64_t ahs_hdrops; /* Packet shorter than header shows */
+ uint64_t ahs_nopf; /* Protocol family not supported */
+ uint64_t ahs_notdb;
+ uint64_t ahs_badkcr;
+ uint64_t ahs_badauth;
+ uint64_t ahs_noxform;
+ uint64_t ahs_qfull;
+ uint64_t ahs_wrap;
+ uint64_t ahs_replay;
+ uint64_t ahs_badauthl; /* Bad authenticator length */
+ uint64_t ahs_input; /* Input AH packets */
+ uint64_t ahs_output; /* Output AH packets */
+ uint64_t ahs_invalid; /* Trying to use an invalid TDB */
+ uint64_t ahs_ibytes; /* Input bytes */
+ uint64_t ahs_obytes; /* Output bytes */
+ uint64_t ahs_toobig; /* Packet got larger than
+ * IP_MAXPACKET */
+ uint64_t ahs_pdrops; /* Packet blocked due to policy */
+ uint64_t ahs_crypto; /* Crypto processing failure */
+ uint64_t ahs_outfail; /* Packet output failure */
};
struct ah {
diff --git a/sys/netinet/ip_esp.h b/sys/netinet/ip_esp.h
index 3ff93422939..7a4f15eefaf 100644
--- a/sys/netinet/ip_esp.h
+++ b/sys/netinet/ip_esp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp.h,v 1.44 2017/02/07 18:18:16 bluhm Exp $ */
+/* $OpenBSD: ip_esp.h,v 1.45 2017/11/07 16:51:23 visa Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -39,30 +39,32 @@
#define _NETINET_IP_ESP_H_
struct espstat {
- u_int32_t esps_hdrops; /* Packet shorter than header shows */
- u_int32_t esps_nopf; /* Protocol family not supported */
- u_int32_t esps_notdb;
- u_int32_t esps_badkcr;
- u_int32_t esps_qfull;
- u_int32_t esps_noxform;
- u_int32_t esps_badilen;
- u_int32_t esps_wrap; /* Replay counter wrapped around */
- u_int32_t esps_badenc; /* Bad encryption detected */
- u_int32_t esps_badauth; /* Only valid for transforms with auth */
- u_int32_t esps_replay; /* Possible packet replay detected */
- u_int32_t esps_input; /* Input ESP packets */
- u_int32_t esps_output; /* Output ESP packets */
- u_int32_t esps_invalid; /* Trying to use an invalid TDB */
- u_int64_t esps_ibytes; /* Input bytes */
- u_int64_t esps_obytes; /* Output bytes */
- u_int32_t esps_toobig; /* Packet got larger than IP_MAXPACKET */
- u_int32_t esps_pdrops; /* Packet blocked due to policy */
- u_int32_t esps_crypto; /* Crypto processing failure */
- u_int32_t esps_udpencin; /* Input ESP-in-UDP packets */
- u_int32_t esps_udpencout; /* Output ESP-in-UDP packets */
- u_int32_t esps_udpinval; /* Invalid input ESP-in-UDP packets */
- u_int32_t esps_udpneeded; /* Trying to use a ESP-in-UDP TDB */
- u_int32_t esps_outfail; /* Packet output failure */
+ uint64_t esps_hdrops; /* Packet shorter than header shows */
+ uint64_t esps_nopf; /* Protocol family not supported */
+ uint64_t esps_notdb;
+ uint64_t esps_badkcr;
+ uint64_t esps_qfull;
+ uint64_t esps_noxform;
+ uint64_t esps_badilen;
+ uint64_t esps_wrap; /* Replay counter wrapped around */
+ uint64_t esps_badenc; /* Bad encryption detected */
+ uint64_t esps_badauth; /* Only valid for transforms
+ * with auth */
+ uint64_t esps_replay; /* Possible packet replay detected */
+ uint64_t esps_input; /* Input ESP packets */
+ uint64_t esps_output; /* Output ESP packets */
+ uint64_t esps_invalid; /* Trying to use an invalid TDB */
+ uint64_t esps_ibytes; /* Input bytes */
+ uint64_t esps_obytes; /* Output bytes */
+ uint64_t esps_toobig; /* Packet got larger than
+ * IP_MAXPACKET */
+ uint64_t esps_pdrops; /* Packet blocked due to policy */
+ uint64_t esps_crypto; /* Crypto processing failure */
+ uint64_t esps_udpencin; /* Input ESP-in-UDP packets */
+ uint64_t esps_udpencout; /* Output ESP-in-UDP packets */
+ uint64_t esps_udpinval; /* Invalid input ESP-in-UDP packets */
+ uint64_t esps_udpneeded; /* Trying to use a ESP-in-UDP TDB */
+ uint64_t esps_outfail; /* Packet output failure */
};
/*
diff --git a/sys/netinet/ip_ipcomp.h b/sys/netinet/ip_ipcomp.h
index 0ebd45d2edc..730e8712a70 100644
--- a/sys/netinet/ip_ipcomp.h
+++ b/sys/netinet/ip_ipcomp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipcomp.h,v 1.8 2017/02/07 18:18:16 bluhm Exp $ */
+/* $OpenBSD: ip_ipcomp.h,v 1.9 2017/11/07 16:51:23 visa Exp $ */
/*
* Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)
@@ -33,25 +33,25 @@
#define _NETINET_IP_IPCOMP_H_
struct ipcompstat {
- u_int32_t ipcomps_hdrops; /* Packet shorter than header shows */
- u_int32_t ipcomps_nopf; /* Protocol family not supported */
- u_int32_t ipcomps_notdb;
- u_int32_t ipcomps_badkcr;
- u_int32_t ipcomps_qfull;
- u_int32_t ipcomps_noxform;
- u_int32_t ipcomps_wrap;
- u_int32_t ipcomps_input; /* Input IPcomp packets */
- u_int32_t ipcomps_output; /* Output IPcomp packets */
- u_int32_t ipcomps_invalid; /* Trying to use an invalid
+ uint64_t ipcomps_hdrops; /* Packet shorter than header shows */
+ uint64_t ipcomps_nopf; /* Protocol family not supported */
+ uint64_t ipcomps_notdb;
+ uint64_t ipcomps_badkcr;
+ uint64_t ipcomps_qfull;
+ uint64_t ipcomps_noxform;
+ uint64_t ipcomps_wrap;
+ uint64_t ipcomps_input; /* Input IPcomp packets */
+ uint64_t ipcomps_output; /* Output IPcomp packets */
+ uint64_t ipcomps_invalid; /* Trying to use an invalid
* TDB */
- u_int64_t ipcomps_ibytes; /* Input bytes */
- u_int64_t ipcomps_obytes; /* Output bytes */
- u_int32_t ipcomps_toobig; /* Packet got larger than
+ uint64_t ipcomps_ibytes; /* Input bytes */
+ uint64_t ipcomps_obytes; /* Output bytes */
+ uint64_t ipcomps_toobig; /* Packet got larger than
* IP_MAXPACKET */
- u_int32_t ipcomps_pdrops; /* Packet blocked due to policy */
- u_int32_t ipcomps_crypto; /* "Crypto" processing failure */
- u_int32_t ipcomps_minlen; /* packets too short for compress */
- u_int32_t ipcomps_outfail; /* Packet output failure */
+ uint64_t ipcomps_pdrops; /* Packet blocked due to policy */
+ uint64_t ipcomps_crypto; /* "Crypto" processing failure */
+ uint64_t ipcomps_minlen; /* packets too short for compress */
+ uint64_t ipcomps_outfail; /* Packet output failure */
};
/* IPCOMP header */
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 4f0917c5097..af37c5cd761 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet.c,v 1.161 2017/10/25 12:38:21 job Exp $ */
+/* $OpenBSD: inet.c,v 1.162 2017/11/07 16:51:23 visa Exp $ */
/* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */
/*
@@ -952,23 +952,23 @@ ah_stats(char *name)
#define p1(f, m) if (ahstat.f || sflag <= 1) \
printf(m, ahstat.f)
- p1(ahs_input, "\t%u input AH packets\n");
- p1(ahs_output, "\t%u output AH packets\n");
- p(ahs_nopf, "\t%u packet%s from unsupported protocol families\n");
- p(ahs_hdrops, "\t%u packet%s shorter than header shows\n");
- p(ahs_pdrops, "\t%u packet%s dropped due to policy\n");
- p(ahs_notdb, "\t%u packet%s for which no TDB was found\n");
- p(ahs_badkcr, "\t%u input packet%s that failed to be processed\n");
- p(ahs_badauth, "\t%u packet%s that failed verification received\n");
- p(ahs_noxform, "\t%u packet%s for which no XFORM was set in TDB received\n");
- p(ahs_qfull, "\t%u packet%s were dropped due to full output queue\n");
- p(ahs_wrap, "\t%u packet%s where counter wrapping was detected\n");
- p(ahs_replay, "\t%u possibly replayed packet%s received\n");
- p(ahs_badauthl, "\t%u packet%s with bad authenticator length received\n");
- p(ahs_invalid, "\t%u packet%s attempted to use an invalid TDB\n");
- p(ahs_toobig, "\t%u packet%s got larger than max IP packet size\n");
- p(ahs_crypto, "\t%u packet%s that failed crypto processing\n");
- p(ahs_outfail, "\t%u output packet%s could not be sent\n");
+ p1(ahs_input, "\t%llu input AH packets\n");
+ p1(ahs_output, "\t%llu output AH packets\n");
+ p(ahs_nopf, "\t%llu packet%s from unsupported protocol families\n");
+ p(ahs_hdrops, "\t%llu packet%s shorter than header shows\n");
+ p(ahs_pdrops, "\t%llu packet%s dropped due to policy\n");
+ p(ahs_notdb, "\t%llu packet%s for which no TDB was found\n");
+ p(ahs_badkcr, "\t%llu input packet%s that failed to be processed\n");
+ p(ahs_badauth, "\t%llu packet%s that failed verification received\n");
+ p(ahs_noxform, "\t%llu packet%s for which no XFORM was set in TDB received\n");
+ p(ahs_qfull, "\t%llu packet%s were dropped due to full output queue\n");
+ p(ahs_wrap, "\t%llu packet%s where counter wrapping was detected\n");
+ p(ahs_replay, "\t%llu possibly replayed packet%s received\n");
+ p(ahs_badauthl, "\t%llu packet%s with bad authenticator length received\n");
+ p(ahs_invalid, "\t%llu packet%s attempted to use an invalid TDB\n");
+ p(ahs_toobig, "\t%llu packet%s got larger than max IP packet size\n");
+ p(ahs_crypto, "\t%llu packet%s that failed crypto processing\n");
+ p(ahs_outfail, "\t%llu output packet%s could not be sent\n");
p(ahs_ibytes, "\t%llu input byte%s\n");
p(ahs_obytes, "\t%llu output byte%s\n");
@@ -1030,28 +1030,28 @@ esp_stats(char *name)
#define p(f, m) if (espstat.f || sflag <= 1) \
printf(m, espstat.f, plural(espstat.f))
- p(esps_input, "\t%u input ESP packet%s\n");
- p(esps_output, "\t%u output ESP packet%s\n");
- p(esps_nopf, "\t%u packet%s from unsupported protocol families\n");
- p(esps_hdrops, "\t%u packet%s shorter than header shows\n");
- p(esps_pdrops, "\t%u packet%s dropped due to policy\n");
- p(esps_notdb, "\t%u packet%s for which no TDB was found\n");
- p(esps_badkcr, "\t%u input packet%s that failed to be processed\n");
- p(esps_badenc, "\t%u packet%s with bad encryption received\n");
- p(esps_badauth, "\t%u packet%s that failed verification received\n");
- p(esps_noxform, "\t%u packet%s for which no XFORM was set in TDB received\n");
- p(esps_qfull, "\t%u packet%s were dropped due to full output queue\n");
- p(esps_wrap, "\t%u packet%s where counter wrapping was detected\n");
- p(esps_replay, "\t%u possibly replayed packet%s received\n");
- p(esps_badilen, "\t%u packet%s with bad payload size or padding received\n");
- p(esps_invalid, "\t%u packet%s attempted to use an invalid TDB\n");
- p(esps_toobig, "\t%u packet%s got larger than max IP packet size\n");
- p(esps_crypto, "\t%u packet%s that failed crypto processing\n");
- p(esps_outfail, "\t%u output packet%s could not be sent\n");
- p(esps_udpencin, "\t%u input UDP encapsulated ESP packet%s\n");
- p(esps_udpencout, "\t%u output UDP encapsulated ESP packet%s\n");
- p(esps_udpinval, "\t%u UDP packet%s for non-encapsulating TDB received\n");
- p(esps_udpneeded, "\t%u raw ESP packet%s for encapsulating TDB received\n");
+ p(esps_input, "\t%llu input ESP packet%s\n");
+ p(esps_output, "\t%llu output ESP packet%s\n");
+ p(esps_nopf, "\t%llu packet%s from unsupported protocol families\n");
+ p(esps_hdrops, "\t%llu packet%s shorter than header shows\n");
+ p(esps_pdrops, "\t%llu packet%s dropped due to policy\n");
+ p(esps_notdb, "\t%llu packet%s for which no TDB was found\n");
+ p(esps_badkcr, "\t%llu input packet%s that failed to be processed\n");
+ p(esps_badenc, "\t%llu packet%s with bad encryption received\n");
+ p(esps_badauth, "\t%llu packet%s that failed verification received\n");
+ p(esps_noxform, "\t%llu packet%s for which no XFORM was set in TDB received\n");
+ p(esps_qfull, "\t%llu packet%s were dropped due to full output queue\n");
+ p(esps_wrap, "\t%llu packet%s where counter wrapping was detected\n");
+ p(esps_replay, "\t%llu possibly replayed packet%s received\n");
+ p(esps_badilen, "\t%llu packet%s with bad payload size or padding received\n");
+ p(esps_invalid, "\t%llu packet%s attempted to use an invalid TDB\n");
+ p(esps_toobig, "\t%llu packet%s got larger than max IP packet size\n");
+ p(esps_crypto, "\t%llu packet%s that failed crypto processing\n");
+ p(esps_outfail, "\t%llu output packet%s could not be sent\n");
+ p(esps_udpencin, "\t%llu input UDP encapsulated ESP packet%s\n");
+ p(esps_udpencout, "\t%llu output UDP encapsulated ESP packet%s\n");
+ p(esps_udpinval, "\t%llu UDP packet%s for non-encapsulating TDB received\n");
+ p(esps_udpneeded, "\t%llu raw ESP packet%s for encapsulating TDB received\n");
p(esps_ibytes, "\t%llu input byte%s\n");
p(esps_obytes, "\t%llu output byte%s\n");
@@ -1229,21 +1229,21 @@ ipcomp_stats(char *name)
#define p(f, m) if (ipcompstat.f || sflag <= 1) \
printf(m, ipcompstat.f, plural(ipcompstat.f))
- p(ipcomps_input, "\t%u input IPCOMP packet%s\n");
- p(ipcomps_output, "\t%u output IPCOMP packet%s\n");
- p(ipcomps_nopf, "\t%u packet%s from unsupported protocol families\n");
- p(ipcomps_hdrops, "\t%u packet%s shorter than header shows\n");
- p(ipcomps_pdrops, "\t%u packet%s dropped due to policy\n");
- p(ipcomps_notdb, "\t%u packet%s for which no TDB was found\n");
- p(ipcomps_badkcr, "\t%u input packet%s that failed to be processed\n");
- p(ipcomps_noxform, "\t%u packet%s for which no XFORM was set in TDB received\n");
- p(ipcomps_qfull, "\t%u packet%s were dropped due to full output queue\n");
- p(ipcomps_wrap, "\t%u packet%s where counter wrapping was detected\n");
- p(ipcomps_invalid, "\t%u packet%s attempted to use an invalid TDB\n");
- p(ipcomps_toobig, "\t%u packet%s got larger than max IP packet size\n");
- p(ipcomps_crypto, "\t%u packet%s that failed (de)compression processing\n");
- p(ipcomps_outfail, "\t%u output packet%s could not be sent\n");
- p(ipcomps_minlen, "\t%u packet%s less than minimum compression length\n");
+ p(ipcomps_input, "\t%llu input IPCOMP packet%s\n");
+ p(ipcomps_output, "\t%llu output IPCOMP packet%s\n");
+ p(ipcomps_nopf, "\t%llu packet%s from unsupported protocol families\n");
+ p(ipcomps_hdrops, "\t%llu packet%s shorter than header shows\n");
+ p(ipcomps_pdrops, "\t%llu packet%s dropped due to policy\n");
+ p(ipcomps_notdb, "\t%llu packet%s for which no TDB was found\n");
+ p(ipcomps_badkcr, "\t%llu input packet%s that failed to be processed\n");
+ p(ipcomps_noxform, "\t%llu packet%s for which no XFORM was set in TDB received\n");
+ p(ipcomps_qfull, "\t%llu packet%s were dropped due to full output queue\n");
+ p(ipcomps_wrap, "\t%llu packet%s where counter wrapping was detected\n");
+ p(ipcomps_invalid, "\t%llu packet%s attempted to use an invalid TDB\n");
+ p(ipcomps_toobig, "\t%llu packet%s got larger than max IP packet size\n");
+ p(ipcomps_crypto, "\t%llu packet%s that failed (de)compression processing\n");
+ p(ipcomps_outfail, "\t%llu output packet%s could not be sent\n");
+ p(ipcomps_minlen, "\t%llu packet%s less than minimum compression length\n");
p(ipcomps_ibytes, "\t%llu input byte%s\n");
p(ipcomps_obytes, "\t%llu output byte%s\n");