Prepare network statistics structures for migration to PCPU counters.

Use uint64_t as type for all fields of structures.

Changed structures: ahstat, arpstat, espstat, icmp6_ifstat, icmp6stat,
in6_ifstat, ip6stat, ipcompstat, ipipstat, ipsecstat, mrt6stat, mrtstat,
pfkeystat, pim6stat, pimstat, rip6stat, udpstat.

Discussed with:	arch@
This commit is contained in:
Andrey V. Elsukov 2013-07-09 09:32:06 +00:00
parent 37b8b2d4d8
commit c80211e3cf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253081
21 changed files with 460 additions and 482 deletions

View File

@ -113,18 +113,18 @@ struct arpcom {
struct arpstat {
/* Normal things that happen: */
u_long txrequests; /* # of ARP requests sent by this host. */
u_long txreplies; /* # of ARP replies sent by this host. */
u_long rxrequests; /* # of ARP requests received by this host. */
u_long rxreplies; /* # of ARP replies received by this host. */
u_long received; /* # of ARP packets received by this host. */
uint64_t txrequests; /* # of ARP requests sent by this host. */
uint64_t txreplies; /* # of ARP replies sent by this host. */
uint64_t rxrequests; /* # of ARP requests received by this host. */
uint64_t rxreplies; /* # of ARP replies received by this host. */
uint64_t received; /* # of ARP packets received by this host. */
u_long arp_spares[4]; /* For either the upper or lower half. */
uint64_t arp_spares[4]; /* For either the upper or lower half. */
/* Abnormal event and error counting: */
u_long dropped; /* # of packets dropped waiting for a reply. */
u_long timeouts; /* # of times with entries removed */
uint64_t dropped; /* # of packets dropped waiting for a reply. */
uint64_t timeouts; /* # of times with entries removed */
/* due to timeout. */
u_long dupips; /* # of duplicate IPs detected. */
uint64_t dupips; /* # of duplicate IPs detected. */
};
/*

View File

@ -555,39 +555,39 @@ do { \
* of the internet control message protocol version 6.
*/
struct icmp6errstat {
u_quad_t icp6errs_dst_unreach_noroute;
u_quad_t icp6errs_dst_unreach_admin;
u_quad_t icp6errs_dst_unreach_beyondscope;
u_quad_t icp6errs_dst_unreach_addr;
u_quad_t icp6errs_dst_unreach_noport;
u_quad_t icp6errs_packet_too_big;
u_quad_t icp6errs_time_exceed_transit;
u_quad_t icp6errs_time_exceed_reassembly;
u_quad_t icp6errs_paramprob_header;
u_quad_t icp6errs_paramprob_nextheader;
u_quad_t icp6errs_paramprob_option;
u_quad_t icp6errs_redirect; /* we regard redirect as an error here */
u_quad_t icp6errs_unknown;
uint64_t icp6errs_dst_unreach_noroute;
uint64_t icp6errs_dst_unreach_admin;
uint64_t icp6errs_dst_unreach_beyondscope;
uint64_t icp6errs_dst_unreach_addr;
uint64_t icp6errs_dst_unreach_noport;
uint64_t icp6errs_packet_too_big;
uint64_t icp6errs_time_exceed_transit;
uint64_t icp6errs_time_exceed_reassembly;
uint64_t icp6errs_paramprob_header;
uint64_t icp6errs_paramprob_nextheader;
uint64_t icp6errs_paramprob_option;
uint64_t icp6errs_redirect; /* we regard redirect as an error here */
uint64_t icp6errs_unknown;
};
struct icmp6stat {
/* statistics related to icmp6 packets generated */
u_quad_t icp6s_error; /* # of calls to icmp6_error */
u_quad_t icp6s_canterror; /* no error 'cuz old was icmp */
u_quad_t icp6s_toofreq; /* no error 'cuz rate limitation */
u_quad_t icp6s_outhist[256];
uint64_t icp6s_error; /* # of calls to icmp6_error */
uint64_t icp6s_canterror; /* no error 'cuz old was icmp */
uint64_t icp6s_toofreq; /* no error 'cuz rate limitation */
uint64_t icp6s_outhist[256];
/* statistics related to input message processed */
u_quad_t icp6s_badcode; /* icmp6_code out of range */
u_quad_t icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */
u_quad_t icp6s_checksum; /* bad checksum */
u_quad_t icp6s_badlen; /* calculated bound mismatch */
uint64_t icp6s_badcode; /* icmp6_code out of range */
uint64_t icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */
uint64_t icp6s_checksum; /* bad checksum */
uint64_t icp6s_badlen; /* calculated bound mismatch */
/*
* number of responses: this member is inherited from netinet code, but
* for netinet6 code, it is already available in icp6s_outhist[].
*/
u_quad_t icp6s_reflect;
u_quad_t icp6s_inhist[256];
u_quad_t icp6s_nd_toomanyopt; /* too many ND options */
uint64_t icp6s_reflect;
uint64_t icp6s_inhist[256];
uint64_t icp6s_nd_toomanyopt; /* too many ND options */
struct icmp6errstat icp6s_outerrhist;
#define icp6s_odst_unreach_noroute \
icp6s_outerrhist.icp6errs_dst_unreach_noroute
@ -607,13 +607,13 @@ struct icmp6stat {
#define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option
#define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect
#define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown
u_quad_t icp6s_pmtuchg; /* path MTU changes */
u_quad_t icp6s_nd_badopt; /* bad ND options */
u_quad_t icp6s_badns; /* bad neighbor solicitation */
u_quad_t icp6s_badna; /* bad neighbor advertisement */
u_quad_t icp6s_badrs; /* bad router advertisement */
u_quad_t icp6s_badra; /* bad router advertisement */
u_quad_t icp6s_badredirect; /* bad redirect message */
uint64_t icp6s_pmtuchg; /* path MTU changes */
uint64_t icp6s_nd_badopt; /* bad ND options */
uint64_t icp6s_badns; /* bad neighbor solicitation */
uint64_t icp6s_badna; /* bad neighbor advertisement */
uint64_t icp6s_badrs; /* bad router advertisement */
uint64_t icp6s_badra; /* bad router advertisement */
uint64_t icp6s_badredirect; /* bad redirect message */
};
#ifdef _KERNEL

View File

@ -206,19 +206,19 @@ struct bw_upcall {
* The kernel's multicast routing statistics.
*/
struct mrtstat {
u_long mrts_mfc_lookups; /* # forw. cache hash table hits */
u_long mrts_mfc_misses; /* # forw. cache hash table misses */
u_long mrts_upcalls; /* # calls to multicast routing daemon */
u_long mrts_no_route; /* no route for packet's origin */
u_long mrts_bad_tunnel; /* malformed tunnel options */
u_long mrts_cant_tunnel; /* no room for tunnel options */
u_long mrts_wrong_if; /* arrived on wrong interface */
u_long mrts_upq_ovflw; /* upcall Q overflow */
u_long mrts_cache_cleanups; /* # entries with no upcalls */
u_long mrts_drop_sel; /* pkts dropped selectively */
u_long mrts_q_overflow; /* pkts dropped - Q overflow */
u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */
u_long mrts_upq_sockfull; /* upcalls dropped - socket full */
uint64_t mrts_mfc_lookups; /* # forw. cache hash table hits */
uint64_t mrts_mfc_misses; /* # forw. cache hash table misses */
uint64_t mrts_upcalls; /* # calls to multicast routing daemon */
uint64_t mrts_no_route; /* no route for packet's origin */
uint64_t mrts_bad_tunnel; /* malformed tunnel options */
uint64_t mrts_cant_tunnel; /* no room for tunnel options */
uint64_t mrts_wrong_if; /* arrived on wrong interface */
uint64_t mrts_upq_ovflw; /* upcall Q overflow */
uint64_t mrts_cache_cleanups; /* # entries with no upcalls */
uint64_t mrts_drop_sel; /* pkts dropped selectively */
uint64_t mrts_q_overflow; /* pkts dropped - Q overflow */
uint64_t mrts_pkt2large; /* pkts dropped - size > BKT SIZE */
uint64_t mrts_upq_sockfull; /* upcalls dropped - socket full */
};
#ifdef _KERNEL

View File

@ -46,17 +46,17 @@
* PIM statistics kept in the kernel
*/
struct pimstat {
u_quad_t pims_rcv_total_msgs; /* total PIM messages received */
u_quad_t pims_rcv_total_bytes; /* total PIM bytes received */
u_quad_t pims_rcv_tooshort; /* rcvd with too few bytes */
u_quad_t pims_rcv_badsum; /* rcvd with bad checksum */
u_quad_t pims_rcv_badversion; /* rcvd bad PIM version */
u_quad_t pims_rcv_registers_msgs; /* rcvd regs. msgs (data only) */
u_quad_t pims_rcv_registers_bytes; /* rcvd regs. bytes (data only) */
u_quad_t pims_rcv_registers_wrongiif; /* rcvd regs. on wrong iif */
u_quad_t pims_rcv_badregisters; /* rcvd invalid registers */
u_quad_t pims_snd_registers_msgs; /* sent regs. msgs (data only) */
u_quad_t pims_snd_registers_bytes; /* sent regs. bytes (data only) */
uint64_t pims_rcv_total_msgs; /* total PIM messages received */
uint64_t pims_rcv_total_bytes; /* total PIM bytes received */
uint64_t pims_rcv_tooshort; /* rcvd with too few bytes */
uint64_t pims_rcv_badsum; /* rcvd with bad checksum */
uint64_t pims_rcv_badversion; /* rcvd bad PIM version */
uint64_t pims_rcv_registers_msgs; /* rcvd regs. msgs (data only) */
uint64_t pims_rcv_registers_bytes; /* rcvd regs. bytes (data only) */
uint64_t pims_rcv_registers_wrongiif; /* rcvd regs. on wrong iif */
uint64_t pims_rcv_badregisters; /* rcvd invalid registers */
uint64_t pims_snd_registers_msgs; /* sent regs. msgs (data only) */
uint64_t pims_snd_registers_bytes; /* sent regs. bytes (data only) */
};
#ifdef _KERNEL

View File

@ -75,22 +75,22 @@ struct udpcb {
struct udpstat {
/* input statistics: */
u_long udps_ipackets; /* total input packets */
u_long udps_hdrops; /* packet shorter than header */
u_long udps_badsum; /* checksum error */
u_long udps_nosum; /* no checksum */
u_long udps_badlen; /* data length larger than packet */
u_long udps_noport; /* no socket on port */
u_long udps_noportbcast; /* of above, arrived as broadcast */
u_long udps_fullsock; /* not delivered, input socket full */
u_long udpps_pcbcachemiss; /* input packets missing pcb cache */
u_long udpps_pcbhashmiss; /* input packets not for hashed pcb */
uint64_t udps_ipackets; /* total input packets */
uint64_t udps_hdrops; /* packet shorter than header */
uint64_t udps_badsum; /* checksum error */
uint64_t udps_nosum; /* no checksum */
uint64_t udps_badlen; /* data length larger than packet */
uint64_t udps_noport; /* no socket on port */
uint64_t udps_noportbcast; /* of above, arrived as broadcast */
uint64_t udps_fullsock; /* not delivered, input socket full */
uint64_t udpps_pcbcachemiss; /* input packets missing pcb cache */
uint64_t udpps_pcbhashmiss; /* input packets not for hashed pcb */
/* output statistics: */
u_long udps_opackets; /* total output packets */
u_long udps_fastout; /* output packets on fast path */
uint64_t udps_opackets; /* total output packets */
uint64_t udps_fastout; /* output packets on fast path */
/* of no socket on port, arrived as multicast */
u_long udps_noportmcast;
u_long udps_filtermcast; /* blocked by multicast filter */
uint64_t udps_noportmcast;
uint64_t udps_filtermcast; /* blocked by multicast filter */
};
#ifdef _KERNEL

View File

@ -153,37 +153,37 @@ struct in6_addrpolicy {
* IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12).
*/
struct in6_ifstat {
u_quad_t ifs6_in_receive; /* # of total input datagram */
u_quad_t ifs6_in_hdrerr; /* # of datagrams with invalid hdr */
u_quad_t ifs6_in_toobig; /* # of datagrams exceeded MTU */
u_quad_t ifs6_in_noroute; /* # of datagrams with no route */
u_quad_t ifs6_in_addrerr; /* # of datagrams with invalid dst */
u_quad_t ifs6_in_protounknown; /* # of datagrams with unknown proto */
uint64_t ifs6_in_receive; /* # of total input datagram */
uint64_t ifs6_in_hdrerr; /* # of datagrams with invalid hdr */
uint64_t ifs6_in_toobig; /* # of datagrams exceeded MTU */
uint64_t ifs6_in_noroute; /* # of datagrams with no route */
uint64_t ifs6_in_addrerr; /* # of datagrams with invalid dst */
uint64_t ifs6_in_protounknown; /* # of datagrams with unknown proto */
/* NOTE: increment on final dst if */
u_quad_t ifs6_in_truncated; /* # of truncated datagrams */
u_quad_t ifs6_in_discard; /* # of discarded datagrams */
uint64_t ifs6_in_truncated; /* # of truncated datagrams */
uint64_t ifs6_in_discard; /* # of discarded datagrams */
/* NOTE: fragment timeout is not here */
u_quad_t ifs6_in_deliver; /* # of datagrams delivered to ULP */
uint64_t ifs6_in_deliver; /* # of datagrams delivered to ULP */
/* NOTE: increment on final dst if */
u_quad_t ifs6_out_forward; /* # of datagrams forwarded */
uint64_t ifs6_out_forward; /* # of datagrams forwarded */
/* NOTE: increment on outgoing if */
u_quad_t ifs6_out_request; /* # of outgoing datagrams from ULP */
uint64_t ifs6_out_request; /* # of outgoing datagrams from ULP */
/* NOTE: does not include forwrads */
u_quad_t ifs6_out_discard; /* # of discarded datagrams */
u_quad_t ifs6_out_fragok; /* # of datagrams fragmented */
u_quad_t ifs6_out_fragfail; /* # of datagrams failed on fragment */
u_quad_t ifs6_out_fragcreat; /* # of fragment datagrams */
uint64_t ifs6_out_discard; /* # of discarded datagrams */
uint64_t ifs6_out_fragok; /* # of datagrams fragmented */
uint64_t ifs6_out_fragfail; /* # of datagrams failed on fragment */
uint64_t ifs6_out_fragcreat; /* # of fragment datagrams */
/* NOTE: this is # after fragment */
u_quad_t ifs6_reass_reqd; /* # of incoming fragmented packets */
uint64_t ifs6_reass_reqd; /* # of incoming fragmented packets */
/* NOTE: increment on final dst if */
u_quad_t ifs6_reass_ok; /* # of reassembled packets */
uint64_t ifs6_reass_ok; /* # of reassembled packets */
/* NOTE: this is # after reass */
/* NOTE: increment on final dst if */
u_quad_t ifs6_reass_fail; /* # of reass failures */
uint64_t ifs6_reass_fail; /* # of reass failures */
/* NOTE: may not be packet count */
/* NOTE: increment on final dst if */
u_quad_t ifs6_in_mcast; /* # of inbound multicast datagrams */
u_quad_t ifs6_out_mcast; /* # of outbound multicast datagrams */
uint64_t ifs6_in_mcast; /* # of inbound multicast datagrams */
uint64_t ifs6_out_mcast; /* # of outbound multicast datagrams */
};
/*
@ -195,77 +195,77 @@ struct icmp6_ifstat {
* Input statistics
*/
/* ipv6IfIcmpInMsgs, total # of input messages */
u_quad_t ifs6_in_msg;
uint64_t ifs6_in_msg;
/* ipv6IfIcmpInErrors, # of input error messages */
u_quad_t ifs6_in_error;
uint64_t ifs6_in_error;
/* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */
u_quad_t ifs6_in_dstunreach;
uint64_t ifs6_in_dstunreach;
/* ipv6IfIcmpInAdminProhibs, # of input administratively prohibited errs */
u_quad_t ifs6_in_adminprohib;
uint64_t ifs6_in_adminprohib;
/* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */
u_quad_t ifs6_in_timeexceed;
uint64_t ifs6_in_timeexceed;
/* ipv6IfIcmpInParmProblems, # of input parameter problem errors */
u_quad_t ifs6_in_paramprob;
uint64_t ifs6_in_paramprob;
/* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */
u_quad_t ifs6_in_pkttoobig;
uint64_t ifs6_in_pkttoobig;
/* ipv6IfIcmpInEchos, # of input echo requests */
u_quad_t ifs6_in_echo;
uint64_t ifs6_in_echo;
/* ipv6IfIcmpInEchoReplies, # of input echo replies */
u_quad_t ifs6_in_echoreply;
uint64_t ifs6_in_echoreply;
/* ipv6IfIcmpInRouterSolicits, # of input router solicitations */
u_quad_t ifs6_in_routersolicit;
uint64_t ifs6_in_routersolicit;
/* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */
u_quad_t ifs6_in_routeradvert;
uint64_t ifs6_in_routeradvert;
/* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */
u_quad_t ifs6_in_neighborsolicit;
uint64_t ifs6_in_neighborsolicit;
/* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advertisements */
u_quad_t ifs6_in_neighboradvert;
uint64_t ifs6_in_neighboradvert;
/* ipv6IfIcmpInRedirects, # of input redirects */
u_quad_t ifs6_in_redirect;
uint64_t ifs6_in_redirect;
/* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */
u_quad_t ifs6_in_mldquery;
uint64_t ifs6_in_mldquery;
/* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */
u_quad_t ifs6_in_mldreport;
uint64_t ifs6_in_mldreport;
/* ipv6IfIcmpInGroupMembReductions, # of input MLD done */
u_quad_t ifs6_in_mlddone;
uint64_t ifs6_in_mlddone;
/*
* Output statistics. We should solve unresolved routing problem...
*/
/* ipv6IfIcmpOutMsgs, total # of output messages */
u_quad_t ifs6_out_msg;
uint64_t ifs6_out_msg;
/* ipv6IfIcmpOutErrors, # of output error messages */
u_quad_t ifs6_out_error;
uint64_t ifs6_out_error;
/* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */
u_quad_t ifs6_out_dstunreach;
uint64_t ifs6_out_dstunreach;
/* ipv6IfIcmpOutAdminProhibs, # of output administratively prohibited errs */
u_quad_t ifs6_out_adminprohib;
uint64_t ifs6_out_adminprohib;
/* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */
u_quad_t ifs6_out_timeexceed;
uint64_t ifs6_out_timeexceed;
/* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */
u_quad_t ifs6_out_paramprob;
uint64_t ifs6_out_paramprob;
/* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */
u_quad_t ifs6_out_pkttoobig;
uint64_t ifs6_out_pkttoobig;
/* ipv6IfIcmpOutEchos, # of output echo requests */
u_quad_t ifs6_out_echo;
uint64_t ifs6_out_echo;
/* ipv6IfIcmpOutEchoReplies, # of output echo replies */
u_quad_t ifs6_out_echoreply;
uint64_t ifs6_out_echoreply;
/* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */
u_quad_t ifs6_out_routersolicit;
uint64_t ifs6_out_routersolicit;
/* ipv6IfIcmpOutRouterAdvertisements, # of output router advertisements */
u_quad_t ifs6_out_routeradvert;
uint64_t ifs6_out_routeradvert;
/* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */
u_quad_t ifs6_out_neighborsolicit;
uint64_t ifs6_out_neighborsolicit;
/* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advertisements */
u_quad_t ifs6_out_neighboradvert;
uint64_t ifs6_out_neighboradvert;
/* ipv6IfIcmpOutRedirects, # of output redirects */
u_quad_t ifs6_out_redirect;
uint64_t ifs6_out_redirect;
/* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */
u_quad_t ifs6_out_mldquery;
uint64_t ifs6_out_mldquery;
/* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */
u_quad_t ifs6_out_mldreport;
uint64_t ifs6_out_mldreport;
/* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */
u_quad_t ifs6_out_mlddone;
uint64_t ifs6_out_mlddone;
};
struct in6_ifreq {

View File

@ -121,19 +121,19 @@ struct mf6cctl {
* The kernel's multicast routing statistics.
*/
struct mrt6stat {
u_quad_t mrt6s_mfc_lookups; /* # forw. cache hash table hits */
u_quad_t mrt6s_mfc_misses; /* # forw. cache hash table misses */
u_quad_t mrt6s_upcalls; /* # calls to multicast routing daemon */
u_quad_t mrt6s_no_route; /* no route for packet's origin */
u_quad_t mrt6s_bad_tunnel; /* malformed tunnel options */
u_quad_t mrt6s_cant_tunnel; /* no room for tunnel options */
u_quad_t mrt6s_wrong_if; /* arrived on wrong interface */
u_quad_t mrt6s_upq_ovflw; /* upcall Q overflow */
u_quad_t mrt6s_cache_cleanups; /* # entries with no upcalls */
u_quad_t mrt6s_drop_sel; /* pkts dropped selectively */
u_quad_t mrt6s_q_overflow; /* pkts dropped - Q overflow */
u_quad_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */
u_quad_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */
uint64_t mrt6s_mfc_lookups; /* # forw. cache hash table hits */
uint64_t mrt6s_mfc_misses; /* # forw. cache hash table misses */
uint64_t mrt6s_upcalls; /* # calls to multicast routing daemon */
uint64_t mrt6s_no_route; /* no route for packet's origin */
uint64_t mrt6s_bad_tunnel; /* malformed tunnel options */
uint64_t mrt6s_cant_tunnel; /* no room for tunnel options */
uint64_t mrt6s_wrong_if; /* arrived on wrong interface */
uint64_t mrt6s_upq_ovflw; /* upcall Q overflow */
uint64_t mrt6s_cache_cleanups; /* # entries with no upcalls */
uint64_t mrt6s_drop_sel; /* pkts dropped selectively */
uint64_t mrt6s_q_overflow; /* pkts dropped - Q overflow */
uint64_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */
uint64_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */
};
#ifdef MRT6_OINIT

View File

@ -181,39 +181,39 @@ struct ip6_pktopts {
*/
struct ip6stat {
u_quad_t ip6s_total; /* total packets received */
u_quad_t ip6s_tooshort; /* packet too short */
u_quad_t ip6s_toosmall; /* not enough data */
u_quad_t ip6s_fragments; /* fragments received */
u_quad_t ip6s_fragdropped; /* frags dropped(dups, out of space) */
u_quad_t ip6s_fragtimeout; /* fragments timed out */
u_quad_t ip6s_fragoverflow; /* fragments that exceeded limit */
u_quad_t ip6s_forward; /* packets forwarded */
u_quad_t ip6s_cantforward; /* packets rcvd for unreachable dest */
u_quad_t ip6s_redirectsent; /* packets forwarded on same net */
u_quad_t ip6s_delivered; /* datagrams delivered to upper level*/
u_quad_t ip6s_localout; /* total ip packets generated here */
u_quad_t ip6s_odropped; /* lost packets due to nobufs, etc. */
u_quad_t ip6s_reassembled; /* total packets reassembled ok */
u_quad_t ip6s_fragmented; /* datagrams successfully fragmented */
u_quad_t ip6s_ofragments; /* output fragments created */
u_quad_t ip6s_cantfrag; /* don't fragment flag was set, etc. */
u_quad_t ip6s_badoptions; /* error in option processing */
u_quad_t ip6s_noroute; /* packets discarded due to no route */
u_quad_t ip6s_badvers; /* ip6 version != 6 */
u_quad_t ip6s_rawout; /* total raw ip packets generated */
u_quad_t ip6s_badscope; /* scope error */
u_quad_t ip6s_notmember; /* don't join this multicast group */
uint64_t ip6s_total; /* total packets received */
uint64_t ip6s_tooshort; /* packet too short */
uint64_t ip6s_toosmall; /* not enough data */
uint64_t ip6s_fragments; /* fragments received */
uint64_t ip6s_fragdropped; /* frags dropped(dups, out of space) */
uint64_t ip6s_fragtimeout; /* fragments timed out */
uint64_t ip6s_fragoverflow; /* fragments that exceeded limit */
uint64_t ip6s_forward; /* packets forwarded */
uint64_t ip6s_cantforward; /* packets rcvd for unreachable dest */
uint64_t ip6s_redirectsent; /* packets forwarded on same net */
uint64_t ip6s_delivered; /* datagrams delivered to upper level*/
uint64_t ip6s_localout; /* total ip packets generated here */
uint64_t ip6s_odropped; /* lost packets due to nobufs, etc. */
uint64_t ip6s_reassembled; /* total packets reassembled ok */
uint64_t ip6s_fragmented; /* datagrams successfully fragmented */
uint64_t ip6s_ofragments; /* output fragments created */
uint64_t ip6s_cantfrag; /* don't fragment flag was set, etc. */
uint64_t ip6s_badoptions; /* error in option processing */
uint64_t ip6s_noroute; /* packets discarded due to no route */
uint64_t ip6s_badvers; /* ip6 version != 6 */
uint64_t ip6s_rawout; /* total raw ip packets generated */
uint64_t ip6s_badscope; /* scope error */
uint64_t ip6s_notmember; /* don't join this multicast group */
#define IP6S_HDRCNT 256 /* headers count */
u_quad_t ip6s_nxthist[IP6S_HDRCNT]; /* next header history */
u_quad_t ip6s_m1; /* one mbuf */
uint64_t ip6s_nxthist[IP6S_HDRCNT]; /* next header history */
uint64_t ip6s_m1; /* one mbuf */
#define IP6S_M2MMAX 32
u_quad_t ip6s_m2m[IP6S_M2MMAX]; /* two or more mbuf */
u_quad_t ip6s_mext1; /* one ext mbuf */
u_quad_t ip6s_mext2m; /* two or more ext mbuf */
u_quad_t ip6s_exthdrtoolong; /* ext hdr are not contiguous */
u_quad_t ip6s_nogif; /* no match gif found */
u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */
uint64_t ip6s_m2m[IP6S_M2MMAX]; /* two or more mbuf */
uint64_t ip6s_mext1; /* one ext mbuf */
uint64_t ip6s_mext2m; /* two or more ext mbuf */
uint64_t ip6s_exthdrtoolong; /* ext hdr are not contiguous */
uint64_t ip6s_nogif; /* no match gif found */
uint64_t ip6s_toomanyhdr; /* discarded due to too many headers */
/*
* statistics for improvement of the source address selection
@ -223,26 +223,26 @@ struct ip6stat {
#define IP6S_RULESMAX 16
#define IP6S_SCOPECNT 16
/* number of times that address selection fails */
u_quad_t ip6s_sources_none;
uint64_t ip6s_sources_none;
/* number of times that an address on the outgoing I/F is chosen */
u_quad_t ip6s_sources_sameif[IP6S_SCOPECNT];
uint64_t ip6s_sources_sameif[IP6S_SCOPECNT];
/* number of times that an address on a non-outgoing I/F is chosen */
u_quad_t ip6s_sources_otherif[IP6S_SCOPECNT];
uint64_t ip6s_sources_otherif[IP6S_SCOPECNT];
/*
* number of times that an address that has the same scope
* from the destination is chosen.
*/
u_quad_t ip6s_sources_samescope[IP6S_SCOPECNT];
uint64_t ip6s_sources_samescope[IP6S_SCOPECNT];
/*
* number of times that an address that has a different scope
* from the destination is chosen.
*/
u_quad_t ip6s_sources_otherscope[IP6S_SCOPECNT];
uint64_t ip6s_sources_otherscope[IP6S_SCOPECNT];
/* number of times that a deprecated address is chosen */
u_quad_t ip6s_sources_deprecated[IP6S_SCOPECNT];
uint64_t ip6s_sources_deprecated[IP6S_SCOPECNT];
/* number of times that each rule of source selection is applied. */
u_quad_t ip6s_sources_rule[IP6S_RULESMAX];
uint64_t ip6s_sources_rule[IP6S_RULESMAX];
};
#ifdef _KERNEL

View File

@ -42,13 +42,13 @@
#define _NETINET6_PIM6_VAR_H_
struct pim6stat {
u_quad_t pim6s_rcv_total; /* total PIM messages received */
u_quad_t pim6s_rcv_tooshort; /* received with too few bytes */
u_quad_t pim6s_rcv_badsum; /* received with bad checksum */
u_quad_t pim6s_rcv_badversion; /* received bad PIM version */
u_quad_t pim6s_rcv_registers; /* received registers */
u_quad_t pim6s_rcv_badregisters; /* received invalid registers */
u_quad_t pim6s_snd_registers; /* sent registers */
uint64_t pim6s_rcv_total; /* total PIM messages received */
uint64_t pim6s_rcv_tooshort; /* received with too few bytes */
uint64_t pim6s_rcv_badsum; /* received with bad checksum */
uint64_t pim6s_rcv_badversion; /* received bad PIM version */
uint64_t pim6s_rcv_registers; /* received registers */
uint64_t pim6s_rcv_badregisters; /* received invalid registers */
uint64_t pim6s_snd_registers; /* sent registers */
};
#if (defined(KERNEL)) || (defined(_KERNEL))

View File

@ -37,14 +37,14 @@
* ICMPv6 stat is counted separately. see netinet/icmp6.h
*/
struct rip6stat {
u_quad_t rip6s_ipackets; /* total input packets */
u_quad_t rip6s_isum; /* input checksum computations */
u_quad_t rip6s_badsum; /* of above, checksum error */
u_quad_t rip6s_nosock; /* no matching socket */
u_quad_t rip6s_nosockmcast; /* of above, arrived as multicast */
u_quad_t rip6s_fullsock; /* not delivered, input socket full */
uint64_t rip6s_ipackets; /* total input packets */
uint64_t rip6s_isum; /* input checksum computations */
uint64_t rip6s_badsum; /* of above, checksum error */
uint64_t rip6s_nosock; /* no matching socket */
uint64_t rip6s_nosockmcast; /* of above, arrived as multicast */
uint64_t rip6s_fullsock; /* not delivered, input socket full */
u_quad_t rip6s_opackets; /* total output packets */
uint64_t rip6s_opackets; /* total output packets */
};
#ifdef _KERNEL

View File

@ -48,26 +48,26 @@
#define AH_ALG_MAX 16
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_tunnel; /* Tunnel sanity check failure */
u_int32_t ahs_hist[AH_ALG_MAX]; /* Per-algorithm op count */
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_tunnel; /* Tunnel sanity check failure */
uint64_t ahs_hist[AH_ALG_MAX]; /* Per-algorithm op count */
};
#ifdef _KERNEL

View File

@ -48,27 +48,27 @@
#define ESP_ALG_MAX 256 /* NB: could be < but skipjack is 249 */
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_tunnel; /* Tunnel sanity check failure */
u_int32_t esps_hist[ESP_ALG_MAX]; /* Per-algorithm op count */
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_tunnel; /* Tunnel sanity check failure */
uint64_t esps_hist[ESP_ALG_MAX]; /* Per-algorithm op count */
};
#ifdef _KERNEL

View File

@ -41,27 +41,26 @@
*/
#define IPCOMP_ALG_MAX 8
#define IPCOMPSTAT_VERSION 1
#define IPCOMPSTAT_VERSION 2
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 TDB */
u_int64_t ipcomps_ibytes; /* Input bytes */
u_int64_t ipcomps_obytes; /* Output bytes */
u_int32_t ipcomps_toobig; /* Packet got > IP_MAXPACKET */
u_int32_t ipcomps_pdrops; /* Packet blocked due to policy */
u_int32_t ipcomps_crypto; /* "Crypto" processing failure */
u_int32_t ipcomps_hist[IPCOMP_ALG_MAX];/* Per-algorithm op count */
u_int32_t version; /* Version of this structure. */
u_int32_t ipcomps_threshold; /* Packet < comp. algo. threshold. */
u_int32_t ipcomps_uncompr; /* Compression was useles. */
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 */
uint64_t ipcomps_ibytes; /* Input bytes */
uint64_t ipcomps_obytes; /* Output bytes */
uint64_t ipcomps_toobig; /* Packet got > IP_MAXPACKET */
uint64_t ipcomps_pdrops; /* Packet blocked due to policy */
uint64_t ipcomps_crypto; /* "Crypto" processing failure */
uint64_t ipcomps_hist[IPCOMP_ALG_MAX];/* Per-algorithm op count */
uint64_t ipcomps_threshold; /* Packet < comp. algo. threshold. */
uint64_t ipcomps_uncompr; /* Compression was useles. */
};
#ifdef _KERNEL

View File

@ -44,18 +44,17 @@
* Not quite all the functionality of RFC-1853, but the main idea is there.
*/
struct ipipstat
{
u_int32_t ipips_ipackets; /* total input packets */
u_int32_t ipips_opackets; /* total output packets */
u_int32_t ipips_hdrops; /* packet shorter than header shows */
u_int32_t ipips_qfull;
u_int64_t ipips_ibytes;
u_int64_t ipips_obytes;
u_int32_t ipips_pdrops; /* packet dropped due to policy */
u_int32_t ipips_spoof; /* IP spoofing attempts */
u_int32_t ipips_family; /* Protocol family mismatch */
u_int32_t ipips_unspec; /* Missing tunnel endpoint address */
struct ipipstat {
uint64_t ipips_ipackets; /* total input packets */
uint64_t ipips_opackets; /* total output packets */
uint64_t ipips_hdrops; /* packet shorter than header shows */
uint64_t ipips_qfull;
uint64_t ipips_ibytes;
uint64_t ipips_obytes;
uint64_t ipips_pdrops; /* packet dropped due to policy */
uint64_t ipips_spoof; /* IP spoofing attempts */
uint64_t ipips_family; /* Protocol family mismatch */
uint64_t ipips_unspec; /* Missing tunnel endpoint address */
};
#ifdef _KERNEL

View File

@ -217,54 +217,54 @@ struct secspacq {
/* statistics for ipsec processing */
struct ipsecstat {
u_quad_t in_success; /* succeeded inbound process */
u_quad_t in_polvio;
uint64_t in_success; /* succeeded inbound process */
uint64_t in_polvio;
/* security policy violation for inbound process */
u_quad_t in_nosa; /* inbound SA is unavailable */
u_quad_t in_inval; /* inbound processing failed due to EINVAL */
u_quad_t in_nomem; /* inbound processing failed due to ENOBUFS */
u_quad_t in_badspi; /* failed getting a SPI */
u_quad_t in_ahreplay; /* AH replay check failed */
u_quad_t in_espreplay; /* ESP replay check failed */
u_quad_t in_ahauthsucc; /* AH authentication success */
u_quad_t in_ahauthfail; /* AH authentication failure */
u_quad_t in_espauthsucc; /* ESP authentication success */
u_quad_t in_espauthfail; /* ESP authentication failure */
u_quad_t in_esphist[256];
u_quad_t in_ahhist[256];
u_quad_t in_comphist[256];
u_quad_t out_success; /* succeeded outbound process */
u_quad_t out_polvio;
uint64_t in_nosa; /* inbound SA is unavailable */
uint64_t in_inval; /* inbound processing failed due to EINVAL */
uint64_t in_nomem; /* inbound processing failed due to ENOBUFS */
uint64_t in_badspi; /* failed getting a SPI */
uint64_t in_ahreplay; /* AH replay check failed */
uint64_t in_espreplay; /* ESP replay check failed */
uint64_t in_ahauthsucc; /* AH authentication success */
uint64_t in_ahauthfail; /* AH authentication failure */
uint64_t in_espauthsucc; /* ESP authentication success */
uint64_t in_espauthfail; /* ESP authentication failure */
uint64_t in_esphist[256];
uint64_t in_ahhist[256];
uint64_t in_comphist[256];
uint64_t out_success; /* succeeded outbound process */
uint64_t out_polvio;
/* security policy violation for outbound process */
u_quad_t out_nosa; /* outbound SA is unavailable */
u_quad_t out_inval; /* outbound process failed due to EINVAL */
u_quad_t out_nomem; /* inbound processing failed due to ENOBUFS */
u_quad_t out_noroute; /* there is no route */
u_quad_t out_esphist[256];
u_quad_t out_ahhist[256];
u_quad_t out_comphist[256];
uint64_t out_nosa; /* outbound SA is unavailable */
uint64_t out_inval; /* outbound process failed due to EINVAL */
uint64_t out_nomem; /* inbound processing failed due to ENOBUFS */
uint64_t out_noroute; /* there is no route */
uint64_t out_esphist[256];
uint64_t out_ahhist[256];
uint64_t out_comphist[256];
u_quad_t spdcachelookup;
u_quad_t spdcachemiss;
uint64_t spdcachelookup;
uint64_t spdcachemiss;
u_int32_t ips_in_polvio; /* input: sec policy violation */
u_int32_t ips_out_polvio; /* output: sec policy violation */
u_int32_t ips_out_nosa; /* output: SA unavailable */
u_int32_t ips_out_nomem; /* output: no memory available */
u_int32_t ips_out_noroute; /* output: no route available */
u_int32_t ips_out_inval; /* output: generic error */
u_int32_t ips_out_bundlesa; /* output: bundled SA processed */
u_int32_t ips_mbcoalesced; /* mbufs coalesced during clone */
u_int32_t ips_clcoalesced; /* clusters coalesced during clone */
u_int32_t ips_clcopied; /* clusters copied during clone */
u_int32_t ips_mbinserted; /* mbufs inserted during makespace */
uint64_t ips_in_polvio; /* input: sec policy violation */
uint64_t ips_out_polvio; /* output: sec policy violation */
uint64_t ips_out_nosa; /* output: SA unavailable */
uint64_t ips_out_nomem; /* output: no memory available */
uint64_t ips_out_noroute; /* output: no route available */
uint64_t ips_out_inval; /* output: generic error */
uint64_t ips_out_bundlesa; /* output: bundled SA processed */
uint64_t ips_mbcoalesced; /* mbufs coalesced during clone */
uint64_t ips_clcoalesced; /* clusters coalesced during clone */
uint64_t ips_clcopied; /* clusters copied during clone */
uint64_t ips_mbinserted; /* mbufs inserted during makespace */
/*
* Temporary statistics for performance analysis.
*/
/* See where ESP/AH/IPCOMP header land in mbuf on input */
u_int32_t ips_input_front;
u_int32_t ips_input_middle;
u_int32_t ips_input_end;
uint64_t ips_input_front;
uint64_t ips_input_middle;
uint64_t ips_input_end;
};
/*

View File

@ -36,26 +36,26 @@
/* statistics for pfkey socket */
struct pfkeystat {
/* kernel -> userland */
u_quad_t out_total; /* # of total calls */
u_quad_t out_bytes; /* total bytecount */
u_quad_t out_msgtype[256]; /* message type histogram */
u_quad_t out_invlen; /* invalid length field */
u_quad_t out_invver; /* invalid version field */
u_quad_t out_invmsgtype; /* invalid message type field */
u_quad_t out_tooshort; /* msg too short */
u_quad_t out_nomem; /* memory allocation failure */
u_quad_t out_dupext; /* duplicate extension */
u_quad_t out_invexttype; /* invalid extension type */
u_quad_t out_invsatype; /* invalid sa type */
u_quad_t out_invaddr; /* invalid address extension */
uint64_t out_total; /* # of total calls */
uint64_t out_bytes; /* total bytecount */
uint64_t out_msgtype[256]; /* message type histogram */
uint64_t out_invlen; /* invalid length field */
uint64_t out_invver; /* invalid version field */
uint64_t out_invmsgtype; /* invalid message type field */
uint64_t out_tooshort; /* msg too short */
uint64_t out_nomem; /* memory allocation failure */
uint64_t out_dupext; /* duplicate extension */
uint64_t out_invexttype; /* invalid extension type */
uint64_t out_invsatype; /* invalid sa type */
uint64_t out_invaddr; /* invalid address extension */
/* userland -> kernel */
u_quad_t in_total; /* # of total calls */
u_quad_t in_bytes; /* total bytecount */
u_quad_t in_msgtype[256]; /* message type histogram */
u_quad_t in_msgtarget[3]; /* one/all/registered */
u_quad_t in_nomem; /* memory allocation failure */
uint64_t in_total; /* # of total calls */
uint64_t in_bytes; /* total bytecount */
uint64_t in_msgtype[256]; /* message type histogram */
uint64_t in_msgtarget[3]; /* one/all/registered */
uint64_t in_nomem; /* memory allocation failure */
/* others */
u_quad_t sockerr; /* # of socket related errors */
uint64_t sockerr; /* # of socket related errors */
};
#define KEY_SENDUP_ONE 0

View File

@ -636,8 +636,6 @@ static void
vnet_ipcomp_attach(const void *unused __unused)
{
/* XXX */
V_ipcompstat.version = IPCOMPSTAT_VERSION;
}
VNET_SYSINIT(vnet_ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE,

View File

@ -82,7 +82,7 @@ algname(int a, const struct alg algs[], int nalgs)
int
main(int argc, char *argv[])
{
#define STAT(x,fmt) if (x) printf(fmt "\n", x)
#define STAT(x,fmt) if (x) printf(fmt "\n", (uintmax_t)x)
struct ipsecstat ips;
struct ahstat ahs;
struct espstat esps;
@ -99,8 +99,7 @@ main(int argc, char *argv[])
if (sysctlbyname("net.inet.esp.stats", &esps, &slen, NULL, NULL) < 0)
err(1, "net.inet.esp.stats");
#define AHSTAT(x,fmt) if (x) printf("ah " fmt ": %u\n", x)
#define AHSTAT64(x,fmt) if (x) printf("ah " fmt ": %llu\n", x)
#define AHSTAT(x,fmt) if (x) printf("ah " fmt ": %ju\n", (uintmax_t)x)
AHSTAT(ahs.ahs_input, "input packets processed");
AHSTAT(ahs.ahs_output, "output packets processed");
AHSTAT(ahs.ahs_hdrops, "headers too short");
@ -120,17 +119,15 @@ main(int argc, char *argv[])
AHSTAT(ahs.ahs_tunnel, "tunnel sanity check failures");
for (i = 0; i < AH_ALG_MAX; i++)
if (ahs.ahs_hist[i])
printf("ah packets with %s: %u\n"
printf("ah packets with %s: %ju\n"
, algname(i, aalgs, N(aalgs))
, ahs.ahs_hist[i]
, (uintmax_t)ahs.ahs_hist[i]
);
AHSTAT64(ahs.ahs_ibytes, "bytes received");
AHSTAT64(ahs.ahs_obytes, "bytes transmitted");
#undef AHSTAT64
AHSTAT(ahs.ahs_ibytes, "bytes received");
AHSTAT(ahs.ahs_obytes, "bytes transmitted");
#undef AHSTAT
#define ESPSTAT(x,fmt) if (x) printf("esp " fmt ": %u\n", x)
#define ESPSTAT64(x,fmt) if (x) printf("esp " fmt ": %llu\n", x)
#define ESPSTAT(x,fmt) if (x) printf("esp " fmt ": %ju\n", (uintmax_t)x)
ESPSTAT(esps.esps_input, "input packets processed");
ESPSTAT(esps.esps_output, "output packets processed");
ESPSTAT(esps.esps_hdrops, "headers too short");
@ -151,29 +148,30 @@ main(int argc, char *argv[])
ESPSTAT(esps.esps_tunnel, "tunnel sanity check failures");
for (i = 0; i < ESP_ALG_MAX; i++)
if (esps.esps_hist[i])
printf("esp packets with %s: %u\n"
printf("esp packets with %s: %ju\n"
, algname(i, espalgs, N(espalgs))
, esps.esps_hist[i]
, (uintmax_t)esps.esps_hist[i]
);
ESPSTAT64(esps.esps_ibytes, "bytes received");
ESPSTAT64(esps.esps_obytes, "bytes transmitted");
#undef ESPSTAT64
ESPSTAT(esps.esps_ibytes, "bytes received");
ESPSTAT(esps.esps_obytes, "bytes transmitted");
#undef ESPSTAT
printf("\n");
if (ips.ips_in_polvio+ips.ips_out_polvio)
printf("policy violations: input %u output %u\n",
ips.ips_in_polvio, ips.ips_out_polvio);
STAT(ips.ips_out_nosa, "no SA found %u (output)");
STAT(ips.ips_out_nomem, "no memory available %u (output)");
STAT(ips.ips_out_noroute, "no route available %u (output)");
STAT(ips.ips_out_inval, "generic error %u (output)");
STAT(ips.ips_out_bundlesa, "bundled SA processed %u (output)");
printf("m_clone processing: %u mbufs + %u clusters coalesced\n",
ips.ips_mbcoalesced, ips.ips_clcoalesced);
printf("m_clone processing: %u clusters copied\n", ips.ips_clcopied);
printf("m_makespace: %u mbufs inserted\n", ips.ips_mbinserted);
printf("header position [front/middle/end]: %u/%u/%u\n",
ips.ips_input_front, ips.ips_input_middle, ips.ips_input_end);
printf("policy violations: input %ju output %ju\n",
(uintmax_t)ips.ips_in_polvio,
(uintmax_t)ips.ips_out_polvio);
STAT(ips.ips_out_nosa, "no SA found %ju (output)");
STAT(ips.ips_out_nomem, "no memory available %ju (output)");
STAT(ips.ips_out_noroute, "no route available %ju (output)");
STAT(ips.ips_out_inval, "generic error %ju (output)");
STAT(ips.ips_out_bundlesa, "bundled SA processed %ju (output)");
printf("m_clone processing: %ju mbufs + %ju clusters coalesced\n",
(uintmax_t)ips.ips_mbcoalesced, (uintmax_t)ips.ips_clcoalesced);
STAT(ips.ips_clcopied, "m_clone processing: %ju clusters copied\n");
STAT(ips.ips_mbinserted, "m_makespace: %ju mbufs inserted\n");
printf("header position [front/middle/end]: %ju/%ju/%ju\n",
(uintmax_t)ips.ips_input_front, (uintmax_t)ips.ips_input_middle,
(uintmax_t)ips.ips_input_end);
return 0;
}

View File

@ -743,7 +743,7 @@ udp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
{
struct udpstat udpstat, zerostat;
size_t len = sizeof udpstat;
u_long delivered;
uint64_t delivered;
#ifdef INET6
if (udp_done != 0)
@ -765,19 +765,19 @@ udp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
printf("%s:\n", name);
#define p(f, m) if (udpstat.f || sflag <= 1) \
printf(m, udpstat.f, plural(udpstat.f))
printf("\t%ju " m, (uintmax_t)udpstat.f, plural(udpstat.f))
#define p1a(f, m) if (udpstat.f || sflag <= 1) \
printf(m, udpstat.f)
p(udps_ipackets, "\t%lu datagram%s received\n");
p1a(udps_hdrops, "\t%lu with incomplete header\n");
p1a(udps_badlen, "\t%lu with bad data length field\n");
p1a(udps_badsum, "\t%lu with bad checksum\n");
p1a(udps_nosum, "\t%lu with no checksum\n");
p1a(udps_noport, "\t%lu dropped due to no socket\n");
printf("\t%ju " m, (uintmax_t)udpstat.f)
p(udps_ipackets, "datagram%s received\n");
p1a(udps_hdrops, "with incomplete header\n");
p1a(udps_badlen, "with bad data length field\n");
p1a(udps_badsum, "with bad checksum\n");
p1a(udps_nosum, "with no checksum\n");
p1a(udps_noport, "dropped due to no socket\n");
p(udps_noportbcast,
"\t%lu broadcast/multicast datagram%s undelivered\n");
p1a(udps_fullsock, "\t%lu dropped due to full socket buffers\n");
p1a(udpps_pcbhashmiss, "\t%lu not for hashed pcb\n");
"broadcast/multicast datagram%s undelivered\n");
p1a(udps_fullsock, "dropped due to full socket buffers\n");
p1a(udpps_pcbhashmiss, "not for hashed pcb\n");
delivered = udpstat.udps_ipackets -
udpstat.udps_hdrops -
udpstat.udps_badlen -
@ -786,11 +786,11 @@ udp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
udpstat.udps_noportbcast -
udpstat.udps_fullsock;
if (delivered || sflag <= 1)
printf("\t%lu delivered\n", delivered);
p(udps_opackets, "\t%lu datagram%s output\n");
printf("\t%ju delivered\n", (uint64_t)delivered);
p(udps_opackets, "datagram%s output\n");
/* the next statistic is cumulative in udps_noportbcast */
p(udps_filtermcast,
"\t%lu time%s multicast source filter matched\n");
"time%s multicast source filter matched\n");
#undef p
#undef p1a
}
@ -938,18 +938,18 @@ arp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
printf("%s:\n", name);
#define p(f, m) if (arpstat.f || sflag <= 1) \
printf(m, arpstat.f, plural(arpstat.f))
printf("\t%ju " m, (uintmax_t)arpstat.f, plural(arpstat.f))
#define p2(f, m) if (arpstat.f || sflag <= 1) \
printf(m, arpstat.f, pluralies(arpstat.f))
printf("\t%ju " m, (uintmax_t)arpstat.f, pluralies(arpstat.f))
p(txrequests, "\t%lu ARP request%s sent\n");
p2(txreplies, "\t%lu ARP repl%s sent\n");
p(rxrequests, "\t%lu ARP request%s received\n");
p2(rxreplies, "\t%lu ARP repl%s received\n");
p(received, "\t%lu ARP packet%s received\n");
p(dropped, "\t%lu total packet%s dropped due to no ARP entry\n");
p(timeouts, "\t%lu ARP entry%s timed out\n");
p(dupips, "\t%lu Duplicate IP%s seen\n");
p(txrequests, "ARP request%s sent\n");
p2(txreplies, "ARP repl%s sent\n");
p(rxrequests, "ARP request%s received\n");
p2(rxreplies, "ARP repl%s received\n");
p(received, "ARP packet%s received\n");
p(dropped, "total packet%s dropped due to no ARP entry\n");
p(timeouts, "ARP entry%s timed out\n");
p(dupips, "Duplicate IP%s seen\n");
#undef p
#undef p2
}

View File

@ -274,7 +274,7 @@ ipsec_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
}
static void ipsec_hist_new(const u_int32_t *hist, size_t histmax,
static void ipsec_hist_new(const uint64_t *hist, size_t histmax,
const struct val2str *name, const char *title);
static void print_ahstats(const struct ahstat *ahstat);
static void print_espstats(const struct espstat *espstat);
@ -284,7 +284,7 @@ static void print_ipcompstats(const struct ipcompstat *ipcompstat);
* Dump IPSEC statistics structure.
*/
static void
ipsec_hist_new(const u_int32_t *hist, size_t histmax,
ipsec_hist_new(const uint64_t *hist, size_t histmax,
const struct val2str *name, const char *title)
{
int first;
@ -304,10 +304,11 @@ ipsec_hist_new(const u_int32_t *hist, size_t histmax,
break;
}
if (p && p->str) {
printf("\t\t%s: %u\n", p->str, hist[proto]);
printf("\t\t%s: %ju\n", p->str,
(uintmax_t)hist[proto]);
} else {
printf("\t\t#%lu: %u\n", (unsigned long)proto,
hist[proto]);
printf("\t\t#%lu: %ju\n", (unsigned long)proto,
(uintmax_t)hist[proto]);
}
}
}
@ -315,36 +316,33 @@ ipsec_hist_new(const u_int32_t *hist, size_t histmax,
static void
print_ahstats(const struct ahstat *ahstat)
{
#define p32(f, m) if (ahstat->f || sflag <= 1) \
printf("\t%u" m, (unsigned int)ahstat->f, plural(ahstat->f))
#define p64(f, m) if (ahstat->f || sflag <= 1) \
#define p(f, m) if (ahstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)ahstat->f, plural(ahstat->f))
#define hist(f, n, t) \
ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
p32(ahs_hdrops, " packet%s shorter than header shows\n");
p32(ahs_nopf, " packet%s dropped; protocol family not supported\n");
p32(ahs_notdb, " packet%s dropped; no TDB\n");
p32(ahs_badkcr, " packet%s dropped; bad KCR\n");
p32(ahs_qfull, " packet%s dropped; queue full\n");
p32(ahs_noxform, " packet%s dropped; no transform\n");
p32(ahs_wrap, " replay counter wrap%s\n");
p32(ahs_badauth, " packet%s dropped; bad authentication detected\n");
p32(ahs_badauthl, " packet%s dropped; bad authentication length\n");
p32(ahs_replay, " possible replay packet%s detected\n");
p32(ahs_input, " packet%s in\n");
p32(ahs_output, " packet%s out\n");
p32(ahs_invalid, " packet%s dropped; invalid TDB\n");
p64(ahs_ibytes, " byte%s in\n");
p64(ahs_obytes, " byte%s out\n");
p32(ahs_toobig, " packet%s dropped; larger than IP_MAXPACKET\n");
p32(ahs_pdrops, " packet%s blocked due to policy\n");
p32(ahs_crypto, " crypto processing failure%s\n");
p32(ahs_tunnel, " tunnel sanity check failure%s\n");
p(ahs_hdrops, " packet%s shorter than header shows\n");
p(ahs_nopf, " packet%s dropped; protocol family not supported\n");
p(ahs_notdb, " packet%s dropped; no TDB\n");
p(ahs_badkcr, " packet%s dropped; bad KCR\n");
p(ahs_qfull, " packet%s dropped; queue full\n");
p(ahs_noxform, " packet%s dropped; no transform\n");
p(ahs_wrap, " replay counter wrap%s\n");
p(ahs_badauth, " packet%s dropped; bad authentication detected\n");
p(ahs_badauthl, " packet%s dropped; bad authentication length\n");
p(ahs_replay, " possible replay packet%s detected\n");
p(ahs_input, " packet%s in\n");
p(ahs_output, " packet%s out\n");
p(ahs_invalid, " packet%s dropped; invalid TDB\n");
p(ahs_ibytes, " byte%s in\n");
p(ahs_obytes, " byte%s out\n");
p(ahs_toobig, " packet%s dropped; larger than IP_MAXPACKET\n");
p(ahs_pdrops, " packet%s blocked due to policy\n");
p(ahs_crypto, " crypto processing failure%s\n");
p(ahs_tunnel, " tunnel sanity check failure%s\n");
hist(ahstat->ahs_hist, ipsec_ahnames, "AH output");
#undef p32
#undef p64
#undef p
#undef hist
}
@ -364,37 +362,34 @@ ah_stats(u_long off, const char *name, int family __unused, int proto __unused)
static void
print_espstats(const struct espstat *espstat)
{
#define p32(f, m) if (espstat->f || sflag <= 1) \
printf("\t%u" m, (unsigned int)espstat->f, plural(espstat->f))
#define p64(f, m) if (espstat->f || sflag <= 1) \
#define p(f, m) if (espstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)espstat->f, plural(espstat->f))
#define hist(f, n, t) \
ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
p32(esps_hdrops, " packet%s shorter than header shows\n");
p32(esps_nopf, " packet%s dropped; protocol family not supported\n");
p32(esps_notdb, " packet%s dropped; no TDB\n");
p32(esps_badkcr, " packet%s dropped; bad KCR\n");
p32(esps_qfull, " packet%s dropped; queue full\n");
p32(esps_noxform, " packet%s dropped; no transform\n");
p32(esps_badilen, " packet%s dropped; bad ilen\n");
p32(esps_wrap, " replay counter wrap%s\n");
p32(esps_badenc, " packet%s dropped; bad encryption detected\n");
p32(esps_badauth, " packet%s dropped; bad authentication detected\n");
p32(esps_replay, " possible replay packet%s detected\n");
p32(esps_input, " packet%s in\n");
p32(esps_output, " packet%s out\n");
p32(esps_invalid, " packet%s dropped; invalid TDB\n");
p64(esps_ibytes, " byte%s in\n");
p64(esps_obytes, " byte%s out\n");
p32(esps_toobig, " packet%s dropped; larger than IP_MAXPACKET\n");
p32(esps_pdrops, " packet%s blocked due to policy\n");
p32(esps_crypto, " crypto processing failure%s\n");
p32(esps_tunnel, " tunnel sanity check failure%s\n");
p(esps_hdrops, " packet%s shorter than header shows\n");
p(esps_nopf, " packet%s dropped; protocol family not supported\n");
p(esps_notdb, " packet%s dropped; no TDB\n");
p(esps_badkcr, " packet%s dropped; bad KCR\n");
p(esps_qfull, " packet%s dropped; queue full\n");
p(esps_noxform, " packet%s dropped; no transform\n");
p(esps_badilen, " packet%s dropped; bad ilen\n");
p(esps_wrap, " replay counter wrap%s\n");
p(esps_badenc, " packet%s dropped; bad encryption detected\n");
p(esps_badauth, " packet%s dropped; bad authentication detected\n");
p(esps_replay, " possible replay packet%s detected\n");
p(esps_input, " packet%s in\n");
p(esps_output, " packet%s out\n");
p(esps_invalid, " packet%s dropped; invalid TDB\n");
p(esps_ibytes, " byte%s in\n");
p(esps_obytes, " byte%s out\n");
p(esps_toobig, " packet%s dropped; larger than IP_MAXPACKET\n");
p(esps_pdrops, " packet%s blocked due to policy\n");
p(esps_crypto, " crypto processing failure%s\n");
p(esps_tunnel, " tunnel sanity check failure%s\n");
hist(espstat->esps_hist, ipsec_espnames, "ESP output");
#undef p32
#undef p64
#undef p
#undef hist
}
@ -414,42 +409,31 @@ esp_stats(u_long off, const char *name, int family __unused, int proto __unused)
static void
print_ipcompstats(const struct ipcompstat *ipcompstat)
{
uint32_t version;
#define p32(f, m) if (ipcompstat->f || sflag <= 1) \
printf("\t%u" m, (unsigned int)ipcompstat->f, plural(ipcompstat->f))
#define p64(f, m) if (ipcompstat->f || sflag <= 1) \
#define p(f, m) if (ipcompstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)ipcompstat->f, plural(ipcompstat->f))
#define hist(f, n, t) \
ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
#ifndef IPCOMPSTAT_VERSION
version = 0;
#else
version = ipcompstat->version;
#endif
p32(ipcomps_hdrops, " packet%s shorter than header shows\n");
p32(ipcomps_nopf, " packet%s dropped; protocol family not supported\n");
p32(ipcomps_notdb, " packet%s dropped; no TDB\n");
p32(ipcomps_badkcr, " packet%s dropped; bad KCR\n");
p32(ipcomps_qfull, " packet%s dropped; queue full\n");
p32(ipcomps_noxform, " packet%s dropped; no transform\n");
p32(ipcomps_wrap, " replay counter wrap%s\n");
p32(ipcomps_input, " packet%s in\n");
p32(ipcomps_output, " packet%s out\n");
p32(ipcomps_invalid, " packet%s dropped; invalid TDB\n");
p64(ipcomps_ibytes, " byte%s in\n");
p64(ipcomps_obytes, " byte%s out\n");
p32(ipcomps_toobig, " packet%s dropped; larger than IP_MAXPACKET\n");
p32(ipcomps_pdrops, " packet%s blocked due to policy\n");
p32(ipcomps_crypto, " crypto processing failure%s\n");
p(ipcomps_hdrops, " packet%s shorter than header shows\n");
p(ipcomps_nopf, " packet%s dropped; protocol family not supported\n");
p(ipcomps_notdb, " packet%s dropped; no TDB\n");
p(ipcomps_badkcr, " packet%s dropped; bad KCR\n");
p(ipcomps_qfull, " packet%s dropped; queue full\n");
p(ipcomps_noxform, " packet%s dropped; no transform\n");
p(ipcomps_wrap, " replay counter wrap%s\n");
p(ipcomps_input, " packet%s in\n");
p(ipcomps_output, " packet%s out\n");
p(ipcomps_invalid, " packet%s dropped; invalid TDB\n");
p(ipcomps_ibytes, " byte%s in\n");
p(ipcomps_obytes, " byte%s out\n");
p(ipcomps_toobig, " packet%s dropped; larger than IP_MAXPACKET\n");
p(ipcomps_pdrops, " packet%s blocked due to policy\n");
p(ipcomps_crypto, " crypto processing failure%s\n");
hist(ipcompstat->ipcomps_hist, ipsec_compnames, "COMP output");
if (version >= 1) {
p32(ipcomps_threshold, " packet%s sent uncompressed; size < compr. algo. threshold\n");
p32(ipcomps_uncompr, " packet%s sent uncompressed; compression was useless\n");
}
p(ipcomps_threshold, " packet%s sent uncompressed; size < compr. algo. threshold\n");
p(ipcomps_uncompr, " packet%s sent uncompressed; compression was useless\n");
#undef p32
#undef p64
#undef p
#undef hist
}

View File

@ -355,24 +355,24 @@ mrt_stats(u_long mstaddr)
printf("IPv4 multicast forwarding:\n");
#define p(f, m) if (mrtstat.f || sflag <= 1) \
printf(m, mrtstat.f, plural(mrtstat.f))
printf(m, (uintmax_t)mrtstat.f, plural(mrtstat.f))
#define p2(f, m) if (mrtstat.f || sflag <= 1) \
printf(m, mrtstat.f, plurales(mrtstat.f))
printf(m, (uintmax_t)mrtstat.f, plurales(mrtstat.f))
p(mrts_mfc_lookups, "\t%lu multicast forwarding cache lookup%s\n");
p2(mrts_mfc_misses, "\t%lu multicast forwarding cache miss%s\n");
p(mrts_upcalls, "\t%lu upcall%s to multicast routing daemon\n");
p(mrts_upq_ovflw, "\t%lu upcall queue overflow%s\n");
p(mrts_mfc_lookups, "\t%ju multicast forwarding cache lookup%s\n");
p2(mrts_mfc_misses, "\t%ju multicast forwarding cache miss%s\n");
p(mrts_upcalls, "\t%ju upcall%s to multicast routing daemon\n");
p(mrts_upq_ovflw, "\t%ju upcall queue overflow%s\n");
p(mrts_upq_sockfull,
"\t%lu upcall%s dropped due to full socket buffer\n");
p(mrts_cache_cleanups, "\t%lu cache cleanup%s\n");
p(mrts_no_route, "\t%lu datagram%s with no route for origin\n");
p(mrts_bad_tunnel, "\t%lu datagram%s arrived with bad tunneling\n");
p(mrts_cant_tunnel, "\t%lu datagram%s could not be tunneled\n");
p(mrts_wrong_if, "\t%lu datagram%s arrived on wrong interface\n");
p(mrts_drop_sel, "\t%lu datagram%s selectively dropped\n");
p(mrts_q_overflow, "\t%lu datagram%s dropped due to queue overflow\n");
p(mrts_pkt2large, "\t%lu datagram%s dropped for being too large\n");
"\t%ju upcall%s dropped due to full socket buffer\n");
p(mrts_cache_cleanups, "\t%ju cache cleanup%s\n");
p(mrts_no_route, "\t%ju datagram%s with no route for origin\n");
p(mrts_bad_tunnel, "\t%ju datagram%s arrived with bad tunneling\n");
p(mrts_cant_tunnel, "\t%ju datagram%s could not be tunneled\n");
p(mrts_wrong_if, "\t%ju datagram%s arrived on wrong interface\n");
p(mrts_drop_sel, "\t%ju datagram%s selectively dropped\n");
p(mrts_q_overflow, "\t%ju datagram%s dropped due to queue overflow\n");
p(mrts_pkt2large, "\t%ju datagram%s dropped for being too large\n");
#undef p2
#undef p