Commit 7ab0f9d5 authored by Kevin Bracey's avatar Kevin Bracey
Browse files

InetStat and Route updated from FreeBSD. Particular items of note:

   Extra stats from InetStat, such as unwanted multicasts.
   Route now allows syntax like "route add 136.170.33/24 hobbit".
   InetStat -r now shows netmasks like 136.170.128/21.
More updates will be incorporated if/when Internet gets more updates.
parent 0f1702ab
......@@ -24,7 +24,7 @@
| end
|
If "%*0" = "" Then Error Do not run me with no parameters
If "%1" = "" Then Obey !MkMods %0 arp ifconfig ifrconfig inetstat newfiler ping pong route sysctl traceroute utils
If "%1" = "" Then Obey !MkMods %0 arp ifconfig ifrconfig inetstat newfiler ping pong route showstat sysctl traceroute utils
If "%1" = "" Then Obey
dir %1
......
......@@ -22,7 +22,7 @@ RM= remove
WFLAGS= fr~c~v
WIPE= -wipe
CFLAGS= -pcc -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
CFLAGS= -pcc -g -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
OBJS= o.${TARGET}
......@@ -33,75 +33,10 @@ LIBS= C:o.Stubs TCPIPLibs:o.Unixlib TCPIPLibs:o.Inetlib \
.c.o:; $(CC) $(CFLAGS) -o $@ $<
${TARGET}: $(OBJS) $(LIBS)
Link -o $@ $(OBJS) $(LIBS)
Link -d -o $@ $(OBJS) $(LIBS)
Squeeze $@
clean:; ${RM} ${TARGET}
${WIPE} o.* ${WFLAGS}
# Dynamic dependencies:
o.IfConfig: c.IfConfig
o.IfConfig: TCPIPLibs:sys.h.param
o.IfConfig: TCPIPLibs:sys.h.types
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:machine.h.endian
o.IfConfig: TCPIPLibs:machine.h.ansi
o.IfConfig: TCPIPLibs:machine.h.types
o.IfConfig: TCPIPLibs:sys.h.syslimits
o.IfConfig: TCPIPLibs:sys.h.signal
o.IfConfig: TCPIPLibs:machine.h.signal
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:machine.h.param
o.IfConfig: TCPIPLibs:machine.h.limits
o.IfConfig: TCPIPLibs:sys.h.socket
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:sys.h.ioctl
o.IfConfig: TCPIPLibs:sys.h.ttycom
o.IfConfig: TCPIPLibs:sys.h.ioccom
o.IfConfig: TCPIPLibs:sys.h.ioccom
o.IfConfig: TCPIPLibs:sys.h.filio
o.IfConfig: TCPIPLibs:sys.h.ioccom
o.IfConfig: TCPIPLibs:sys.h.sockio
o.IfConfig: TCPIPLibs:sys.h.ioccom
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:net.h.if
o.IfConfig: TCPIPLibs:sys.h.socket
o.IfConfig: TCPIPLibs:sys.h.time
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:net.h.if_arp
o.IfConfig: TCPIPLibs:sys.h.socket
o.IfConfig: TCPIPLibs:net.h.if_dl
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:netinet.h.in
o.IfConfig: TCPIPLibs:netinet.h.in_var
o.IfConfig: TCPIPLibs:sys.h.queue
o.IfConfig: TCPIPLibs:arpa.h.inet
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:netns.h.ns
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:netns.h.ns_if
o.IfConfig: TCPIPLibs:h.netdb
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:netiso.h.iso
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:netiso.h.iso_var
o.IfConfig: TCPIPLibs:sys.h.protosw
o.IfConfig: TCPIPLibs:h.err
o.IfConfig: TCPIPLibs:machine.h.ansi
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:sys.h.errno
o.IfConfig: C:h.kernel
o.IfConfig: TCPIPLibs:h.unistd
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:sys.h.types
o.IfConfig: TCPIPLibs:sys.h.unistd
o.IfConfig: TCPIPLibs:h.nlist
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:h.kvm
o.IfConfig: TCPIPLibs:h.nlist
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:sys.h.fcntl
o.IfConfig: TCPIPLibs:sys.h.types
o.IfConfig: TCPIPLibs:sys.h.cdefs
o.IfConfig: TCPIPLibs:h.riscos
o.IfConfig: C:h.swis
......@@ -41,209 +41,3 @@ clean:; ${RM} ${TARGET}
${WIPE} o.* ${WFLAGS}
# Dynamic dependencies:
o.main: c.main
o.main: TCPIPLibs:sys.h.param
o.main: TCPIPLibs:sys.h.types
o.main: TCPIPLibs:sys.h.cdefs
o.main: TCPIPLibs:machine.h.endian
o.main: TCPIPLibs:machine.h.ansi
o.main: TCPIPLibs:machine.h.types
o.main: TCPIPLibs:sys.h.syslimits
o.main: TCPIPLibs:sys.h.signal
o.main: TCPIPLibs:machine.h.signal
o.main: TCPIPLibs:sys.h.cdefs
o.main: TCPIPLibs:machine.h.param
o.main: TCPIPLibs:machine.h.limits
o.main: TCPIPLibs:sys.h.file
o.main: TCPIPLibs:sys.h.fcntl
o.main: TCPIPLibs:sys.h.types
o.main: TCPIPLibs:sys.h.cdefs
o.main: TCPIPLibs:sys.h.unistd
o.main: TCPIPLibs:sys.h.protosw
o.main: TCPIPLibs:sys.h.socket
o.main: TCPIPLibs:sys.h.cdefs
o.main: TCPIPLibs:netinet.h.in
o.main: TCPIPLibs:h.kvm
o.main: TCPIPLibs:h.nlist
o.main: TCPIPLibs:sys.h.cdefs
o.main: TCPIPLibs:sys.h.cdefs
o.main: TCPIPLibs:h.netdb
o.main: TCPIPLibs:sys.h.cdefs
o.main: TCPIPLibs:h.nlist
o.main: TCPIPLibs:h.paths
o.main: TCPIPLibs:sys.h.cdefs
o.main: TCPIPLibs:h.unistd
o.main: TCPIPLibs:sys.h.cdefs
o.main: TCPIPLibs:sys.h.types
o.main: TCPIPLibs:sys.h.unistd
o.main: TCPIPLibs:h.err
o.main: TCPIPLibs:machine.h.ansi
o.main: TCPIPLibs:sys.h.cdefs
o.main: TCPIPLibs:h.unixlib
o.main: TCPIPLibs:h.riscos
o.main: h.netstat
o.main: TCPIPLibs:sys.h.cdefs
o.inet: c.inet
o.inet: TCPIPLibs:sys.h.time
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:sys.h.param
o.inet: TCPIPLibs:sys.h.types
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:machine.h.endian
o.inet: TCPIPLibs:machine.h.ansi
o.inet: TCPIPLibs:machine.h.types
o.inet: TCPIPLibs:sys.h.syslimits
o.inet: TCPIPLibs:sys.h.signal
o.inet: TCPIPLibs:machine.h.signal
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:machine.h.param
o.inet: TCPIPLibs:machine.h.limits
o.inet: TCPIPLibs:sys.h.socket
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:sys.h.socketvar
o.inet: TCPIPLibs:sys.h.stat
o.inet: TCPIPLibs:sys.h.time
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:sys.h.select
o.inet: TCPIPLibs:sys.h.mbuf
o.inet: TCPIPLibs:sys.h.protosw
o.inet: TCPIPLibs:sys.h.queue
o.inet: TCPIPLibs:net.h.route
o.inet: TCPIPLibs:net.h.radix
o.inet: TCPIPLibs:netinet.h.in
o.inet: TCPIPLibs:netinet.h.in_systm
o.inet: TCPIPLibs:netinet.h.ip
o.inet: TCPIPLibs:netinet.h.in_pcb
o.inet: TCPIPLibs:netinet.h.ip_icmp
o.inet: TCPIPLibs:netinet.h.icmp_var
o.inet: TCPIPLibs:netinet.h.igmp_var
o.inet: TCPIPLibs:netinet.h.ip_var
o.inet: TCPIPLibs:netinet.h.tcp
o.inet: TCPIPLibs:netinet.h.tcpip
o.inet: TCPIPLibs:netinet.h.tcp_seq
o.inet: TCPIPLibs:netinet.h.tcp_fsm
o.inet: TCPIPLibs:netinet.h.tcp_timer
o.inet: TCPIPLibs:netinet.h.tcp_var
o.inet: TCPIPLibs:netinet.h.tcp_debug
o.inet: TCPIPLibs:netinet.h.udp
o.inet: TCPIPLibs:netinet.h.udp_var
o.inet: TCPIPLibs:arpa.h.inet
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:h.netdb
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:h.unixlib
o.inet: h.netstat
o.inet: TCPIPLibs:sys.h.cdefs
o.if: c.if
o.if: TCPIPLibs:sys.h.types
o.if: TCPIPLibs:sys.h.cdefs
o.if: TCPIPLibs:machine.h.endian
o.if: TCPIPLibs:machine.h.ansi
o.if: TCPIPLibs:machine.h.types
o.if: TCPIPLibs:sys.h.protosw
o.if: TCPIPLibs:sys.h.socket
o.if: TCPIPLibs:sys.h.cdefs
o.if: TCPIPLibs:net.h.if
o.if: TCPIPLibs:sys.h.socket
o.if: TCPIPLibs:sys.h.time
o.if: TCPIPLibs:sys.h.cdefs
o.if: TCPIPLibs:net.h.if_arp
o.if: TCPIPLibs:sys.h.socket
o.if: TCPIPLibs:net.h.if_dl
o.if: TCPIPLibs:sys.h.cdefs
o.if: TCPIPLibs:netinet.h.in
o.if: TCPIPLibs:netinet.h.in_var
o.if: TCPIPLibs:sys.h.queue
o.if: TCPIPLibs:netns.h.ns
o.if: TCPIPLibs:sys.h.cdefs
o.if: TCPIPLibs:netns.h.ns_if
o.if: TCPIPLibs:netiso.h.iso
o.if: TCPIPLibs:sys.h.cdefs
o.if: TCPIPLibs:netiso.h.iso_var
o.if: TCPIPLibs:arpa.h.inet
o.if: TCPIPLibs:sys.h.cdefs
o.if: C:h.kernel
o.if: TCPIPLibs:h.unixlib
o.if: h.netstat
o.if: TCPIPLibs:sys.h.cdefs
o.route: c.route
o.route: TCPIPLibs:sys.h.param
o.route: TCPIPLibs:sys.h.types
o.route: TCPIPLibs:sys.h.cdefs
o.route: TCPIPLibs:machine.h.endian
o.route: TCPIPLibs:machine.h.ansi
o.route: TCPIPLibs:machine.h.types
o.route: TCPIPLibs:sys.h.syslimits
o.route: TCPIPLibs:sys.h.signal
o.route: TCPIPLibs:machine.h.signal
o.route: TCPIPLibs:sys.h.cdefs
o.route: TCPIPLibs:machine.h.param
o.route: TCPIPLibs:machine.h.limits
o.route: TCPIPLibs:sys.h.protosw
o.route: TCPIPLibs:sys.h.socket
o.route: TCPIPLibs:sys.h.cdefs
o.route: TCPIPLibs:sys.h.mbuf
o.route: TCPIPLibs:net.h.if
o.route: TCPIPLibs:sys.h.socket
o.route: TCPIPLibs:sys.h.time
o.route: TCPIPLibs:sys.h.cdefs
o.route: TCPIPLibs:net.h.if_arp
o.route: TCPIPLibs:sys.h.socket
o.route: TCPIPLibs:net.h.if_dl
o.route: TCPIPLibs:sys.h.cdefs
o.route: TCPIPLibs:net.h.if_types
o.route: TCPIPLibs:net.h.route
o.route: TCPIPLibs:net.h.radix
o.route: TCPIPLibs:netinet.h.in
o.route: TCPIPLibs:netns.h.ns
o.route: TCPIPLibs:sys.h.cdefs
o.route: TCPIPLibs:sys.h.sysctl
o.route: TCPIPLibs:h.netdb
o.route: TCPIPLibs:sys.h.cdefs
o.route: TCPIPLibs:h.unistd
o.route: TCPIPLibs:sys.h.cdefs
o.route: TCPIPLibs:sys.h.types
o.route: TCPIPLibs:sys.h.unistd
o.route: TCPIPLibs:h.err
o.route: TCPIPLibs:machine.h.ansi
o.route: TCPIPLibs:sys.h.cdefs
o.route: h.netstat
o.route: TCPIPLibs:sys.h.cdefs
o.route: TCPIPLibs:h.riscos
o.route: TCPIPLibs:h.unixlib
o.mroute: c.mroute
o.mroute: TCPIPLibs:sys.h.param
o.mroute: TCPIPLibs:sys.h.types
o.mroute: TCPIPLibs:sys.h.cdefs
o.mroute: TCPIPLibs:machine.h.endian
o.mroute: TCPIPLibs:machine.h.ansi
o.mroute: TCPIPLibs:machine.h.types
o.mroute: TCPIPLibs:sys.h.syslimits
o.mroute: TCPIPLibs:sys.h.signal
o.mroute: TCPIPLibs:machine.h.signal
o.mroute: TCPIPLibs:sys.h.cdefs
o.mroute: TCPIPLibs:machine.h.param
o.mroute: TCPIPLibs:machine.h.limits
o.mroute: TCPIPLibs:sys.h.socket
o.mroute: TCPIPLibs:sys.h.cdefs
o.mroute: TCPIPLibs:sys.h.socketvar
o.mroute: TCPIPLibs:sys.h.stat
o.mroute: TCPIPLibs:sys.h.time
o.mroute: TCPIPLibs:sys.h.cdefs
o.mroute: TCPIPLibs:sys.h.cdefs
o.mroute: TCPIPLibs:sys.h.select
o.mroute: TCPIPLibs:sys.h.protosw
o.mroute: TCPIPLibs:sys.h.mbuf
o.mroute: TCPIPLibs:net.h.if
o.mroute: TCPIPLibs:sys.h.socket
o.mroute: TCPIPLibs:sys.h.time
o.mroute: TCPIPLibs:net.h.if_arp
o.mroute: TCPIPLibs:sys.h.socket
o.mroute: TCPIPLibs:netinet.h.in
o.mroute: TCPIPLibs:netinet.h.igmp
o.mroute: TCPIPLibs:net.h.route
o.mroute: TCPIPLibs:net.h.radix
o.mroute: TCPIPLibs:netinet.h.ip_mroute
o.mroute: h.netstat
o.mroute: TCPIPLibs:sys.h.cdefs
o.mroute: TCPIPLibs:h.riscos
/*
* Copyright (c) 1983, 1988, 1993
* Copyright (c) 1983, 1988, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -32,18 +32,19 @@
*/
#ifndef lint
static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94";
/*
static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
*/
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#ifdef __riscos
#include <sys/time.h>
#endif
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/mbuf.h>
#include <sys/sysctl.h>
#include <sys/protosw.h>
#include <sys/queue.h>
#include <net/route.h>
#include <netinet/in.h>
......@@ -66,8 +67,11 @@ static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94";
#include <netinet/udp_var.h>
#include <arpa/inet.h>
#include <err.h>
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __riscos
#include <unixlib.h>
......@@ -81,7 +85,7 @@ struct tcpcb tcpcb;
struct socket sockb;
char *inetname(struct in_addr *);
void inetprint(struct in_addr *, int, char *);
void inetprint(struct in_addr *, int, char *, int);
/*
* Print a summary of connections related to an Internet
......@@ -133,7 +137,7 @@ protopr(off, name)
printf(" (including servers)");
putchar('\n');
if (Aflag)
printf("%-8.8s ", "PCB");
printf("%-8.8s ", "Socket");
printf(Aflag ?
"%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s %s\n" :
"%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s %s\n",
......@@ -141,15 +145,35 @@ protopr(off, name)
"Local Address", "Foreign Address", "(state)");
first = 0;
}
if (Aflag)
if (Aflag) {
if (istcp)
printf("%8x ", inpcb.inp_ppcb);
printf("%8lx ", (u_long)inpcb.inp_ppcb);
else
printf("%8x ", next);
printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc,
printf("%8lx ", (u_long)next);
}
printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc,
sockb.so_snd.sb_cc);
inetprint(&inpcb.inp_laddr, (int)inpcb.inp_lport, name);
inetprint(&inpcb.inp_faddr, (int)inpcb.inp_fport, name);
#if 0
if (nflag) {
inetprint(&inp->inp_laddr, (int)inp->inp_lport,
name, 1);
inetprint(&inp->inp_faddr, (int)inp->inp_fport,
name, 1);
} else if (inp->inp_flags & INP_ANONPORT) {
inetprint(&inp->inp_laddr, (int)inp->inp_lport,
name, 1);
inetprint(&inp->inp_faddr, (int)inp->inp_fport,
name, 0);
} else {
inetprint(&inp->inp_laddr, (int)inp->inp_lport,
name, 0);
inetprint(&inp->inp_faddr, (int)inp->inp_fport,
name, inp->inp_lport != inp->inp_fport);
}
#else
inetprint(&inpcb.inp_laddr, (int)inpcb.inp_lport, name, nflag);
inetprint(&inpcb.inp_faddr, (int)inpcb.inp_fport, name, nflag);
#endif
if (istcp) {
if (tcpcb.t_state < 0 || tcpcb.t_state >= TCP_NSTATES)
printf(" %d", tcpcb.t_state);
......@@ -184,67 +208,76 @@ tcp_stats(off, name)
#define p(f, m) if (tcpstat.f || sflag <= 1) \
printf(m, tcpstat.f, plural(tcpstat.f))
#define p1a(f, m) if (tcpstat.f || sflag <= 1) \
printf(m, tcpstat.f)
#define p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \
printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2, plural(tcpstat.f2))
#define p2a(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \
printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2)
#define p3(f, m) if (tcpstat.f || sflag <= 1) \
printf(m, tcpstat.f, plurales(tcpstat.f))
p(tcps_sndtotal, " %d packet%s sent\n");
p(tcps_sndtotal, " %lu packet%s sent\n");
p2(tcps_sndpack,tcps_sndbyte,
" %d data packet%s (%d byte%s)\n");
" %lu data packet%s (%lu byte%s)\n");
p2(tcps_sndrexmitpack, tcps_sndrexmitbyte,
" %d data packet%s (%d byte%s) retransmitted\n");
p2(tcps_sndacks, tcps_delack,
" %d ack-only packet%s (%d delayed)\n");
p(tcps_sndurg, " %d URG only packet%s\n");
p(tcps_sndprobe, " %d window probe packet%s\n");
p(tcps_sndwinup, " %d window update packet%s\n");
p(tcps_sndctrl, " %d control packet%s\n");
p(tcps_rcvtotal, " %d packet%s received\n");
p2(tcps_rcvackpack, tcps_rcvackbyte, " %d ack%s (for %d byte%s)\n");
p(tcps_rcvdupack, " %d duplicate ack%s\n");
p(tcps_rcvacktoomuch, " %d ack%s for unsent data\n");
" %lu data packet%s (%lu byte%s) retransmitted\n");
p(tcps_mturesent, " %lu resend%s initiated by MTU discovery\n");
p2a(tcps_sndacks, tcps_delack,
" %lu ack-only packet%s (%lu delayed)\n");
p(tcps_sndurg, " %lu URG only packet%s\n");
p(tcps_sndprobe, " %lu window probe packet%s\n");
p(tcps_sndwinup, " %lu window update packet%s\n");
p(tcps_sndctrl, " %lu control packet%s\n");
p(tcps_rcvtotal, " %lu packet%s received\n");
p2(tcps_rcvackpack, tcps_rcvackbyte, " %lu ack%s (for %lu byte%s)\n");
p(tcps_rcvdupack, " %lu duplicate ack%s\n");
p(tcps_rcvacktoomuch, " %lu ack%s for unsent data\n");
p2(tcps_rcvpack, tcps_rcvbyte,
" %d packet%s (%d byte%s) received in-sequence\n");
" %lu packet%s (%lu byte%s) received in-sequence\n");
p2(tcps_rcvduppack, tcps_rcvdupbyte,
" %d completely duplicate packet%s (%d byte%s)\n");
p(tcps_pawsdrop, " %d old duplicate packet%s\n");
" %lu completely duplicate packet%s (%lu byte%s)\n");
p(tcps_pawsdrop, " %lu old duplicate packet%s\n");
p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte,
" %d packet%s with some dup. data (%d byte%s duped)\n");
" %lu packet%s with some dup. data (%lu byte%s duped)\n");
p2(tcps_rcvoopack, tcps_rcvoobyte,
" %d out-of-order packet%s (%d byte%s)\n");
" %lu out-of-order packet%s (%lu byte%s)\n");
p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin,
" %d packet%s (%d byte%s) of data after window\n");
p(tcps_rcvwinprobe, " %d window probe%s\n");
p(tcps_rcvwinupd, " %d window update packet%s\n");
p(tcps_rcvafterclose, " %d packet%s received after close\n");
p(tcps_rcvbadsum, " %d discarded for bad checksum%s\n");
p(tcps_rcvbadoff, " %d discarded for bad header offset field%s\n");
p(tcps_rcvshort, " %d discarded because packet too short\n");
p(tcps_connattempt, " %d connection request%s\n");
p(tcps_accepts, " %d connection accept%s\n");
p(tcps_connects, " %d connection%s established (including accepts)\n");
" %lu packet%s (%lu byte%s) of data after window\n");
p(tcps_rcvwinprobe, " %lu window probe%s\n");
p(tcps_rcvwinupd, " %lu window update packet%s\n");
p(tcps_rcvafterclose, " %lu packet%s received after close\n");
p(tcps_rcvbadsum, " %lu discarded for bad checksum%s\n");
p(tcps_rcvbadoff, " %lu discarded for bad header offset field%s\n");
p1a(tcps_rcvshort, " %lu discarded because packet too short\n");
p(tcps_connattempt, " %lu connection request%s\n");
p(tcps_accepts, " %lu connection accept%s\n");
p(tcps_badsyn, " %lu bad connection attempt%s\n");
p(tcps_listendrop, " %lu listen queue overflow%s\n");
p(tcps_connects, " %lu connection%s established (including accepts)\n");
p2(tcps_closed, tcps_drops,
" %d connection%s closed (including %d drop%s)\n");
p(tcps_cachedrtt, " %d connection%s updated cached RTT on close\n");
" %lu connection%s closed (including %lu drop%s)\n");
p(tcps_cachedrtt, " %lu connection%s updated cached RTT on close\n");
p(tcps_cachedrttvar,
" %d connection%s updated cached RTT variance on close\n");
" %lu connection%s updated cached RTT variance on close\n");
p(tcps_cachedssthresh,
" %d connection%s updated cached ssthresh on close\n");
p(tcps_conndrops, " %d embryonic connection%s dropped\n");
" %lu connection%s updated cached ssthresh on close\n");
p(tcps_conndrops, " %lu embryonic connection%s dropped\n");
p2(tcps_rttupdated, tcps_segstimed,
" %d segment%s updated rtt (of %d attempt%s)\n");
p(tcps_rexmttimeo, " %d retransmit timeout%s\n");
p(tcps_timeoutdrop, " %d connection%s dropped by rexmit timeout\n");
p(tcps_persisttimeo, " %d persist timeout%s\n");
p(tcps_persistdrop, " %d connection%s dropped by persist timeout\n");
p(tcps_keeptimeo, " %d keepalive timeout%s\n");
p(tcps_keepprobe, " %d keepalive probe%s sent\n");
p(tcps_keepdrops, " %d connection%s dropped by keepalive\n");
p(tcps_predack, " %d correct ACK header prediction%s\n");
p(tcps_preddat, " %d correct data packet header prediction%s\n");
" %lu segment%s updated rtt (of %lu attempt%s)\n");
p(tcps_rexmttimeo, " %lu retransmit timeout%s\n");
p(tcps_timeoutdrop, " %lu connection%s dropped by rexmit timeout\n");
p(tcps_persisttimeo, " %lu persist timeout%s\n");
p(tcps_persistdrop, " %lu connection%s dropped by persist timeout\n");
p(tcps_keeptimeo, " %lu keepalive timeout%s\n");
p(tcps_keepprobe, " %lu keepalive probe%s sent\n");
p(tcps_keepdrops, " %lu connection%s dropped by keepalive\n");
p(tcps_predack, " %lu correct ACK header prediction%s\n");
p(tcps_preddat, " %lu correct data packet header prediction%s\n");
#undef p
#undef p1a
#undef p2
#undef p2a
#undef p3
}
......@@ -265,13 +298,19 @@ udp_stats(off, name)
printf("%s:\n", name);
#define p(f, m) if (udpstat.f || sflag <= 1) \
printf(m, udpstat.f, plural(udpstat.f))
p(udps_ipackets, " %u datagram%s received\n");
p(udps_hdrops, " %u with incomplete header\n");
p(udps_badlen, " %u with bad data length field\n");
p(udps_badsum, " %u with bad checksum\n");
p(udps_noport, " %u dropped due to no socket\n");
p(udps_noportbcast, " %u broadcast/multicast datagram%s dropped due to no socket\n");
p(udps_fullsock, " %u dropped due to full socket buffers\n");
#define p1a(f, m) if (udpstat.f || sflag <= 1) \
printf(m, udpstat.f)
p(udps_ipackets, " %lu datagram%s received\n");
p1a(udps_hdrops, " %lu with incomplete header\n");
p1a(udps_badlen, " %lu with bad data length field\n");
p1a(udps_badsum, " %lu with bad checksum\n");
p1a(udps_noport, " %lu dropped due to no socket\n");
p(udps_noportbcast,
" %lu broadcast/multicast datagram%s dropped due to no socket\n");
p1a(udps_fullsock, " %lu dropped due to full socket buffers\n");
#if 0
p1a(udpps_pcbhashmiss, " %lu not for hashed pcb\n");
#endif
delivered = udpstat.udps_ipackets -
udpstat.udps_hdrops -
udpstat.udps_badlen -
......@@ -280,9 +319,10 @@ udp_stats(off, name)
udpstat.udps_noportbcast -
udpstat.udps_fullsock;
if (delivered || sflag <= 1)
printf(" %u delivered\n", delivered);
p(udps_opackets, " %u datagram%s output\n");
printf(" %lu delivered\n", delivered);
p(udps_opackets, " %lu datagram%s output\n");
#undef p
#undef p1a
}
/*
......@@ -302,32 +342,43 @@ ip_stats(off, name)
#define p(f, m) if (ipstat.f || sflag <= 1) \
printf(m, ipstat.f, plural(ipstat.f))
p(ips_total, " %u total packet%s received\n");
p(ips_badsum, " %u bad header checksum%s\n");
p(ips_toosmall, " %u with size smaller than minimum\n");
p(ips_tooshort, " %u with data size < data length\n");
p(ips_badhlen, " %u with header length < data size\n");
p(ips_badlen, " %u with data length < header length\n");
p(ips_badoptions, " %u with bad options\n");
p(ips_badvers, " %u with incorrect version number\n");
p(ips_fragments, " %u fragment%s received\n");
p(ips_fragdropped, " %u fragment%s dropped (dup or out of space)\n");
p(ips_fragtimeout, " %u fragment%s dropped after timeout\n");
p(ips_reassembled, " %u packet%s reassembled ok\n");
p(ips_delivered, " %u packet%s for this host\n");
p(ips_noproto, " %u packet%s for unknown/unsupported protocol\n");
p(ips_forward, " %u packet%s forwarded\n");
p(ips_cantforward, " %u packet%s not forwardable\n");
p(ips_redirectsent, " %u redirect%s sent\n");
p(ips_localout, " %u packet%s sent from this host\n");
p(ips_rawout, " %u packet%s sent with fabricated ip header\n");
p(ips_odropped, " %u output packet%s dropped due to no bufs, etc.\n");
p(ips_noroute, " %u output packet%s discarded due to no route\n");
p(ips_fragmented, " %u output datagram%s fragmented\n");
p(ips_ofragments, " %u fragment%s created\n");
p(ips_cantfrag, " %u datagram%s that can't be fragmented\n");
#define p1a(f, m) if (ipstat.f || sflag <= 1) \
printf(m, ipstat.f)
p(ips_total, " %lu total packet%s received\n");
p(ips_badsum, " %lu bad header checksum%s\n");
p1a(ips_toosmall, " %lu with size smaller than minimum\n");
p1a(ips_tooshort, " %lu with data size < data length\n");
p1a(ips_badhlen, " %lu with header length < data size\n");
p1a(ips_badlen, " %lu with data length < header length\n");
p1a(ips_badoptions, " %lu with bad options\n");
p1a(ips_badvers, " %lu with incorrect version number\n");
p(ips_fragments, " %lu fragment%s received\n");
p(ips_fragdropped, " %lu fragment%s dropped (dup or out of space)\n");
p(ips_fragtimeout, " %lu fragment%s dropped after timeout\n");
p(ips_reassembled, " %lu packet%s reassembled ok\n");
p(ips_delivered, " %lu packet%s for this host\n");
p(ips_noproto, " %lu packet%s for unknown/unsupported protocol\n");
p(ips_forward, " %lu packet%s forwarded");
#if 0
p(ips_fastforward, " (%lu packet%s fast forwarded)");