Home | History | Annotate | Line # | Download | only in netstat
inet.c revision 1.37
      1  1.37    itojun /*	$NetBSD: inet.c,v 1.37 1999/07/01 18:40:35 itojun Exp $	*/
      2  1.14   thorpej 
      3   1.1       cgd /*
      4   1.9   mycroft  * Copyright (c) 1983, 1988, 1993
      5   1.9   mycroft  *	The Regents of the University of California.  All rights reserved.
      6   1.1       cgd  *
      7   1.1       cgd  * Redistribution and use in source and binary forms, with or without
      8   1.1       cgd  * modification, are permitted provided that the following conditions
      9   1.1       cgd  * are met:
     10   1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     11   1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     12   1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     14   1.1       cgd  *    documentation and/or other materials provided with the distribution.
     15   1.1       cgd  * 3. All advertising materials mentioning features or use of this software
     16   1.1       cgd  *    must display the following acknowledgement:
     17   1.1       cgd  *	This product includes software developed by the University of
     18   1.1       cgd  *	California, Berkeley and its contributors.
     19   1.1       cgd  * 4. Neither the name of the University nor the names of its contributors
     20   1.1       cgd  *    may be used to endorse or promote products derived from this software
     21   1.1       cgd  *    without specific prior written permission.
     22   1.1       cgd  *
     23   1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24   1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25   1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26   1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27   1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28   1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29   1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30   1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31   1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32   1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33   1.1       cgd  * SUCH DAMAGE.
     34   1.1       cgd  */
     35   1.1       cgd 
     36  1.23     lukem #include <sys/cdefs.h>
     37   1.1       cgd #ifndef lint
     38  1.14   thorpej #if 0
     39  1.14   thorpej static char sccsid[] = "from: @(#)inet.c	8.4 (Berkeley) 4/20/94";
     40  1.14   thorpej #else
     41  1.37    itojun __RCSID("$NetBSD: inet.c,v 1.37 1999/07/01 18:40:35 itojun Exp $");
     42  1.14   thorpej #endif
     43   1.1       cgd #endif /* not lint */
     44   1.1       cgd 
     45   1.1       cgd #include <sys/param.h>
     46  1.10       cgd #include <sys/queue.h>
     47   1.1       cgd #include <sys/socket.h>
     48   1.1       cgd #include <sys/socketvar.h>
     49   1.1       cgd #include <sys/mbuf.h>
     50   1.1       cgd #include <sys/protosw.h>
     51   1.1       cgd 
     52   1.1       cgd #include <net/route.h>
     53   1.1       cgd #include <netinet/in.h>
     54   1.1       cgd #include <netinet/in_systm.h>
     55   1.1       cgd #include <netinet/ip.h>
     56   1.1       cgd #include <netinet/in_pcb.h>
     57   1.1       cgd #include <netinet/ip_icmp.h>
     58  1.37    itojun 
     59  1.37    itojun #ifdef INET6
     60  1.37    itojun #include <netinet/ip6.h>
     61  1.37    itojun #endif
     62  1.37    itojun 
     63   1.1       cgd #include <netinet/icmp_var.h>
     64   1.6    brezak #include <netinet/igmp_var.h>
     65   1.1       cgd #include <netinet/ip_var.h>
     66   1.1       cgd #include <netinet/tcp.h>
     67   1.1       cgd #include <netinet/tcpip.h>
     68   1.1       cgd #include <netinet/tcp_seq.h>
     69   1.1       cgd #define TCPSTATES
     70   1.1       cgd #include <netinet/tcp_fsm.h>
     71  1.30   thorpej #define	TCPTIMERS
     72   1.1       cgd #include <netinet/tcp_timer.h>
     73   1.1       cgd #include <netinet/tcp_var.h>
     74   1.1       cgd #include <netinet/tcp_debug.h>
     75   1.1       cgd #include <netinet/udp.h>
     76   1.1       cgd #include <netinet/udp_var.h>
     77  1.37    itojun #ifdef IPSEC
     78  1.37    itojun #include <netinet6/ipsec.h>
     79  1.37    itojun #endif
     80   1.1       cgd 
     81   1.9   mycroft #include <arpa/inet.h>
     82   1.1       cgd #include <netdb.h>
     83   1.1       cgd #include <stdio.h>
     84   1.1       cgd #include <string.h>
     85   1.9   mycroft #include <unistd.h>
     86   1.9   mycroft #include "netstat.h"
     87   1.1       cgd 
     88   1.1       cgd struct	inpcb inpcb;
     89   1.1       cgd struct	tcpcb tcpcb;
     90   1.1       cgd struct	socket sockb;
     91   1.1       cgd 
     92   1.9   mycroft char	*inetname __P((struct in_addr *));
     93  1.28     lukem void	inetprint __P((struct in_addr *, u_int16_t, const char *, int));
     94   1.1       cgd 
     95   1.1       cgd /*
     96   1.1       cgd  * Print a summary of connections related to an Internet
     97   1.1       cgd  * protocol.  For TCP, also give state of connection.
     98   1.1       cgd  * Listening processes (aflag) are suppressed unless the
     99   1.1       cgd  * -a (all) flag is specified.
    100   1.1       cgd  */
    101  1.35     lukem static int width;
    102  1.35     lukem 
    103   1.9   mycroft void
    104   1.1       cgd protopr(off, name)
    105   1.8       cgd 	u_long off;
    106   1.1       cgd 	char *name;
    107   1.1       cgd {
    108  1.12   mycroft 	struct inpcbtable table;
    109  1.23     lukem 	struct inpcb *head, *next, *prev;
    110  1.13       cgd 	struct inpcb inpcb;
    111  1.35     lukem 	int istcp, compact;
    112   1.1       cgd 	static int first = 1;
    113  1.35     lukem 	static char *shorttcpstates[] = {
    114  1.35     lukem 		"CLOSED",	"LISTEN",	"SYNSEN",	"SYSRCV",
    115  1.35     lukem 		"ESTABL",	"CLWAIT",	"FWAIT1",	"CLOSNG",
    116  1.35     lukem 		"LASTAK",	"FWAIT2",	"TMWAIT",
    117  1.35     lukem 	};
    118   1.1       cgd 
    119   1.1       cgd 	if (off == 0)
    120   1.1       cgd 		return;
    121   1.1       cgd 	istcp = strcmp(name, "tcp") == 0;
    122  1.12   mycroft 	kread(off, (char *)&table, sizeof table);
    123  1.13       cgd 	prev = head =
    124  1.13       cgd 	    (struct inpcb *)&((struct inpcbtable *)off)->inpt_queue.cqh_first;
    125  1.13       cgd 	next = table.inpt_queue.cqh_first;
    126  1.13       cgd 
    127  1.35     lukem 	compact = 0;
    128  1.35     lukem 	if (Aflag) {
    129  1.35     lukem 		if (!nflag)
    130  1.35     lukem 			width = 18;
    131  1.35     lukem 		else {
    132  1.35     lukem 			width = 21;
    133  1.35     lukem 			compact = 1;
    134  1.35     lukem 		}
    135  1.35     lukem 	} else
    136  1.35     lukem 		width = 22;
    137  1.13       cgd 	while (next != head) {
    138  1.12   mycroft 		kread((u_long)next, (char *)&inpcb, sizeof inpcb);
    139  1.13       cgd 		if (inpcb.inp_queue.cqe_prev != prev) {
    140   1.1       cgd 			printf("???\n");
    141   1.1       cgd 			break;
    142   1.1       cgd 		}
    143  1.13       cgd 		prev = next;
    144  1.13       cgd 		next = inpcb.inp_queue.cqe_next;
    145  1.13       cgd 
    146   1.1       cgd 		if (!aflag &&
    147  1.12   mycroft 		    inet_lnaof(inpcb.inp_laddr) == INADDR_ANY)
    148   1.1       cgd 			continue;
    149   1.9   mycroft 		kread((u_long)inpcb.inp_socket, (char *)&sockb, sizeof (sockb));
    150   1.1       cgd 		if (istcp) {
    151   1.9   mycroft 			kread((u_long)inpcb.inp_ppcb,
    152   1.9   mycroft 			    (char *)&tcpcb, sizeof (tcpcb));
    153   1.1       cgd 		}
    154   1.1       cgd 		if (first) {
    155   1.1       cgd 			printf("Active Internet connections");
    156   1.1       cgd 			if (aflag)
    157   1.1       cgd 				printf(" (including servers)");
    158   1.1       cgd 			putchar('\n');
    159   1.1       cgd 			if (Aflag)
    160   1.1       cgd 				printf("%-8.8s ", "PCB");
    161  1.35     lukem 			printf("%-5.5s %-6.6s %-6.6s %s%-*.*s %-*.*s %s\n",
    162   1.1       cgd 				"Proto", "Recv-Q", "Send-Q",
    163  1.35     lukem 				compact ? "" : " ",
    164  1.35     lukem 				width, width, "Local Address",
    165  1.35     lukem 				width, width, "Foreign Address", "State");
    166   1.1       cgd 			first = 0;
    167   1.1       cgd 		}
    168  1.34      ross 		if (Aflag) {
    169   1.1       cgd 			if (istcp)
    170  1.21  christos 				printf("%8lx ", (u_long) inpcb.inp_ppcb);
    171   1.1       cgd 			else
    172  1.21  christos 				printf("%8lx ", (u_long) prev);
    173  1.34      ross 		}
    174  1.35     lukem 		printf("%-5.5s %6ld %6ld%s", name, sockb.so_rcv.sb_cc,
    175  1.35     lukem 			sockb.so_snd.sb_cc, compact ? "" : " ");
    176  1.28     lukem 		if (nflag) {
    177  1.28     lukem 			inetprint(&inpcb.inp_laddr, inpcb.inp_lport, name, 1);
    178  1.28     lukem 			inetprint(&inpcb.inp_faddr, inpcb.inp_fport, name, 1);
    179  1.28     lukem 		} else if (inpcb.inp_flags & INP_ANONPORT) {
    180  1.28     lukem 			inetprint(&inpcb.inp_laddr, inpcb.inp_lport, name, 1);
    181  1.28     lukem 			inetprint(&inpcb.inp_faddr, inpcb.inp_fport, name, 0);
    182  1.28     lukem 		} else {
    183  1.28     lukem 			inetprint(&inpcb.inp_laddr, inpcb.inp_lport, name, 0);
    184  1.28     lukem 			inetprint(&inpcb.inp_faddr, inpcb.inp_fport, name,
    185  1.28     lukem 			    inpcb.inp_lport != inpcb.inp_fport);
    186  1.28     lukem 		}
    187   1.1       cgd 		if (istcp) {
    188   1.1       cgd 			if (tcpcb.t_state < 0 || tcpcb.t_state >= TCP_NSTATES)
    189   1.1       cgd 				printf(" %d", tcpcb.t_state);
    190   1.1       cgd 			else
    191  1.35     lukem 				printf(" %s", compact ?
    192  1.35     lukem 				    shorttcpstates[tcpcb.t_state] :
    193  1.35     lukem 				    tcpstates[tcpcb.t_state]);
    194   1.1       cgd 		}
    195   1.1       cgd 		putchar('\n');
    196   1.1       cgd 	}
    197   1.1       cgd }
    198   1.1       cgd 
    199   1.1       cgd /*
    200   1.1       cgd  * Dump TCP statistics structure.
    201   1.1       cgd  */
    202   1.9   mycroft void
    203   1.1       cgd tcp_stats(off, name)
    204   1.8       cgd 	u_long off;
    205   1.1       cgd 	char *name;
    206   1.1       cgd {
    207   1.1       cgd 	struct tcpstat tcpstat;
    208   1.1       cgd 
    209   1.1       cgd 	if (off == 0)
    210   1.1       cgd 		return;
    211   1.1       cgd 	printf ("%s:\n", name);
    212   1.9   mycroft 	kread(off, (char *)&tcpstat, sizeof (tcpstat));
    213   1.9   mycroft 
    214  1.20  christos #define	ps(f, m) if (tcpstat.f || sflag <= 1) \
    215  1.20  christos     printf(m, tcpstat.f)
    216   1.9   mycroft #define	p(f, m) if (tcpstat.f || sflag <= 1) \
    217   1.9   mycroft     printf(m, tcpstat.f, plural(tcpstat.f))
    218   1.9   mycroft #define	p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \
    219   1.9   mycroft     printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2, plural(tcpstat.f2))
    220  1.20  christos #define	p2s(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \
    221  1.20  christos     printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2)
    222   1.9   mycroft #define	p3(f, m) if (tcpstat.f || sflag <= 1) \
    223   1.9   mycroft     printf(m, tcpstat.f, plurales(tcpstat.f))
    224   1.1       cgd 
    225  1.17  explorer 	p(tcps_sndtotal, "\t%lu packet%s sent\n");
    226   1.1       cgd 	p2(tcps_sndpack,tcps_sndbyte,
    227  1.17  explorer 		"\t\t%lu data packet%s (%lu byte%s)\n");
    228   1.1       cgd 	p2(tcps_sndrexmitpack, tcps_sndrexmitbyte,
    229  1.17  explorer 		"\t\t%lu data packet%s (%lu byte%s) retransmitted\n");
    230  1.20  christos 	p2s(tcps_sndacks, tcps_delack,
    231  1.17  explorer 		"\t\t%lu ack-only packet%s (%lu delayed)\n");
    232  1.17  explorer 	p(tcps_sndurg, "\t\t%lu URG only packet%s\n");
    233  1.17  explorer 	p(tcps_sndprobe, "\t\t%lu window probe packet%s\n");
    234  1.17  explorer 	p(tcps_sndwinup, "\t\t%lu window update packet%s\n");
    235  1.17  explorer 	p(tcps_sndctrl, "\t\t%lu control packet%s\n");
    236  1.17  explorer 	p(tcps_rcvtotal, "\t%lu packet%s received\n");
    237  1.17  explorer 	p2(tcps_rcvackpack, tcps_rcvackbyte, "\t\t%lu ack%s (for %lu byte%s)\n");
    238  1.17  explorer 	p(tcps_rcvdupack, "\t\t%lu duplicate ack%s\n");
    239  1.17  explorer 	p(tcps_rcvacktoomuch, "\t\t%lu ack%s for unsent data\n");
    240   1.1       cgd 	p2(tcps_rcvpack, tcps_rcvbyte,
    241  1.17  explorer 		"\t\t%lu packet%s (%lu byte%s) received in-sequence\n");
    242   1.1       cgd 	p2(tcps_rcvduppack, tcps_rcvdupbyte,
    243  1.17  explorer 		"\t\t%lu completely duplicate packet%s (%lu byte%s)\n");
    244  1.17  explorer 	p(tcps_pawsdrop, "\t\t%lu old duplicate packet%s\n");
    245   1.1       cgd 	p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte,
    246  1.17  explorer 		"\t\t%lu packet%s with some dup. data (%lu byte%s duped)\n");
    247   1.1       cgd 	p2(tcps_rcvoopack, tcps_rcvoobyte,
    248  1.17  explorer 		"\t\t%lu out-of-order packet%s (%lu byte%s)\n");
    249   1.1       cgd 	p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin,
    250  1.17  explorer 		"\t\t%lu packet%s (%lu byte%s) of data after window\n");
    251  1.17  explorer 	p(tcps_rcvwinprobe, "\t\t%lu window probe%s\n");
    252  1.17  explorer 	p(tcps_rcvwinupd, "\t\t%lu window update packet%s\n");
    253  1.17  explorer 	p(tcps_rcvafterclose, "\t\t%lu packet%s received after close\n");
    254  1.17  explorer 	p(tcps_rcvbadsum, "\t\t%lu discarded for bad checksum%s\n");
    255  1.17  explorer 	p(tcps_rcvbadoff, "\t\t%lu discarded for bad header offset field%s\n");
    256  1.20  christos 	ps(tcps_rcvshort, "\t\t%lu discarded because packet too short\n");
    257  1.17  explorer 	p(tcps_connattempt, "\t%lu connection request%s\n");
    258  1.17  explorer 	p(tcps_accepts, "\t%lu connection accept%s\n");
    259  1.17  explorer 	p(tcps_connects, "\t%lu connection%s established (including accepts)\n");
    260   1.1       cgd 	p2(tcps_closed, tcps_drops,
    261  1.17  explorer 		"\t%lu connection%s closed (including %lu drop%s)\n");
    262  1.17  explorer 	p(tcps_conndrops, "\t%lu embryonic connection%s dropped\n");
    263   1.1       cgd 	p2(tcps_rttupdated, tcps_segstimed,
    264  1.17  explorer 		"\t%lu segment%s updated rtt (of %lu attempt%s)\n");
    265  1.17  explorer 	p(tcps_rexmttimeo, "\t%lu retransmit timeout%s\n");
    266  1.17  explorer 	p(tcps_timeoutdrop, "\t\t%lu connection%s dropped by rexmit timeout\n");
    267  1.27   thorpej 	p2(tcps_persisttimeo, tcps_persistdrops,
    268  1.27   thorpej 	   "\t%lu persist timeout%s (resulting in %lu dropped connection%s)\n");
    269  1.17  explorer 	p(tcps_keeptimeo, "\t%lu keepalive timeout%s\n");
    270  1.17  explorer 	p(tcps_keepprobe, "\t\t%lu keepalive probe%s sent\n");
    271  1.17  explorer 	p(tcps_keepdrops, "\t\t%lu connection%s dropped by keepalive\n");
    272  1.17  explorer 	p(tcps_predack, "\t%lu correct ACK header prediction%s\n");
    273  1.17  explorer 	p(tcps_preddat, "\t%lu correct data packet header prediction%s\n");
    274  1.17  explorer 	p3(tcps_pcbhashmiss, "\t%lu PCB hash miss%s\n");
    275  1.20  christos 	ps(tcps_noport, "\t%lu dropped due to no socket\n");
    276  1.24   thorpej 	p(tcps_connsdrained, "\t%lu connection%s drained due to memory shortage\n");
    277  1.22   thorpej 
    278  1.22   thorpej 	p(tcps_badsyn, "\t%lu bad connection attempt%s\n");
    279  1.22   thorpej 	ps(tcps_sc_added, "\t%lu SYN cache entries added\n");
    280  1.22   thorpej 	p(tcps_sc_collisions, "\t\t%lu hash collision%s\n");
    281  1.22   thorpej 	ps(tcps_sc_completed, "\t\t%lu completed\n");
    282  1.22   thorpej 	ps(tcps_sc_aborted, "\t\t%lu aborted (no space to build PCB)\n");
    283  1.22   thorpej 	ps(tcps_sc_timed_out, "\t\t%lu timed out\n");
    284  1.22   thorpej 	ps(tcps_sc_overflowed, "\t\t%lu dropped due to overflow\n");
    285  1.22   thorpej 	ps(tcps_sc_bucketoverflow, "\t\t%lu dropped due to bucket overflow\n");
    286  1.22   thorpej 	ps(tcps_sc_reset, "\t\t%lu dropped due to RST\n");
    287  1.22   thorpej 	ps(tcps_sc_unreach, "\t\t%lu dropped due to ICMP unreachable\n");
    288  1.36   thorpej 	p(tcps_sc_retransmitted, "\t%lu SYN,ACK%s retransmitted\n");
    289  1.22   thorpej 	p(tcps_sc_dupesyn, "\t%lu duplicate SYN%s received for entries already in the cache\n");
    290  1.22   thorpej 	p(tcps_sc_dropped, "\t%lu SYN%s dropped (no route or no space)\n");
    291  1.15   mycroft 
    292   1.1       cgd #undef p
    293  1.20  christos #undef ps
    294   1.1       cgd #undef p2
    295  1.20  christos #undef p2s
    296   1.9   mycroft #undef p3
    297   1.1       cgd }
    298   1.1       cgd 
    299   1.1       cgd /*
    300   1.1       cgd  * Dump UDP statistics structure.
    301   1.1       cgd  */
    302   1.9   mycroft void
    303   1.1       cgd udp_stats(off, name)
    304   1.8       cgd 	u_long off;
    305   1.1       cgd 	char *name;
    306   1.1       cgd {
    307   1.1       cgd 	struct udpstat udpstat;
    308   1.9   mycroft 	u_long delivered;
    309   1.1       cgd 
    310   1.1       cgd 	if (off == 0)
    311   1.1       cgd 		return;
    312  1.15   mycroft 	printf("%s:\n", name);
    313   1.9   mycroft 	kread(off, (char *)&udpstat, sizeof (udpstat));
    314  1.15   mycroft 
    315  1.20  christos #define	ps(f, m) if (udpstat.f || sflag <= 1) \
    316  1.20  christos     printf(m, udpstat.f)
    317   1.9   mycroft #define	p(f, m) if (udpstat.f || sflag <= 1) \
    318   1.9   mycroft     printf(m, udpstat.f, plural(udpstat.f))
    319  1.15   mycroft #define	p3(f, m) if (udpstat.f || sflag <= 1) \
    320  1.15   mycroft     printf(m, udpstat.f, plurales(udpstat.f))
    321  1.15   mycroft 
    322  1.17  explorer 	p(udps_ipackets, "\t%lu datagram%s received\n");
    323  1.20  christos 	ps(udps_hdrops, "\t%lu with incomplete header\n");
    324  1.20  christos 	ps(udps_badlen, "\t%lu with bad data length field\n");
    325  1.20  christos 	ps(udps_badsum, "\t%lu with bad checksum\n");
    326  1.20  christos 	ps(udps_noport, "\t%lu dropped due to no socket\n");
    327  1.17  explorer 	p(udps_noportbcast, "\t%lu broadcast/multicast datagram%s dropped due to no socket\n");
    328  1.20  christos 	ps(udps_fullsock, "\t%lu dropped due to full socket buffers\n");
    329   1.9   mycroft 	delivered = udpstat.udps_ipackets -
    330   1.9   mycroft 		    udpstat.udps_hdrops -
    331   1.9   mycroft 		    udpstat.udps_badlen -
    332   1.9   mycroft 		    udpstat.udps_badsum -
    333   1.9   mycroft 		    udpstat.udps_noport -
    334   1.9   mycroft 		    udpstat.udps_noportbcast -
    335   1.9   mycroft 		    udpstat.udps_fullsock;
    336   1.9   mycroft 	if (delivered || sflag <= 1)
    337  1.17  explorer 		printf("\t%lu delivered\n", delivered);
    338  1.17  explorer 	p3(udps_pcbhashmiss, "\t%lu PCB hash miss%s\n");
    339  1.17  explorer 	p(udps_opackets, "\t%lu datagram%s output\n");
    340  1.15   mycroft 
    341  1.20  christos #undef ps
    342   1.9   mycroft #undef p
    343  1.15   mycroft #undef p3
    344   1.1       cgd }
    345   1.1       cgd 
    346   1.1       cgd /*
    347   1.1       cgd  * Dump IP statistics structure.
    348   1.1       cgd  */
    349   1.9   mycroft void
    350   1.1       cgd ip_stats(off, name)
    351   1.8       cgd 	u_long off;
    352   1.1       cgd 	char *name;
    353   1.1       cgd {
    354   1.1       cgd 	struct ipstat ipstat;
    355   1.1       cgd 
    356   1.1       cgd 	if (off == 0)
    357   1.1       cgd 		return;
    358   1.9   mycroft 	kread(off, (char *)&ipstat, sizeof (ipstat));
    359   1.9   mycroft 	printf("%s:\n", name);
    360   1.9   mycroft 
    361  1.20  christos #define	ps(f, m) if (ipstat.f || sflag <= 1) \
    362  1.20  christos     printf(m, ipstat.f)
    363   1.9   mycroft #define	p(f, m) if (ipstat.f || sflag <= 1) \
    364   1.9   mycroft     printf(m, ipstat.f, plural(ipstat.f))
    365   1.9   mycroft 
    366  1.17  explorer 	p(ips_total, "\t%lu total packet%s received\n");
    367  1.17  explorer 	p(ips_badsum, "\t%lu bad header checksum%s\n");
    368  1.20  christos 	ps(ips_toosmall, "\t%lu with size smaller than minimum\n");
    369  1.20  christos 	ps(ips_tooshort, "\t%lu with data size < data length\n");
    370  1.20  christos 	ps(ips_toolong, "\t%lu with length > max ip packet size\n");
    371  1.20  christos 	ps(ips_badhlen, "\t%lu with header length < data size\n");
    372  1.20  christos 	ps(ips_badlen, "\t%lu with data length < header length\n");
    373  1.20  christos 	ps(ips_badoptions, "\t%lu with bad options\n");
    374  1.20  christos 	ps(ips_badvers, "\t%lu with incorrect version number\n");
    375  1.29      matt 	p(ips_fragments, "\t%lu fragment%s received");
    376  1.17  explorer 	p(ips_fragdropped, "\t%lu fragment%s dropped (dup or out of space)\n");
    377  1.17  explorer 	p(ips_badfrags, "\t%lu malformed fragment%s dropped\n");
    378  1.17  explorer 	p(ips_fragtimeout, "\t%lu fragment%s dropped after timeout\n");
    379  1.17  explorer 	p(ips_reassembled, "\t%lu packet%s reassembled ok\n");
    380  1.17  explorer 	p(ips_delivered, "\t%lu packet%s for this host\n");
    381  1.17  explorer 	p(ips_noproto, "\t%lu packet%s for unknown/unsupported protocol\n");
    382  1.29      matt 	p(ips_forward, "\t%lu packet%s forwarded");
    383  1.29      matt 	p(ips_fastforward, " (%lu packet%s fast forwarded)");
    384  1.29      matt 	if (ipstat.ips_forward || sflag <= 1)
    385  1.29      matt 		putchar('\n');
    386  1.17  explorer 	p(ips_cantforward, "\t%lu packet%s not forwardable\n");
    387  1.17  explorer 	p(ips_redirectsent, "\t%lu redirect%s sent\n");
    388  1.17  explorer 	p(ips_localout, "\t%lu packet%s sent from this host\n");
    389  1.17  explorer 	p(ips_rawout, "\t%lu packet%s sent with fabricated ip header\n");
    390  1.17  explorer 	p(ips_odropped, "\t%lu output packet%s dropped due to no bufs, etc.\n");
    391  1.17  explorer 	p(ips_noroute, "\t%lu output packet%s discarded due to no route\n");
    392  1.17  explorer 	p(ips_fragmented, "\t%lu output datagram%s fragmented\n");
    393  1.17  explorer 	p(ips_ofragments, "\t%lu fragment%s created\n");
    394  1.17  explorer 	p(ips_cantfrag, "\t%lu datagram%s that can't be fragmented\n");
    395  1.20  christos #undef ps
    396   1.9   mycroft #undef p
    397   1.1       cgd }
    398   1.1       cgd 
    399   1.1       cgd static	char *icmpnames[] = {
    400   1.1       cgd 	"echo reply",
    401   1.1       cgd 	"#1",
    402   1.1       cgd 	"#2",
    403   1.1       cgd 	"destination unreachable",
    404   1.1       cgd 	"source quench",
    405   1.1       cgd 	"routing redirect",
    406   1.1       cgd 	"#6",
    407   1.1       cgd 	"#7",
    408   1.1       cgd 	"echo",
    409   1.1       cgd 	"#9",
    410   1.1       cgd 	"#10",
    411   1.1       cgd 	"time exceeded",
    412   1.1       cgd 	"parameter problem",
    413   1.1       cgd 	"time stamp",
    414   1.1       cgd 	"time stamp reply",
    415   1.1       cgd 	"information request",
    416   1.1       cgd 	"information request reply",
    417   1.1       cgd 	"address mask request",
    418   1.1       cgd 	"address mask reply",
    419   1.1       cgd };
    420   1.1       cgd 
    421   1.1       cgd /*
    422   1.1       cgd  * Dump ICMP statistics.
    423   1.1       cgd  */
    424   1.9   mycroft void
    425   1.1       cgd icmp_stats(off, name)
    426   1.8       cgd 	u_long off;
    427   1.1       cgd 	char *name;
    428   1.1       cgd {
    429   1.1       cgd 	struct icmpstat icmpstat;
    430  1.23     lukem 	int i, first;
    431   1.1       cgd 
    432   1.1       cgd 	if (off == 0)
    433   1.1       cgd 		return;
    434   1.9   mycroft 	kread(off, (char *)&icmpstat, sizeof (icmpstat));
    435   1.9   mycroft 	printf("%s:\n", name);
    436   1.9   mycroft 
    437   1.9   mycroft #define	p(f, m) if (icmpstat.f || sflag <= 1) \
    438   1.9   mycroft     printf(m, icmpstat.f, plural(icmpstat.f))
    439   1.9   mycroft 
    440  1.17  explorer 	p(icps_error, "\t%lu call%s to icmp_error\n");
    441   1.9   mycroft 	p(icps_oldicmp,
    442  1.19      neil 	    "\t%lu error%s not generated because old message was icmp\n");
    443   1.1       cgd 	for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++)
    444   1.1       cgd 		if (icmpstat.icps_outhist[i] != 0) {
    445   1.1       cgd 			if (first) {
    446   1.1       cgd 				printf("\tOutput histogram:\n");
    447   1.1       cgd 				first = 0;
    448   1.1       cgd 			}
    449  1.17  explorer 			printf("\t\t%s: %lu\n", icmpnames[i],
    450   1.1       cgd 				icmpstat.icps_outhist[i]);
    451   1.1       cgd 		}
    452  1.17  explorer 	p(icps_badcode, "\t%lu message%s with bad code fields\n");
    453  1.17  explorer 	p(icps_tooshort, "\t%lu message%s < minimum length\n");
    454  1.17  explorer 	p(icps_checksum, "\t%lu bad checksum%s\n");
    455  1.17  explorer 	p(icps_badlen, "\t%lu message%s with bad length\n");
    456   1.1       cgd 	for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++)
    457   1.1       cgd 		if (icmpstat.icps_inhist[i] != 0) {
    458   1.1       cgd 			if (first) {
    459   1.1       cgd 				printf("\tInput histogram:\n");
    460   1.1       cgd 				first = 0;
    461   1.1       cgd 			}
    462  1.17  explorer 			printf("\t\t%s: %lu\n", icmpnames[i],
    463   1.1       cgd 				icmpstat.icps_inhist[i]);
    464   1.1       cgd 		}
    465  1.17  explorer 	p(icps_reflect, "\t%lu message response%s generated\n");
    466   1.9   mycroft #undef p
    467   1.6    brezak }
    468   1.6    brezak 
    469   1.6    brezak /*
    470   1.9   mycroft  * Dump IGMP statistics structure.
    471   1.6    brezak  */
    472   1.6    brezak void
    473   1.6    brezak igmp_stats(off, name)
    474   1.8       cgd 	u_long off;
    475   1.6    brezak 	char *name;
    476   1.6    brezak {
    477   1.6    brezak 	struct igmpstat igmpstat;
    478   1.6    brezak 
    479   1.6    brezak 	if (off == 0)
    480   1.6    brezak 		return;
    481   1.9   mycroft 	kread(off, (char *)&igmpstat, sizeof (igmpstat));
    482   1.9   mycroft 	printf("%s:\n", name);
    483   1.9   mycroft 
    484   1.9   mycroft #define	p(f, m) if (igmpstat.f || sflag <= 1) \
    485   1.9   mycroft     printf(m, igmpstat.f, plural(igmpstat.f))
    486   1.9   mycroft #define	py(f, m) if (igmpstat.f || sflag <= 1) \
    487   1.9   mycroft     printf(m, igmpstat.f, igmpstat.f != 1 ? "ies" : "y")
    488  1.17  explorer 	p(igps_rcv_total, "\t%lu message%s received\n");
    489  1.17  explorer         p(igps_rcv_tooshort, "\t%lu message%s received with too few bytes\n");
    490  1.17  explorer         p(igps_rcv_badsum, "\t%lu message%s received with bad checksum\n");
    491  1.17  explorer         py(igps_rcv_queries, "\t%lu membership quer%s received\n");
    492  1.17  explorer         py(igps_rcv_badqueries, "\t%lu membership quer%s received with invalid field(s)\n");
    493  1.17  explorer         p(igps_rcv_reports, "\t%lu membership report%s received\n");
    494  1.17  explorer         p(igps_rcv_badreports, "\t%lu membership report%s received with invalid field(s)\n");
    495  1.17  explorer         p(igps_rcv_ourreports, "\t%lu membership report%s received for groups to which we belong\n");
    496  1.17  explorer         p(igps_snd_reports, "\t%lu membership report%s sent\n");
    497   1.9   mycroft #undef p
    498   1.9   mycroft #undef py
    499   1.1       cgd }
    500  1.37    itojun 
    501  1.37    itojun #ifdef IPSEC
    502  1.37    itojun static	char *ipsec_ahnames[] = {
    503  1.37    itojun 	"none",
    504  1.37    itojun 	"hmac MD5",
    505  1.37    itojun 	"hmac SHA1",
    506  1.37    itojun 	"keyed MD5",
    507  1.37    itojun 	"keyed SHA1",
    508  1.37    itojun 	"null",
    509  1.37    itojun };
    510  1.37    itojun 
    511  1.37    itojun static	char *ipsec_espnames[] = {
    512  1.37    itojun 	"none",
    513  1.37    itojun 	"DES CBC",
    514  1.37    itojun 	"3DES CBC",
    515  1.37    itojun 	"simple",
    516  1.37    itojun 	"blowfish CBC",
    517  1.37    itojun 	"CAST128 CBC",
    518  1.37    itojun 	"DES derived IV",
    519  1.37    itojun };
    520  1.37    itojun 
    521  1.37    itojun /*
    522  1.37    itojun  * Dump IPSEC statistics structure.
    523  1.37    itojun  */
    524  1.37    itojun void
    525  1.37    itojun ipsec_stats(off, name)
    526  1.37    itojun 	u_long off;
    527  1.37    itojun 	char *name;
    528  1.37    itojun {
    529  1.37    itojun 	struct ipsecstat ipsecstat;
    530  1.37    itojun 	int first, proto;
    531  1.37    itojun 
    532  1.37    itojun 	if (off == 0)
    533  1.37    itojun 		return;
    534  1.37    itojun 	printf ("%s:\n", name);
    535  1.37    itojun 	kread(off, (char *)&ipsecstat, sizeof (ipsecstat));
    536  1.37    itojun 
    537  1.37    itojun #define	p(f, m) if (ipsecstat.f || sflag <= 1) \
    538  1.37    itojun     printf(m, ipsecstat.f, plural(ipsecstat.f))
    539  1.37    itojun 
    540  1.37    itojun 	p(in_success, "\t%lu inbound packet%s processed successfully\n");
    541  1.37    itojun 	p(in_polvio, "\t%lu inbound packet%s violated process security "
    542  1.37    itojun 		"policy\n");
    543  1.37    itojun 	p(in_nosa, "\t%lu inbound packet%s with no SA available\n");
    544  1.37    itojun 	p(in_inval, "\t%lu inbound packet%s failed processing due to EINVAL\n");
    545  1.37    itojun 	p(in_badspi, "\t%lu inbound packet%s failed getting SPI\n");
    546  1.37    itojun 	p(in_ahreplay, "\t%lu inbound packet%s failed on AH replay check\n");
    547  1.37    itojun 	p(in_espreplay, "\t%lu inbound packet%s failed on ESP replay check\n");
    548  1.37    itojun 	p(in_ahauthsucc, "\t%lu inbound packet%s considered authentic\n");
    549  1.37    itojun 	p(in_ahauthfail, "\t%lu inbound packet%s failed on authentication\n");
    550  1.37    itojun 	for (first = 1, proto = 0; proto < SADB_AALG_MAX; proto++) {
    551  1.37    itojun 		if (ipsecstat.in_ahhist[proto] <= 0)
    552  1.37    itojun 			continue;
    553  1.37    itojun 		if (first) {
    554  1.37    itojun 			printf("\tAH input histogram:\n");
    555  1.37    itojun 			first = 0;
    556  1.37    itojun 		}
    557  1.37    itojun 		printf("\t\t%s: %lu\n", ipsec_ahnames[proto],
    558  1.37    itojun 			ipsecstat.in_ahhist[proto]);
    559  1.37    itojun 	}
    560  1.37    itojun 	for (first = 1, proto = 0; proto < SADB_EALG_MAX; proto++) {
    561  1.37    itojun 		if (ipsecstat.in_esphist[proto] <= 0)
    562  1.37    itojun 			continue;
    563  1.37    itojun 		if (first) {
    564  1.37    itojun 			printf("\tESP input histogram:\n");
    565  1.37    itojun 			first = 0;
    566  1.37    itojun 		}
    567  1.37    itojun 		printf("\t\t%s: %lu\n", ipsec_espnames[proto],
    568  1.37    itojun 			ipsecstat.in_esphist[proto]);
    569  1.37    itojun 	}
    570  1.37    itojun 
    571  1.37    itojun 	p(out_success, "\t%lu outbound packet%s processed successfully\n");
    572  1.37    itojun 	p(out_polvio, "\t%lu outbound packet%s violated process security "
    573  1.37    itojun 		"policy\n");
    574  1.37    itojun 	p(out_nosa, "\t%lu outbound packet%s with no SA available\n");
    575  1.37    itojun 	p(out_inval, "\t%lu outbound packet%s failed processing due to "
    576  1.37    itojun 		"EINVAL\n");
    577  1.37    itojun 	p(out_noroute, "\t%lu outbound packet%s with no route\n");
    578  1.37    itojun 	for (first = 1, proto = 0; proto < SADB_AALG_MAX; proto++) {
    579  1.37    itojun 		if (ipsecstat.out_ahhist[proto] <= 0)
    580  1.37    itojun 			continue;
    581  1.37    itojun 		if (first) {
    582  1.37    itojun 			printf("\tAH output histogram:\n");
    583  1.37    itojun 			first = 0;
    584  1.37    itojun 		}
    585  1.37    itojun 		printf("\t\t%s: %lu\n", ipsec_ahnames[proto],
    586  1.37    itojun 			ipsecstat.out_ahhist[proto]);
    587  1.37    itojun 	}
    588  1.37    itojun 	for (first = 1, proto = 0; proto < SADB_EALG_MAX; proto++) {
    589  1.37    itojun 		if (ipsecstat.out_esphist[proto] <= 0)
    590  1.37    itojun 			continue;
    591  1.37    itojun 		if (first) {
    592  1.37    itojun 			printf("\tESP output histogram:\n");
    593  1.37    itojun 			first = 0;
    594  1.37    itojun 		}
    595  1.37    itojun 		printf("\t\t%s: %lu\n", ipsec_espnames[proto],
    596  1.37    itojun 			ipsecstat.out_esphist[proto]);
    597  1.37    itojun 	}
    598  1.37    itojun #undef p
    599  1.37    itojun }
    600  1.37    itojun #endif /*IPSEC*/
    601   1.1       cgd 
    602   1.1       cgd /*
    603   1.1       cgd  * Pretty print an Internet address (net address + port).
    604   1.1       cgd  * If the nflag was specified, use numbers instead of names.
    605   1.1       cgd  */
    606   1.9   mycroft void
    607  1.28     lukem inetprint(in, port, proto, numeric)
    608  1.23     lukem 	struct in_addr *in;
    609  1.28     lukem 	u_int16_t port;
    610  1.28     lukem 	const char *proto;
    611  1.28     lukem 	int numeric;
    612   1.1       cgd {
    613   1.1       cgd 	struct servent *sp = 0;
    614   1.9   mycroft 	char line[80], *cp;
    615  1.33  sommerfe 	size_t space;
    616   1.1       cgd 
    617  1.32       mrg 	(void)snprintf(line, sizeof line, "%.*s.",
    618  1.35     lukem 	    (Aflag && !nflag) ? 12 : 16, inetname(in));
    619  1.23     lukem 	cp = strchr(line, '\0');
    620  1.28     lukem 	if (!numeric && port)
    621   1.1       cgd 		sp = getservbyport((int)port, proto);
    622  1.33  sommerfe 	space = sizeof line - (cp-line);
    623   1.1       cgd 	if (sp || port == 0)
    624  1.33  sommerfe 		(void)snprintf(cp, space, "%.8s", sp ? sp->s_name : "*");
    625   1.1       cgd 	else
    626  1.33  sommerfe 		(void)snprintf(cp, space, "%u", ntohs(port));
    627  1.32       mrg 	(void)printf(" %-*.*s", width, width, line);
    628   1.1       cgd }
    629   1.1       cgd 
    630   1.1       cgd /*
    631   1.1       cgd  * Construct an Internet address representation.
    632   1.9   mycroft  * If the nflag has been supplied, give
    633   1.1       cgd  * numeric value, otherwise try for symbolic name.
    634   1.1       cgd  */
    635   1.1       cgd char *
    636   1.9   mycroft inetname(inp)
    637   1.9   mycroft 	struct in_addr *inp;
    638   1.1       cgd {
    639  1.23     lukem 	char *cp;
    640   1.1       cgd 	static char line[50];
    641   1.1       cgd 	struct hostent *hp;
    642   1.1       cgd 	struct netent *np;
    643   1.1       cgd 	static char domain[MAXHOSTNAMELEN + 1];
    644   1.1       cgd 	static int first = 1;
    645   1.1       cgd 
    646   1.1       cgd 	if (first && !nflag) {
    647   1.1       cgd 		first = 0;
    648  1.31       mrg 		if (gethostname(domain, sizeof domain) == 0) {
    649  1.31       mrg 			domain[sizeof(domain) - 1] = '\0';
    650  1.31       mrg 			if ((cp = strchr(domain, '.')))
    651  1.31       mrg 				(void) strcpy(domain, cp + 1);
    652  1.31       mrg 			else
    653  1.31       mrg 				domain[0] = 0;
    654  1.31       mrg 		} else
    655   1.1       cgd 			domain[0] = 0;
    656   1.1       cgd 	}
    657   1.1       cgd 	cp = 0;
    658   1.9   mycroft 	if (!nflag && inp->s_addr != INADDR_ANY) {
    659   1.9   mycroft 		int net = inet_netof(*inp);
    660   1.9   mycroft 		int lna = inet_lnaof(*inp);
    661   1.1       cgd 
    662   1.1       cgd 		if (lna == INADDR_ANY) {
    663   1.1       cgd 			np = getnetbyaddr(net, AF_INET);
    664   1.1       cgd 			if (np)
    665   1.1       cgd 				cp = np->n_name;
    666   1.1       cgd 		}
    667   1.1       cgd 		if (cp == 0) {
    668   1.9   mycroft 			hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET);
    669   1.1       cgd 			if (hp) {
    670  1.23     lukem 				if ((cp = strchr(hp->h_name, '.')) &&
    671   1.1       cgd 				    !strcmp(cp + 1, domain))
    672   1.1       cgd 					*cp = 0;
    673   1.1       cgd 				cp = hp->h_name;
    674   1.1       cgd 			}
    675   1.1       cgd 		}
    676   1.1       cgd 	}
    677   1.9   mycroft 	if (inp->s_addr == INADDR_ANY)
    678  1.32       mrg 		strncpy(line, "*", sizeof line);
    679   1.1       cgd 	else if (cp)
    680  1.32       mrg 		strncpy(line, cp, sizeof line);
    681   1.1       cgd 	else {
    682   1.9   mycroft 		inp->s_addr = ntohl(inp->s_addr);
    683   1.1       cgd #define C(x)	((x) & 0xff)
    684  1.32       mrg 		(void)snprintf(line, sizeof line, "%u.%u.%u.%u",
    685  1.32       mrg 		    C(inp->s_addr >> 24), C(inp->s_addr >> 16),
    686  1.32       mrg 		    C(inp->s_addr >> 8), C(inp->s_addr));
    687  1.32       mrg #undef C
    688   1.1       cgd 	}
    689  1.32       mrg 	line[sizeof(line) - 1] = '\0';
    690   1.1       cgd 	return (line);
    691  1.30   thorpej }
    692  1.30   thorpej 
    693  1.30   thorpej /*
    694  1.30   thorpej  * Dump the contents of a TCP PCB.
    695  1.30   thorpej  */
    696  1.30   thorpej void
    697  1.30   thorpej tcp_dump(pcbaddr)
    698  1.30   thorpej 	u_long pcbaddr;
    699  1.30   thorpej {
    700  1.30   thorpej 	struct tcpcb tcpcb;
    701  1.30   thorpej 	int i;
    702  1.30   thorpej 
    703  1.30   thorpej 	kread(pcbaddr, (char *)&tcpcb, sizeof(tcpcb));
    704  1.30   thorpej 
    705  1.30   thorpej 	printf("TCP Protocol Control Block at 0x%08lx:\n\n", pcbaddr);
    706  1.30   thorpej 
    707  1.30   thorpej 	printf("Timers:\n");
    708  1.30   thorpej 	for (i = 0; i < TCPT_NTIMERS; i++)
    709  1.30   thorpej 		printf("\t%s: %u", tcptimers[i], tcpcb.t_timer[i]);
    710  1.30   thorpej 	printf("\n\n");
    711  1.30   thorpej 
    712  1.30   thorpej 	if (tcpcb.t_state < 0 || tcpcb.t_state >= TCP_NSTATES)
    713  1.30   thorpej 		printf("State: %d", tcpcb.t_state);
    714  1.30   thorpej 	else
    715  1.30   thorpej 		printf("State: %s", tcpstates[tcpcb.t_state]);
    716  1.30   thorpej 	printf(", flags 0x%x, inpcb 0x%lx\n\n", tcpcb.t_flags,
    717  1.30   thorpej 	    (u_long)tcpcb.t_inpcb);
    718  1.30   thorpej 
    719  1.30   thorpej 	printf("rxtshift %d, rxtcur %d, dupacks %d\n", tcpcb.t_rxtshift,
    720  1.30   thorpej 	    tcpcb.t_rxtcur, tcpcb.t_dupacks);
    721  1.30   thorpej 	printf("peermss %u, ourmss %u, segsz %u\n\n", tcpcb.t_peermss,
    722  1.30   thorpej 	    tcpcb.t_ourmss, tcpcb.t_segsz);
    723  1.30   thorpej 
    724  1.30   thorpej 	printf("snd_una %u, snd_nxt %u, snd_up %u\n",
    725  1.30   thorpej 	    tcpcb.snd_una, tcpcb.snd_nxt, tcpcb.snd_up);
    726  1.30   thorpej 	printf("snd_wl1 %u, snd_wl2 %u, iss %u, snd_wnd %lu\n\n",
    727  1.30   thorpej 	    tcpcb.snd_wl1, tcpcb.snd_wl2, tcpcb.iss, tcpcb.snd_wnd);
    728  1.30   thorpej 
    729  1.30   thorpej 	printf("rcv_wnd %lu, rcv_nxt %u, rcv_up %u, irs %u\n\n",
    730  1.30   thorpej 	    tcpcb.rcv_wnd, tcpcb.rcv_nxt, tcpcb.rcv_up, tcpcb.irs);
    731  1.30   thorpej 
    732  1.30   thorpej 	printf("rcv_adv %u, snd_max %u, snd_cwnd %lu, snd_ssthresh %lu\n",
    733  1.30   thorpej 	    tcpcb.rcv_adv, tcpcb.snd_max, tcpcb.snd_cwnd, tcpcb.snd_ssthresh);
    734  1.30   thorpej 
    735  1.30   thorpej 	printf("idle %d, rtt %d, rtseq %u, srtt %d, rttvar %d, rttmin %d, "
    736  1.30   thorpej 	    "max_sndwnd %lu\n\n", tcpcb.t_idle, tcpcb.t_rtt, tcpcb.t_rtseq,
    737  1.30   thorpej 	    tcpcb.t_srtt, tcpcb.t_rttvar, tcpcb.t_rttmin, tcpcb.max_sndwnd);
    738  1.30   thorpej 
    739  1.30   thorpej 	printf("oobflags %d, iobc %d, softerror %d\n\n", tcpcb.t_oobflags,
    740  1.30   thorpej 	    tcpcb.t_iobc, tcpcb.t_softerror);
    741  1.30   thorpej 
    742  1.30   thorpej 	printf("snd_scale %d, rcv_scale %d, req_r_scale %d, req_s_scale %d\n",
    743  1.30   thorpej 	    tcpcb.snd_scale, tcpcb.rcv_scale, tcpcb.request_r_scale,
    744  1.30   thorpej 	    tcpcb.requested_s_scale);
    745  1.30   thorpej 	printf("ts_recent %u, ts_regent_age %d, last_ack_sent %u\n",
    746  1.30   thorpej 	    tcpcb.ts_recent, tcpcb.ts_recent_age, tcpcb.last_ack_sent);
    747   1.1       cgd }
    748