Subject: Re: kern/1515 - Changing netstat variables to 64 bit
To: None <jmarin@salakka.jmp.fi>
From: Darren Reed <darrenr@reed.wattle.id.au>
List: tech-net
Date: 06/07/1999 17:04:11
Does that collection of patches below help you with this ?
I'm somewhat surprised this has been left open given its rather
innocent and `simple' nature. I haven't tested these yet, but
they appear right...will test them late.
Darren
*** usr/src/sys/net/if.h.dist Sat Mar 27 12:24:49 1999
--- usr/src/sys/net/if.h Mon Jun 7 16:46:59 1999
***************
*** 82,102 ****
u_char ifi_type; /* ethernet, tokenring, etc. */
u_char ifi_addrlen; /* media address length */
u_char ifi_hdrlen; /* media header length */
! u_long ifi_mtu; /* maximum transmission unit */
! u_long ifi_metric; /* routing metric (external only) */
! u_long ifi_baudrate; /* linespeed */
/* volatile statistics */
! u_long ifi_ipackets; /* packets received on interface */
! u_long ifi_ierrors; /* input errors on interface */
! u_long ifi_opackets; /* packets sent on interface */
! u_long ifi_oerrors; /* output errors on interface */
! u_long ifi_collisions; /* collisions on csma interfaces */
! u_long ifi_ibytes; /* total number of octets received */
! u_long ifi_obytes; /* total number of octets sent */
! u_long ifi_imcasts; /* packets received via multicast */
! u_long ifi_omcasts; /* packets sent via multicast */
! u_long ifi_iqdrops; /* dropped on input, this interface */
! u_long ifi_noproto; /* destined for unsupported protocol */
struct timeval ifi_lastchange; /* last updated */
};
--- 82,102 ----
u_char ifi_type; /* ethernet, tokenring, etc. */
u_char ifi_addrlen; /* media address length */
u_char ifi_hdrlen; /* media header length */
! u_quad_t ifi_mtu; /* maximum transmission unit */
! u_quad_t ifi_metric; /* routing metric (external only) */
! u_quad_t ifi_baudrate; /* linespeed */
/* volatile statistics */
! u_quad_t ifi_ipackets; /* packets received on interface */
! u_quad_t ifi_ierrors; /* input errors on interface */
! u_quad_t ifi_opackets; /* packets sent on interface */
! u_quad_t ifi_oerrors; /* output errors on interface */
! u_quad_t ifi_collisions; /* collisions on csma interfaces */
! u_quad_t ifi_ibytes; /* total number of octets received */
! u_quad_t ifi_obytes; /* total number of octets sent */
! u_quad_t ifi_imcasts; /* packets received via multicast */
! u_quad_t ifi_omcasts; /* packets sent via multicast */
! u_quad_t ifi_iqdrops; /* dropped on input, this interface */
! u_quad_t ifi_noproto; /* destined for unsupported protocol */
struct timeval ifi_lastchange; /* last updated */
};
*** usr/src/sys/netinet/icmp_var.h.dist Tue Feb 10 12:26:19 1998
--- usr/src/sys/netinet/icmp_var.h Mon Jun 7 16:43:30 1999
***************
*** 44,60 ****
*/
struct icmpstat {
/* statistics related to icmp packets generated */
! u_long icps_error; /* # of calls to icmp_error */
! u_long icps_oldshort; /* no error 'cuz old ip too short */
! u_long icps_oldicmp; /* no error 'cuz old was icmp */
! u_long icps_outhist[ICMP_MAXTYPE + 1];
/* statistics related to input messages processed */
! u_long icps_badcode; /* icmp_code out of range */
! u_long icps_tooshort; /* packet < ICMP_MINLEN */
! u_long icps_checksum; /* bad checksum */
! u_long icps_badlen; /* calculated bound mismatch */
! u_long icps_reflect; /* number of responses */
! u_long icps_inhist[ICMP_MAXTYPE + 1];
};
/*
--- 44,60 ----
*/
struct icmpstat {
/* statistics related to icmp packets generated */
! u_quad_t icps_error; /* # of calls to icmp_error */
! u_quad_t icps_oldshort; /* no error 'cuz old ip too short */
! u_quad_t icps_oldicmp; /* no error 'cuz old was icmp */
! u_quad_t icps_outhist[ICMP_MAXTYPE + 1];
/* statistics related to input messages processed */
! u_quad_t icps_badcode; /* icmp_code out of range */
! u_quad_t icps_tooshort; /* packet < ICMP_MINLEN */
! u_quad_t icps_checksum; /* bad checksum */
! u_quad_t icps_badlen; /* calculated bound mismatch */
! u_quad_t icps_reflect; /* number of responses */
! u_quad_t icps_inhist[ICMP_MAXTYPE + 1];
};
/*
*** usr/src/sys/netinet/igmp_var.h.dist Tue Feb 10 12:26:31 1998
--- usr/src/sys/netinet/igmp_var.h Mon Jun 7 16:44:15 1999
***************
*** 54,68 ****
*/
struct igmpstat {
! u_long igps_rcv_total; /* total IGMP messages received */
! u_long igps_rcv_tooshort; /* received with too few bytes */
! u_long igps_rcv_badsum; /* received with bad checksum */
! u_long igps_rcv_queries; /* received membership queries */
! u_long igps_rcv_badqueries; /* received invalid queries */
! u_long igps_rcv_reports; /* received membership reports */
! u_long igps_rcv_badreports; /* received invalid reports */
! u_long igps_rcv_ourreports; /* received reports for our groups */
! u_long igps_snd_reports; /* sent membership reports */
};
#ifdef _KERNEL
--- 54,68 ----
*/
struct igmpstat {
! u_quad_t igps_rcv_total; /* total IGMP messages received */
! u_quad_t igps_rcv_tooshort; /* received with too few bytes */
! u_quad_t igps_rcv_badsum; /* received with bad checksum */
! u_quad_t igps_rcv_queries; /* received membership queries */
! u_quad_t igps_rcv_badqueries; /* received invalid queries */
! u_quad_t igps_rcv_reports; /* received membership reports */
! u_quad_t igps_rcv_badreports; /* received invalid reports */
! u_quad_t igps_rcv_ourreports; /* received reports for our groups */
! u_quad_t igps_snd_reports; /* sent membership reports */
};
#ifdef _KERNEL
*** usr/src/sys/netinet/ip_var.h.dist Thu Oct 8 11:41:46 1998
--- usr/src/sys/netinet/ip_var.h Mon Jun 7 16:45:56 1999
***************
*** 124,157 ****
};
struct ipstat {
! u_long ips_total; /* total packets received */
! u_long ips_badsum; /* checksum bad */
! u_long ips_tooshort; /* packet too short */
! u_long ips_toosmall; /* not enough data */
! u_long ips_badhlen; /* ip header length < data size */
! u_long ips_badlen; /* ip length < ip header length */
! u_long ips_fragments; /* fragments received */
! u_long ips_fragdropped; /* frags dropped (dups, out of space) */
! u_long ips_fragtimeout; /* fragments timed out */
! u_long ips_forward; /* packets forwarded */
! u_long ips_fastforward; /* packets fast forwarded */
! u_long ips_cantforward; /* packets rcvd for unreachable dest */
! u_long ips_redirectsent; /* packets forwarded on same net */
! u_long ips_noproto; /* unknown or unsupported protocol */
! u_long ips_delivered; /* datagrams delivered to upper level*/
! u_long ips_localout; /* total ip packets generated here */
! u_long ips_odropped; /* lost packets due to nobufs, etc. */
! u_long ips_reassembled; /* total packets reassembled ok */
! u_long ips_fragmented; /* datagrams sucessfully fragmented */
! u_long ips_ofragments; /* output fragments created */
! u_long ips_cantfrag; /* don't fragment flag was set, etc. */
! u_long ips_badoptions; /* error in option processing */
! u_long ips_noroute; /* packets discarded due to no route */
! u_long ips_badvers; /* ip version != 4 */
! u_long ips_rawout; /* total raw ip packets generated */
! u_long ips_badfrags; /* malformed fragments (bad length) */
! u_long ips_rcvmemdrop; /* frags dropped for lack of memory */
! u_long ips_toolong; /* ip length > max ip packet size */
};
#define IPFLOW_HASHBITS 6 /* should not be a multiple of 8 */
--- 124,157 ----
};
struct ipstat {
! u_quad_t ips_total; /* total packets received */
! u_quad_t ips_badsum; /* checksum bad */
! u_quad_t ips_tooshort; /* packet too short */
! u_quad_t ips_toosmall; /* not enough data */
! u_quad_t ips_badhlen; /* ip header length < data size */
! u_quad_t ips_badlen; /* ip length < ip header length */
! u_quad_t ips_fragments; /* fragments received */
! u_quad_t ips_fragdropped; /* frags dropped (dups, out of space) */
! u_quad_t ips_fragtimeout; /* fragments timed out */
! u_quad_t ips_forward; /* packets forwarded */
! u_quad_t ips_fastforward; /* packets fast forwarded */
! u_quad_t ips_cantforward; /* packets rcvd for unreachable dest */
! u_quad_t ips_redirectsent; /* packets forwarded on same net */
! u_quad_t ips_noproto; /* unknown or unsupported protocol */
! u_quad_t ips_delivered; /* datagrams delivered to upper level*/
! u_quad_t ips_localout; /* total ip packets generated here */
! u_quad_t ips_odropped; /* lost packets due to nobufs, etc. */
! u_quad_t ips_reassembled; /* total packets reassembled ok */
! u_quad_t ips_fragmented; /* datagrams sucessfully fragmented */
! u_quad_t ips_ofragments; /* output fragments created */
! u_quad_t ips_cantfrag; /* don't fragment flag was set, etc. */
! u_quad_t ips_badoptions; /* error in option processing */
! u_quad_t ips_noroute; /* packets discarded due to no route */
! u_quad_t ips_badvers; /* ip version != 4 */
! u_quad_t ips_rawout; /* total raw ip packets generated */
! u_quad_t ips_badfrags; /* malformed fragments (bad length) */
! u_quad_t ips_rcvmemdrop; /* frags dropped for lack of memory */
! u_quad_t ips_toolong; /* ip length > max ip packet size */
};
#define IPFLOW_HASHBITS 6 /* should not be a multiple of 8 */
*** usr/src/sys/netinet/tcp_var.h.dist Fri Apr 30 00:52:59 1999
--- usr/src/sys/netinet/tcp_var.h Mon Jun 7 16:40:12 1999
***************
*** 355,434 ****
* but that's inconvenient at the moment.
*/
struct tcpstat {
! u_long tcps_connattempt; /* connections initiated */
! u_long tcps_accepts; /* connections accepted */
! u_long tcps_connects; /* connections established */
! u_long tcps_drops; /* connections dropped */
! u_long tcps_conndrops; /* embryonic connections dropped */
! u_long tcps_closed; /* conn. closed (includes drops) */
! u_long tcps_segstimed; /* segs where we tried to get rtt */
! u_long tcps_rttupdated; /* times we succeeded */
! u_long tcps_delack; /* delayed acks sent */
! u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */
! u_long tcps_rexmttimeo; /* retransmit timeouts */
! u_long tcps_persisttimeo; /* persist timeouts */
! u_long tcps_keeptimeo; /* keepalive timeouts */
! u_long tcps_keepprobe; /* keepalive probes sent */
! u_long tcps_keepdrops; /* connections dropped in keepalive */
! u_long tcps_persistdrops; /* connections dropped in persist */
! u_long tcps_connsdrained; /* connections drained due to memory
shortage */
! u_long tcps_sndtotal; /* total packets sent */
! u_long tcps_sndpack; /* data packets sent */
! u_long tcps_sndbyte; /* data bytes sent */
! u_long tcps_sndrexmitpack; /* data packets retransmitted */
! u_long tcps_sndrexmitbyte; /* data bytes retransmitted */
! u_long tcps_sndacks; /* ack-only packets sent */
! u_long tcps_sndprobe; /* window probes sent */
! u_long tcps_sndurg; /* packets sent with URG only */
! u_long tcps_sndwinup; /* window update-only packets sent */
! u_long tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */
! u_long tcps_rcvtotal; /* total packets received */
! u_long tcps_rcvpack; /* packets received in sequence */
! u_long tcps_rcvbyte; /* bytes received in sequence */
! u_long tcps_rcvbadsum; /* packets received with ccksum errs */
! u_long tcps_rcvbadoff; /* packets received with bad offset */
! u_long tcps_rcvmemdrop; /* packets dropped for lack of memory */
! u_long tcps_rcvshort; /* packets received too short */
! u_long tcps_rcvduppack; /* duplicate-only packets received */
! u_long tcps_rcvdupbyte; /* duplicate-only bytes received */
! u_long tcps_rcvpartduppack; /* packets with some duplicate data */
! u_long tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */
! u_long tcps_rcvoopack; /* out-of-order packets received */
! u_long tcps_rcvoobyte; /* out-of-order bytes received */
! u_long tcps_rcvpackafterwin; /* packets with data after window */
! u_long tcps_rcvbyteafterwin; /* bytes rcvd after window */
! u_long tcps_rcvafterclose; /* packets rcvd after "close" */
! u_long tcps_rcvwinprobe; /* rcvd window probe packets */
! u_long tcps_rcvdupack; /* rcvd duplicate acks */
! u_long tcps_rcvacktoomuch; /* rcvd acks for unsent data */
! u_long tcps_rcvackpack; /* rcvd ack packets */
! u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */
! u_long tcps_rcvwinupd; /* rcvd window update packets */
! u_long tcps_pawsdrop; /* segments dropped due to PAWS */
! u_long tcps_predack; /* times hdr predict ok for acks */
! u_long tcps_preddat; /* times hdr predict ok for data pkts */
! u_long tcps_pcbhashmiss; /* input packets missing pcb hash */
! u_long tcps_noport; /* no socket on port */
! u_long tcps_badsyn; /* received ack for which we have
no SYN in compressed state */
/* These statistics deal with the SYN cache. */
! u_long tcps_sc_added; /* # of entries added */
! u_long tcps_sc_completed; /* # of connections completed */
! u_long tcps_sc_timed_out; /* # of entries timed out */
! u_long tcps_sc_overflowed; /* # dropped due to overflow */
! u_long tcps_sc_reset; /* # dropped due to RST */
! u_long tcps_sc_unreach; /* # dropped due to ICMP unreach */
! u_long tcps_sc_bucketoverflow; /* # dropped due to bucket overflow */
! u_long tcps_sc_aborted; /* # of entries aborted (no mem) */
! u_long tcps_sc_dupesyn; /* # of duplicate SYNs received */
! u_long tcps_sc_dropped; /* # of SYNs dropped (no route/mem) */
! u_long tcps_sc_collisions; /* # of hash collisions */
! u_long tcps_sc_retransmitted; /* # of retransmissions */
};
/*
--- 355,434 ----
* but that's inconvenient at the moment.
*/
struct tcpstat {
! u_quad_t tcps_connattempt; /* connections initiated */
! u_quad_t tcps_accepts; /* connections accepted */
! u_quad_t tcps_connects; /* connections established */
! u_quad_t tcps_drops; /* connections dropped */
! u_quad_t tcps_conndrops; /* embryonic connections dropped */
! u_quad_t tcps_closed; /* conn. closed (includes drops) */
! u_quad_t tcps_segstimed; /* segs where we tried to get rtt */
! u_quad_t tcps_rttupdated; /* times we succeeded */
! u_quad_t tcps_delack; /* delayed acks sent */
! u_quad_t tcps_timeoutdrop; /* conn. dropped in rxmt timeout */
! u_quad_t tcps_rexmttimeo; /* retransmit timeouts */
! u_quad_t tcps_persisttimeo; /* persist timeouts */
! u_quad_t tcps_keeptimeo; /* keepalive timeouts */
! u_quad_t tcps_keepprobe; /* keepalive probes sent */
! u_quad_t tcps_keepdrops; /* connections dropped in keepalive */
! u_quad_t tcps_persistdrops; /* connections dropped in persist */
! u_quad_t tcps_connsdrained; /* connections drained due to memory
shortage */
! u_quad_t tcps_sndtotal; /* total packets sent */
! u_quad_t tcps_sndpack; /* data packets sent */
! u_quad_t tcps_sndbyte; /* data bytes sent */
! u_quad_t tcps_sndrexmitpack; /* data packets retransmitted */
! u_quad_t tcps_sndrexmitbyte; /* data bytes retransmitted */
! u_quad_t tcps_sndacks; /* ack-only packets sent */
! u_quad_t tcps_sndprobe; /* window probes sent */
! u_quad_t tcps_sndurg; /* packets sent with URG only */
! u_quad_t tcps_sndwinup; /* window update-only packets sent */
! u_quad_t tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */
! u_quad_t tcps_rcvtotal; /* total packets received */
! u_quad_t tcps_rcvpack; /* packets received in sequence */
! u_quad_t tcps_rcvbyte; /* bytes received in sequence */
! u_quad_t tcps_rcvbadsum; /* packets received with ccksum errs */
! u_quad_t tcps_rcvbadoff; /* packets received with bad offset */
! u_quad_t tcps_rcvmemdrop; /* packets dropped for lack of memory */
! u_quad_t tcps_rcvshort; /* packets received too short */
! u_quad_t tcps_rcvduppack; /* duplicate-only packets received */
! u_quad_t tcps_rcvdupbyte; /* duplicate-only bytes received */
! u_quad_t tcps_rcvpartduppack; /* packets with some duplicate data */
! u_quad_t tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */
! u_quad_t tcps_rcvoopack; /* out-of-order packets received */
! u_quad_t tcps_rcvoobyte; /* out-of-order bytes received */
! u_quad_t tcps_rcvpackafterwin; /* packets with data after window */
! u_quad_t tcps_rcvbyteafterwin; /* bytes rcvd after window */
! u_quad_t tcps_rcvafterclose; /* packets rcvd after "close" */
! u_quad_t tcps_rcvwinprobe; /* rcvd window probe packets */
! u_quad_t tcps_rcvdupack; /* rcvd duplicate acks */
! u_quad_t tcps_rcvacktoomuch; /* rcvd acks for unsent data */
! u_quad_t tcps_rcvackpack; /* rcvd ack packets */
! u_quad_t tcps_rcvackbyte; /* bytes acked by rcvd acks */
! u_quad_t tcps_rcvwinupd; /* rcvd window update packets */
! u_quad_t tcps_pawsdrop; /* segments dropped due to PAWS */
! u_quad_t tcps_predack; /* times hdr predict ok for acks */
! u_quad_t tcps_preddat; /* times hdr predict ok for data pkts */
! u_quad_t tcps_pcbhashmiss; /* input packets missing pcb hash */
! u_quad_t tcps_noport; /* no socket on port */
! u_quad_t tcps_badsyn; /* received ack for which we have
no SYN in compressed state */
/* These statistics deal with the SYN cache. */
! u_quad_t tcps_sc_added; /* # of entries added */
! u_quad_t tcps_sc_completed; /* # of connections completed */
! u_quad_t tcps_sc_timed_out; /* # of entries timed out */
! u_quad_t tcps_sc_overflowed; /* # dropped due to overflow */
! u_quad_t tcps_sc_reset; /* # dropped due to RST */
! u_quad_t tcps_sc_unreach; /* # dropped due to ICMP unreach */
! u_quad_t tcps_sc_bucketoverflow /* # dropped due to bucket overflow */
! u_quad_t tcps_sc_aborted; /* # of entries aborted (no mem) */
! u_quad_t tcps_sc_dupesyn; /* # of duplicate SYNs received */
! u_quad_t tcps_sc_dropped; /* # of SYNs dropped (no route/mem) */
! u_quad_t tcps_sc_collisions; /* # of hash collisions */
! u_quad_t tcps_sc_retransmitted; /* # of retransmissions */
};
/*
*** usr/src/sys/netinet/udp_var.h.dist Tue Feb 10 12:27:25 1998
--- usr/src/sys/netinet/udp_var.h Mon Jun 7 16:42:30 1999
***************
*** 56,72 ****
#define ui_sum ui_u.uh_sum
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_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 udps_pcbhashmiss; /* input packets missing pcb hash */
! /* output statistics: */
! u_long udps_opackets; /* total output packets */
};
/*
--- 56,72 ----
#define ui_sum ui_u.uh_sum
struct udpstat {
! /* input statistics: */
! u_quad_t udps_ipackets; /* total input packets */
! u_quad_t udps_hdrops; /* packet shorter than header */
! u_quad_t udps_badsum; /* checksum error */
! u_quad_t udps_badlen; /* data length larger than packet */
! u_quad_t udps_noport; /* no socket on port */
! u_quad_t udps_noportbcast; /* of above, arrived as broadcast */
! u_quad_t udps_fullsock; /* not delivered, input socket full */
! u_quad_t udps_pcbhashmiss; /* input packets missing pcb hash */
! /* output statistics: */
! u_quad_t udps_opackets; /* total output packets */
};
/*
*** usr/src/usr.bin/netstat/if.c.dist Mon Mar 15 09:28:05 1999
--- usr/src/usr.bin/netstat/if.c Mon Jun 7 16:50:00 1999
***************
*** 254,263 ****
ifaddraddr = (u_long)ifaddr.ifa.ifa_list.tqe_next;
}
if (bflag) {
! printf("%10lu %10lu",
ifnet.if_ibytes, ifnet.if_obytes);
} else {
! printf("%8lu %5lu %8lu %5lu %5lu",
ifnet.if_ipackets, ifnet.if_ierrors,
ifnet.if_opackets, ifnet.if_oerrors,
ifnet.if_collisions);
--- 254,263 ----
ifaddraddr = (u_long)ifaddr.ifa.ifa_list.tqe_next;
}
if (bflag) {
! printf("%10qu %10qu",
ifnet.if_ibytes, ifnet.if_obytes);
} else {
! printf("%8qu %5qu %8qu %5qu %5qu",
ifnet.if_ipackets, ifnet.if_ierrors,
ifnet.if_opackets, ifnet.if_oerrors,
ifnet.if_collisions);
***************
*** 408,418 ****
}
if (ip == interesting) {
if (bflag) {
! printf("%10lu %8.8s %10lu %5.5s",
ifnet.if_ibytes - ip->ift_ib, " ",
ifnet.if_obytes - ip->ift_ob, " ");
} else {
! printf("%8lu %5lu %8lu %5lu %5lu",
ifnet.if_ipackets - ip->ift_ip,
ifnet.if_ierrors - ip->ift_ie,
ifnet.if_opackets - ip->ift_op,
--- 408,418 ----
}
if (ip == interesting) {
if (bflag) {
! printf("%10qu %8.8s %10qu %5.5s",
ifnet.if_ibytes - ip->ift_ib, " ",
ifnet.if_obytes - ip->ift_ob, " ");
} else {
! printf("%8qu %5qu %8qu %5qu %5qu",
ifnet.if_ipackets - ip->ift_ip,
ifnet.if_ierrors - ip->ift_ie,
ifnet.if_opackets - ip->ift_op,
***************
*** 443,453 ****
}
if (lastif - iftot > 0) {
if (bflag) {
! printf(" %10lu %8.8s %10lu %5.5s",
sum->ift_ib - total->ift_ib, " ",
sum->ift_ob - total->ift_ob, " ");
} else {
! printf(" %8lu %5lu %8lu %5lu %5lu",
sum->ift_ip - total->ift_ip,
sum->ift_ie - total->ift_ie,
sum->ift_op - total->ift_op,
--- 443,453 ----
}
if (lastif - iftot > 0) {
if (bflag) {
! printf(" %10qu %8.8s %10qu %5.5s",
sum->ift_ib - total->ift_ib, " ",
sum->ift_ob - total->ift_ob, " ");
} else {
! printf(" %8qu %5qu %8qu %5qu %5qu",
sum->ift_ip - total->ift_ip,
sum->ift_ie - total->ift_ie,
sum->ift_op - total->ift_op,
*** usr/src/usr.bin/netstat/inet.c.dist Fri Apr 30 00:57:08 1999
--- usr/src/usr.bin/netstat/inet.c Mon Jun 7 16:51:17 1999
***************
*** 214,285 ****
#define p3(f, m) if (tcpstat.f || sflag <= 1) \
printf(m, tcpstat.f, plurales(tcpstat.f))
! p(tcps_sndtotal, "\t%lu packet%s sent\n");
p2(tcps_sndpack,tcps_sndbyte,
! "\t\t%lu data packet%s (%lu byte%s)\n");
p2(tcps_sndrexmitpack, tcps_sndrexmitbyte,
! "\t\t%lu data packet%s (%lu byte%s) retransmitted\n");
p2s(tcps_sndacks, tcps_delack,
! "\t\t%lu ack-only packet%s (%lu delayed)\n");
! p(tcps_sndurg, "\t\t%lu URG only packet%s\n");
! p(tcps_sndprobe, "\t\t%lu window probe packet%s\n");
! p(tcps_sndwinup, "\t\t%lu window update packet%s\n");
! p(tcps_sndctrl, "\t\t%lu control packet%s\n");
! p(tcps_rcvtotal, "\t%lu packet%s received\n");
! p2(tcps_rcvackpack, tcps_rcvackbyte, "\t\t%lu ack%s (for %lu byte%s)\n");
! p(tcps_rcvdupack, "\t\t%lu duplicate ack%s\n");
! p(tcps_rcvacktoomuch, "\t\t%lu ack%s for unsent data\n");
p2(tcps_rcvpack, tcps_rcvbyte,
! "\t\t%lu packet%s (%lu byte%s) received in-sequence\n");
p2(tcps_rcvduppack, tcps_rcvdupbyte,
! "\t\t%lu completely duplicate packet%s (%lu byte%s)\n");
! p(tcps_pawsdrop, "\t\t%lu old duplicate packet%s\n");
p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte,
! "\t\t%lu packet%s with some dup. data (%lu byte%s duped)\n");
p2(tcps_rcvoopack, tcps_rcvoobyte,
! "\t\t%lu out-of-order packet%s (%lu byte%s)\n");
p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin,
! "\t\t%lu packet%s (%lu byte%s) of data after window\n");
! p(tcps_rcvwinprobe, "\t\t%lu window probe%s\n");
! p(tcps_rcvwinupd, "\t\t%lu window update packet%s\n");
! p(tcps_rcvafterclose, "\t\t%lu packet%s received after close\n");
! p(tcps_rcvbadsum, "\t\t%lu discarded for bad checksum%s\n");
! p(tcps_rcvbadoff, "\t\t%lu discarded for bad header offset field%s\n");
! ps(tcps_rcvshort, "\t\t%lu discarded because packet too short\n");
! p(tcps_connattempt, "\t%lu connection request%s\n");
! p(tcps_accepts, "\t%lu connection accept%s\n");
! p(tcps_connects, "\t%lu connection%s established (including accepts)\n");
p2(tcps_closed, tcps_drops,
! "\t%lu connection%s closed (including %lu drop%s)\n");
! p(tcps_conndrops, "\t%lu embryonic connection%s dropped\n");
p2(tcps_rttupdated, tcps_segstimed,
! "\t%lu segment%s updated rtt (of %lu attempt%s)\n");
! p(tcps_rexmttimeo, "\t%lu retransmit timeout%s\n");
! p(tcps_timeoutdrop, "\t\t%lu connection%s dropped by rexmit timeout\n");
p2(tcps_persisttimeo, tcps_persistdrops,
! "\t%lu persist timeout%s (resulting in %lu dropped connection%s)\n");
! p(tcps_keeptimeo, "\t%lu keepalive timeout%s\n");
! p(tcps_keepprobe, "\t\t%lu keepalive probe%s sent\n");
! p(tcps_keepdrops, "\t\t%lu connection%s dropped by keepalive\n");
! p(tcps_predack, "\t%lu correct ACK header prediction%s\n");
! p(tcps_preddat, "\t%lu correct data packet header prediction%s\n");
! p3(tcps_pcbhashmiss, "\t%lu PCB hash miss%s\n");
! ps(tcps_noport, "\t%lu dropped due to no socket\n");
! p(tcps_connsdrained, "\t%lu connection%s drained due to memory shortage\n");
!
! p(tcps_badsyn, "\t%lu bad connection attempt%s\n");
! ps(tcps_sc_added, "\t%lu SYN cache entries added\n");
! p(tcps_sc_collisions, "\t\t%lu hash collision%s\n");
! ps(tcps_sc_completed, "\t\t%lu completed\n");
! ps(tcps_sc_aborted, "\t\t%lu aborted (no space to build PCB)\n");
! ps(tcps_sc_timed_out, "\t\t%lu timed out\n");
! ps(tcps_sc_overflowed, "\t\t%lu dropped due to overflow\n");
! ps(tcps_sc_bucketoverflow, "\t\t%lu dropped due to bucket overflow\n");
! ps(tcps_sc_reset, "\t\t%lu dropped due to RST\n");
! ps(tcps_sc_unreach, "\t\t%lu dropped due to ICMP unreachable\n");
! p(tcps_sc_retransmitted, "\t%lu SYN,ACK%s retransmitted\n");
! p(tcps_sc_dupesyn, "\t%lu duplicate SYN%s received for entries already in the cache\n");
! p(tcps_sc_dropped, "\t%lu SYN%s dropped (no route or no space)\n");
#undef p
#undef ps
--- 214,285 ----
#define p3(f, m) if (tcpstat.f || sflag <= 1) \
printf(m, tcpstat.f, plurales(tcpstat.f))
! p(tcps_sndtotal, "\t%qu packet%s sent\n");
p2(tcps_sndpack,tcps_sndbyte,
! "\t\t%qu data packet%s (%qu byte%s)\n");
p2(tcps_sndrexmitpack, tcps_sndrexmitbyte,
! "\t\t%qu data packet%s (%qu byte%s) retransmitted\n");
p2s(tcps_sndacks, tcps_delack,
! "\t\t%qu ack-only packet%s (%qu delayed)\n");
! p(tcps_sndurg, "\t\t%qu URG only packet%s\n");
! p(tcps_sndprobe, "\t\t%qu window probe packet%s\n");
! p(tcps_sndwinup, "\t\t%qu window update packet%s\n");
! p(tcps_sndctrl, "\t\t%qu control packet%s\n");
! p(tcps_rcvtotal, "\t%qu packet%s received\n");
! p2(tcps_rcvackpack, tcps_rcvackbyte, "\t\t%qu ack%s (for %qu byte%s)\n");
! p(tcps_rcvdupack, "\t\t%qu duplicate ack%s\n");
! p(tcps_rcvacktoomuch, "\t\t%qu ack%s for unsent data\n");
p2(tcps_rcvpack, tcps_rcvbyte,
! "\t\t%qu packet%s (%qu byte%s) received in-sequence\n");
p2(tcps_rcvduppack, tcps_rcvdupbyte,
! "\t\t%qu completely duplicate packet%s (%qu byte%s)\n");
! p(tcps_pawsdrop, "\t\t%qu old duplicate packet%s\n");
p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte,
! "\t\t%qu packet%s with some dup. data (%qu byte%s duped)\n");
p2(tcps_rcvoopack, tcps_rcvoobyte,
! "\t\t%qu out-of-order packet%s (%qu byte%s)\n");
p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin,
! "\t\t%qu packet%s (%qu byte%s) of data after window\n");
! p(tcps_rcvwinprobe, "\t\t%qu window probe%s\n");
! p(tcps_rcvwinupd, "\t\t%qu window update packet%s\n");
! p(tcps_rcvafterclose, "\t\t%qu packet%s received after close\n");
! p(tcps_rcvbadsum, "\t\t%qu discarded for bad checksum%s\n");
! p(tcps_rcvbadoff, "\t\t%qu discarded for bad header offset field%s\n");
! ps(tcps_rcvshort, "\t\t%qu discarded because packet too short\n");
! p(tcps_connattempt, "\t%qu connection request%s\n");
! p(tcps_accepts, "\t%qu connection accept%s\n");
! p(tcps_connects, "\t%qu connection%s established (including accepts)\n");
p2(tcps_closed, tcps_drops,
! "\t%qu connection%s closed (including %qu drop%s)\n");
! p(tcps_conndrops, "\t%qu embryonic connection%s dropped\n");
p2(tcps_rttupdated, tcps_segstimed,
! "\t%qu segment%s updated rtt (of %qu attempt%s)\n");
! p(tcps_rexmttimeo, "\t%qu retransmit timeout%s\n");
! p(tcps_timeoutdrop, "\t\t%qu connection%s dropped by rexmit timeout\n");
p2(tcps_persisttimeo, tcps_persistdrops,
! "\t%qu persist timeout%s (resulting in %qu dropped connection%s)\n");
! p(tcps_keeptimeo, "\t%qu keepalive timeout%s\n");
! p(tcps_keepprobe, "\t\t%qu keepalive probe%s sent\n");
! p(tcps_keepdrops, "\t\t%qu connection%s dropped by keepalive\n");
! p(tcps_predack, "\t%qu correct ACK header prediction%s\n");
! p(tcps_preddat, "\t%qu correct data packet header prediction%s\n");
! p3(tcps_pcbhashmiss, "\t%qu PCB hash miss%s\n");
! ps(tcps_noport, "\t%qu dropped due to no socket\n");
! p(tcps_connsdrained, "\t%qu connection%s drained due to memory shortage\n");
!
! p(tcps_badsyn, "\t%qu bad connection attempt%s\n");
! ps(tcps_sc_added, "\t%qu SYN cache entries added\n");
! p(tcps_sc_collisions, "\t\t%qu hash collision%s\n");
! ps(tcps_sc_completed, "\t\t%qu completed\n");
! ps(tcps_sc_aborted, "\t\t%qu aborted (no space to build PCB)\n");
! ps(tcps_sc_timed_out, "\t\t%qu timed out\n");
! ps(tcps_sc_overflowed, "\t\t%qu dropped due to overflow\n");
! ps(tcps_sc_bucketoverflow, "\t\t%qu dropped due to bucket overflow\n");
! ps(tcps_sc_reset, "\t\t%qu dropped due to RST\n");
! ps(tcps_sc_unreach, "\t\t%qu dropped due to ICMP unreachable\n");
! p(tcps_sc_retransmitted, "\t%qu SYN,ACK%s retransmitted\n");
! p(tcps_sc_dupesyn, "\t%qu duplicate SYN%s received for entries already in the cache\n");
! p(tcps_sc_dropped, "\t%qu SYN%s dropped (no route or no space)\n");
#undef p
#undef ps
***************
*** 311,323 ****
#define p3(f, m) if (udpstat.f || sflag <= 1) \
printf(m, udpstat.f, plurales(udpstat.f))
! p(udps_ipackets, "\t%lu datagram%s received\n");
! ps(udps_hdrops, "\t%lu with incomplete header\n");
! ps(udps_badlen, "\t%lu with bad data length field\n");
! ps(udps_badsum, "\t%lu with bad checksum\n");
! ps(udps_noport, "\t%lu dropped due to no socket\n");
! p(udps_noportbcast, "\t%lu broadcast/multicast datagram%s dropped due to no socket\n");
! ps(udps_fullsock, "\t%lu dropped due to full socket buffers\n");
delivered = udpstat.udps_ipackets -
udpstat.udps_hdrops -
udpstat.udps_badlen -
--- 311,323 ----
#define p3(f, m) if (udpstat.f || sflag <= 1) \
printf(m, udpstat.f, plurales(udpstat.f))
! p(udps_ipackets, "\t%qu datagram%s received\n");
! ps(udps_hdrops, "\t%qu with incomplete header\n");
! ps(udps_badlen, "\t%qu with bad data length field\n");
! ps(udps_badsum, "\t%qu with bad checksum\n");
! ps(udps_noport, "\t%qu dropped due to no socket\n");
! p(udps_noportbcast, "\t%qu broadcast/multicast datagram%s dropped due to no socket\n");
! ps(udps_fullsock, "\t%qu dropped due to full socket buffers\n");
delivered = udpstat.udps_ipackets -
udpstat.udps_hdrops -
udpstat.udps_badlen -
***************
*** 326,334 ****
udpstat.udps_noportbcast -
udpstat.udps_fullsock;
if (delivered || sflag <= 1)
! printf("\t%lu delivered\n", delivered);
! p3(udps_pcbhashmiss, "\t%lu PCB hash miss%s\n");
! p(udps_opackets, "\t%lu datagram%s output\n");
#undef ps
#undef p
--- 326,334 ----
udpstat.udps_noportbcast -
udpstat.udps_fullsock;
if (delivered || sflag <= 1)
! printf("\t%qu delivered\n", delivered);
! p3(udps_pcbhashmiss, "\t%qu PCB hash miss%s\n");
! p(udps_opackets, "\t%qu datagram%s output\n");
#undef ps
#undef p
***************
*** 355,389 ****
#define p(f, m) if (ipstat.f || sflag <= 1) \
printf(m, ipstat.f, plural(ipstat.f))
! p(ips_total, "\t%lu total packet%s received\n");
! p(ips_badsum, "\t%lu bad header checksum%s\n");
! ps(ips_toosmall, "\t%lu with size smaller than minimum\n");
! ps(ips_tooshort, "\t%lu with data size < data length\n");
! ps(ips_toolong, "\t%lu with length > max ip packet size\n");
! ps(ips_badhlen, "\t%lu with header length < data size\n");
! ps(ips_badlen, "\t%lu with data length < header length\n");
! ps(ips_badoptions, "\t%lu with bad options\n");
! ps(ips_badvers, "\t%lu with incorrect version number\n");
! p(ips_fragments, "\t%lu fragment%s received");
! p(ips_fragdropped, "\t%lu fragment%s dropped (dup or out of space)\n");
! p(ips_badfrags, "\t%lu malformed fragment%s dropped\n");
! p(ips_fragtimeout, "\t%lu fragment%s dropped after timeout\n");
! p(ips_reassembled, "\t%lu packet%s reassembled ok\n");
! p(ips_delivered, "\t%lu packet%s for this host\n");
! p(ips_noproto, "\t%lu packet%s for unknown/unsupported protocol\n");
! p(ips_forward, "\t%lu packet%s forwarded");
! p(ips_fastforward, " (%lu packet%s fast forwarded)");
if (ipstat.ips_forward || sflag <= 1)
putchar('\n');
! p(ips_cantforward, "\t%lu packet%s not forwardable\n");
! p(ips_redirectsent, "\t%lu redirect%s sent\n");
! p(ips_localout, "\t%lu packet%s sent from this host\n");
! p(ips_rawout, "\t%lu packet%s sent with fabricated ip header\n");
! p(ips_odropped, "\t%lu output packet%s dropped due to no bufs, etc.\n");
! p(ips_noroute, "\t%lu output packet%s discarded due to no route\n");
! p(ips_fragmented, "\t%lu output datagram%s fragmented\n");
! p(ips_ofragments, "\t%lu fragment%s created\n");
! p(ips_cantfrag, "\t%lu datagram%s that can't be fragmented\n");
#undef ps
#undef p
}
--- 355,389 ----
#define p(f, m) if (ipstat.f || sflag <= 1) \
printf(m, ipstat.f, plural(ipstat.f))
! p(ips_total, "\t%qu total packet%s received\n");
! p(ips_badsum, "\t%qu bad header checksum%s\n");
! ps(ips_toosmall, "\t%qu with size smaller than minimum\n");
! ps(ips_tooshort, "\t%qu with data size < data length\n");
! ps(ips_toolong, "\t%qu with length > max ip packet size\n");
! ps(ips_badhlen, "\t%qu with header length < data size\n");
! ps(ips_badlen, "\t%qu with data length < header length\n");
! ps(ips_badoptions, "\t%qu with bad options\n");
! ps(ips_badvers, "\t%qu with incorrect version number\n");
! p(ips_fragments, "\t%qu fragment%s received");
! p(ips_fragdropped, "\t%qu fragment%s dropped (dup or out of space)\n");
! p(ips_badfrags, "\t%qu malformed fragment%s dropped\n");
! p(ips_fragtimeout, "\t%qu fragment%s dropped after timeout\n");
! p(ips_reassembled, "\t%qu packet%s reassembled ok\n");
! p(ips_delivered, "\t%qu packet%s for this host\n");
! p(ips_noproto, "\t%qu packet%s for unknown/unsupported protocol\n");
! p(ips_forward, "\t%qu packet%s forwarded");
! p(ips_fastforward, " (%qu packet%s fast forwarded)");
if (ipstat.ips_forward || sflag <= 1)
putchar('\n');
! p(ips_cantforward, "\t%qu packet%s not forwardable\n");
! p(ips_redirectsent, "\t%qu redirect%s sent\n");
! p(ips_localout, "\t%qu packet%s sent from this host\n");
! p(ips_rawout, "\t%qu packet%s sent with fabricated ip header\n");
! p(ips_odropped, "\t%qu output packet%s dropped due to no bufs, etc.\n");
! p(ips_noroute, "\t%qu output packet%s discarded due to no route\n");
! p(ips_fragmented, "\t%qu output datagram%s fragmented\n");
! p(ips_ofragments, "\t%qu fragment%s created\n");
! p(ips_cantfrag, "\t%qu datagram%s that can't be fragmented\n");
#undef ps
#undef p
}
***************
*** 429,460 ****
#define p(f, m) if (icmpstat.f || sflag <= 1) \
printf(m, icmpstat.f, plural(icmpstat.f))
! p(icps_error, "\t%lu call%s to icmp_error\n");
p(icps_oldicmp,
! "\t%lu error%s not generated because old message was icmp\n");
for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++)
if (icmpstat.icps_outhist[i] != 0) {
if (first) {
printf("\tOutput histogram:\n");
first = 0;
}
! printf("\t\t%s: %lu\n", icmpnames[i],
icmpstat.icps_outhist[i]);
}
! p(icps_badcode, "\t%lu message%s with bad code fields\n");
! p(icps_tooshort, "\t%lu message%s < minimum length\n");
! p(icps_checksum, "\t%lu bad checksum%s\n");
! p(icps_badlen, "\t%lu message%s with bad length\n");
for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++)
if (icmpstat.icps_inhist[i] != 0) {
if (first) {
printf("\tInput histogram:\n");
first = 0;
}
! printf("\t\t%s: %lu\n", icmpnames[i],
icmpstat.icps_inhist[i]);
}
! p(icps_reflect, "\t%lu message response%s generated\n");
#undef p
}
--- 429,460 ----
#define p(f, m) if (icmpstat.f || sflag <= 1) \
printf(m, icmpstat.f, plural(icmpstat.f))
! p(icps_error, "\t%qu call%s to icmp_error\n");
p(icps_oldicmp,
! "\t%qu error%s not generated because old message was icmp\n");
for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++)
if (icmpstat.icps_outhist[i] != 0) {
if (first) {
printf("\tOutput histogram:\n");
first = 0;
}
! printf("\t\t%s: %qu\n", icmpnames[i],
icmpstat.icps_outhist[i]);
}
! p(icps_badcode, "\t%qu message%s with bad code fields\n");
! p(icps_tooshort, "\t%qu message%s < minimum length\n");
! p(icps_checksum, "\t%qu bad checksum%s\n");
! p(icps_badlen, "\t%qu message%s with bad length\n");
for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++)
if (icmpstat.icps_inhist[i] != 0) {
if (first) {
printf("\tInput histogram:\n");
first = 0;
}
! printf("\t\t%s: %qu\n", icmpnames[i],
icmpstat.icps_inhist[i]);
}
! p(icps_reflect, "\t%qu message response%s generated\n");
#undef p
}
***************
*** 477,491 ****
printf(m, igmpstat.f, plural(igmpstat.f))
#define py(f, m) if (igmpstat.f || sflag <= 1) \
printf(m, igmpstat.f, igmpstat.f != 1 ? "ies" : "y")
! p(igps_rcv_total, "\t%lu message%s received\n");
! p(igps_rcv_tooshort, "\t%lu message%s received with too few bytes\n");
! p(igps_rcv_badsum, "\t%lu message%s received with bad checksum\n");
! py(igps_rcv_queries, "\t%lu membership quer%s received\n");
! py(igps_rcv_badqueries, "\t%lu membership quer%s received with invalid field(s)\n");
! p(igps_rcv_reports, "\t%lu membership report%s received\n");
! p(igps_rcv_badreports, "\t%lu membership report%s received with invalid field(s)\n");
! p(igps_rcv_ourreports, "\t%lu membership report%s received for groups to which we belong\n");
! p(igps_snd_reports, "\t%lu membership report%s sent\n");
#undef p
#undef py
}
--- 477,491 ----
printf(m, igmpstat.f, plural(igmpstat.f))
#define py(f, m) if (igmpstat.f || sflag <= 1) \
printf(m, igmpstat.f, igmpstat.f != 1 ? "ies" : "y")
! p(igps_rcv_total, "\t%qu message%s received\n");
! p(igps_rcv_tooshort, "\t%qu message%s received with too few bytes\n");
! p(igps_rcv_badsum, "\t%qu message%s received with bad checksum\n");
! py(igps_rcv_queries, "\t%qu membership quer%s received\n");
! py(igps_rcv_badqueries, "\t%qu membership quer%s received with invalid field(s)\n");
! p(igps_rcv_reports, "\t%qu membership report%s received\n");
! p(igps_rcv_badreports, "\t%qu membership report%s received with invalid field(s)\n");
! p(igps_rcv_ourreports, "\t%qu membership report%s received for groups to which we belong\n");
! p(igps_snd_reports, "\t%qu membership report%s sent\n");
#undef p
#undef py
}
***************
*** 614,630 ****
printf("snd_una %u, snd_nxt %u, snd_up %u\n",
tcpcb.snd_una, tcpcb.snd_nxt, tcpcb.snd_up);
! printf("snd_wl1 %u, snd_wl2 %u, iss %u, snd_wnd %lu\n\n",
tcpcb.snd_wl1, tcpcb.snd_wl2, tcpcb.iss, tcpcb.snd_wnd);
! printf("rcv_wnd %lu, rcv_nxt %u, rcv_up %u, irs %u\n\n",
tcpcb.rcv_wnd, tcpcb.rcv_nxt, tcpcb.rcv_up, tcpcb.irs);
! printf("rcv_adv %u, snd_max %u, snd_cwnd %lu, snd_ssthresh %lu\n",
tcpcb.rcv_adv, tcpcb.snd_max, tcpcb.snd_cwnd, tcpcb.snd_ssthresh);
printf("idle %d, rtt %d, rtseq %u, srtt %d, rttvar %d, rttmin %d, "
! "max_sndwnd %lu\n\n", tcpcb.t_idle, tcpcb.t_rtt, tcpcb.t_rtseq,
tcpcb.t_srtt, tcpcb.t_rttvar, tcpcb.t_rttmin, tcpcb.max_sndwnd);
printf("oobflags %d, iobc %d, softerror %d\n\n", tcpcb.t_oobflags,
--- 614,630 ----
printf("snd_una %u, snd_nxt %u, snd_up %u\n",
tcpcb.snd_una, tcpcb.snd_nxt, tcpcb.snd_up);
! printf("snd_wl1 %u, snd_wl2 %u, iss %u, snd_wnd %qu\n\n",
tcpcb.snd_wl1, tcpcb.snd_wl2, tcpcb.iss, tcpcb.snd_wnd);
! printf("rcv_wnd %qu, rcv_nxt %u, rcv_up %u, irs %u\n\n",
tcpcb.rcv_wnd, tcpcb.rcv_nxt, tcpcb.rcv_up, tcpcb.irs);
! printf("rcv_adv %u, snd_max %u, snd_cwnd %qu, snd_ssthresh %qu\n",
tcpcb.rcv_adv, tcpcb.snd_max, tcpcb.snd_cwnd, tcpcb.snd_ssthresh);
printf("idle %d, rtt %d, rtseq %u, srtt %d, rttvar %d, rttmin %d, "
! "max_sndwnd %qu\n\n", tcpcb.t_idle, tcpcb.t_rtt, tcpcb.t_rtseq,
tcpcb.t_srtt, tcpcb.t_rttvar, tcpcb.t_rttmin, tcpcb.max_sndwnd);
printf("oobflags %d, iobc %d, softerror %d\n\n", tcpcb.t_oobflags,