version 1.62, 2002/06/09 04:07:10 |
version 1.63, 2003/02/01 01:51:31 |
|
|
static void protopr0(u_long, char *, int); |
static void protopr0(u_long, char *, int); |
|
|
char *inetname(struct in_addr *); |
char *inetname(struct in_addr *); |
void inetprint(struct in_addr *, int, char *, int); |
void inetprint(struct in_addr *, in_port_t, char *, int); |
#ifdef INET6 |
#ifdef INET6 |
char *inet6name(struct in6_addr *); |
char *inet6name(struct in6_addr *); |
void inet6print(struct in6_addr *, int, char *, int); |
void inet6print(struct in6_addr *, int, char *, int); |
|
|
* -a (all) flag is specified. |
* -a (all) flag is specified. |
*/ |
*/ |
void |
void |
protopr(off, name) |
protopr(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
protopr0(off, name, AF_INET); |
protopr0(off, name, AF_INET); |
} |
} |
|
|
#ifdef INET6 |
#ifdef INET6 |
void |
void |
ip6protopr(off, name) |
ip6protopr(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
protopr0(off, name, AF_INET6); |
protopr0(off, name, AF_INET6); |
} |
} |
#endif |
#endif |
|
|
static void |
static void |
protopr0(off, name, af) |
protopr0(u_long off, char *name, int af) |
u_long off; |
|
char *name; |
|
int af; |
|
{ |
{ |
struct inpcbtable table; |
struct inpcbtable table; |
struct inpcb *head, *next, *prev; |
struct inpcb *head, *next, *prev; |
|
|
name = name0; |
name = name0; |
#endif |
#endif |
printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc, |
printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc, |
sockb.so_snd.sb_cc); |
sockb.so_snd.sb_cc); |
#ifdef INET6 |
#ifdef INET6 |
if (inpcb.inp_flags & INP_IPV6) { |
if (inpcb.inp_flags & INP_IPV6) { |
inet6print(&inpcb.inp_laddr6, (int)inpcb.inp_lport, |
inet6print(&inpcb.inp_laddr6, (int)inpcb.inp_lport, |
name, 1); |
name, 1); |
inet6print(&inpcb.inp_faddr6, (int)inpcb.inp_fport, |
inet6print(&inpcb.inp_faddr6, (int)inpcb.inp_fport, |
name, 0); |
name, 0); |
} else |
} else |
#endif |
#endif |
{ |
{ |
inetprint(&inpcb.inp_laddr, (int)inpcb.inp_lport, |
inetprint(&inpcb.inp_laddr, (int)inpcb.inp_lport, |
name, 1); |
name, 1); |
inetprint(&inpcb.inp_faddr, (int)inpcb.inp_fport, |
inetprint(&inpcb.inp_faddr, (int)inpcb.inp_fport, |
name, 0); |
name, 0); |
} |
} |
if (istcp) { |
if (istcp) { |
if (tcpcb.t_state < 0 || tcpcb.t_state >= TCP_NSTATES) |
if (tcpcb.t_state < 0 || tcpcb.t_state >= TCP_NSTATES) |
|
|
* Dump TCP statistics structure. |
* Dump TCP statistics structure. |
*/ |
*/ |
void |
void |
tcp_stats(off, name) |
tcp_stats(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
struct tcpstat tcpstat; |
struct tcpstat tcpstat; |
|
|
if (off == 0) |
if (off == 0) |
return; |
return; |
printf ("%s:\n", name); |
printf("%s:\n", name); |
kread(off, (char *)&tcpstat, sizeof (tcpstat)); |
kread(off, (char *)&tcpstat, sizeof (tcpstat)); |
|
|
#define p(f, m) if (tcpstat.f || sflag <= 1) \ |
#define p(f, m) if (tcpstat.f || sflag <= 1) \ |
|
|
* Dump UDP statistics structure. |
* Dump UDP statistics structure. |
*/ |
*/ |
void |
void |
udp_stats(off, name) |
udp_stats(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
struct udpstat udpstat; |
struct udpstat udpstat; |
u_long delivered; |
u_long delivered; |
|
|
* Dump IP statistics structure. |
* Dump IP statistics structure. |
*/ |
*/ |
void |
void |
ip_stats(off, name) |
ip_stats(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
struct ipstat ipstat; |
struct ipstat ipstat; |
|
|
|
|
* Dump ICMP statistics. |
* Dump ICMP statistics. |
*/ |
*/ |
void |
void |
icmp_stats(off, name) |
icmp_stats(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
struct icmpstat icmpstat; |
struct icmpstat icmpstat; |
int i, first; |
int i, first; |
|
|
* Dump IGMP statistics structure. |
* Dump IGMP statistics structure. |
*/ |
*/ |
void |
void |
igmp_stats(off, name) |
igmp_stats(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
struct igmpstat igmpstat; |
struct igmpstat igmpstat; |
|
|
|
|
}; |
}; |
|
|
char * |
char * |
getrpcportnam(port, proto) |
getrpcportnam(in_port_t port, int proto) |
in_port_t port; |
|
int proto; |
|
{ |
{ |
struct sockaddr_in server_addr; |
struct sockaddr_in server_addr; |
struct hostent *hp; |
struct hostent *hp; |
|
|
* If the nflag was specified, use numbers instead of names. |
* If the nflag was specified, use numbers instead of names. |
*/ |
*/ |
void |
void |
inetprint(in, port, proto, local) |
inetprint(struct in_addr *in, in_port_t port, char *proto, int local) |
struct in_addr *in; |
|
in_port_t port; |
|
char *proto; |
|
int local; |
|
{ |
{ |
struct servent *sp = 0; |
struct servent *sp = 0; |
char line[80], *cp, *nam; |
char line[80], *cp, *nam; |
|
|
* numeric value, otherwise try for symbolic name. |
* numeric value, otherwise try for symbolic name. |
*/ |
*/ |
char * |
char * |
inetname(inp) |
inetname(struct in_addr *inp) |
struct in_addr *inp; |
|
{ |
{ |
char *cp; |
char *cp; |
static char line[50]; |
static char line[50]; |
|
|
* Dump AH statistics structure. |
* Dump AH statistics structure. |
*/ |
*/ |
void |
void |
ah_stats(off, name) |
ah_stats(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
struct ahstat ahstat; |
struct ahstat ahstat; |
|
|
|
|
* Dump etherip statistics structure. |
* Dump etherip statistics structure. |
*/ |
*/ |
void |
void |
etherip_stats(off, name) |
etherip_stats(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
struct etheripstat etheripstat; |
struct etheripstat etheripstat; |
|
|
|
|
#define p(f, m) if (etheripstat.f || sflag <= 1) \ |
#define p(f, m) if (etheripstat.f || sflag <= 1) \ |
printf(m, etheripstat.f, plural(etheripstat.f)) |
printf(m, etheripstat.f, plural(etheripstat.f)) |
|
|
|
|
p(etherip_hdrops, "\t%u packet%s shorter than header shows\n"); |
p(etherip_hdrops, "\t%u packet%s shorter than header shows\n"); |
p(etherip_qfull, "\t%u packet%s were dropped due to full output queue\n"); |
p(etherip_qfull, "\t%u packet%s were dropped due to full output queue\n"); |
p(etherip_noifdrops, "\t%u packet%s were dropped because of no interface/bridge information\n"); |
p(etherip_noifdrops, "\t%u packet%s were dropped because of no interface/bridge information\n"); |
|
|
* Dump ESP statistics structure. |
* Dump ESP statistics structure. |
*/ |
*/ |
void |
void |
esp_stats(off, name) |
esp_stats(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
struct espstat espstat; |
struct espstat espstat; |
|
|
|
|
* Dump ESP statistics structure. |
* Dump ESP statistics structure. |
*/ |
*/ |
void |
void |
ipip_stats(off, name) |
ipip_stats(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
struct ipipstat ipipstat; |
struct ipipstat ipipstat; |
|
|
|
|
p(ipips_qfull, "\t%u packet%s were dropped due to full output queue\n"); |
p(ipips_qfull, "\t%u packet%s were dropped due to full output queue\n"); |
p(ipips_ibytes, "\t%qu input byte%s\n"); |
p(ipips_ibytes, "\t%qu input byte%s\n"); |
p(ipips_obytes, "\t%qu output byte%s\n"); |
p(ipips_obytes, "\t%qu output byte%s\n"); |
p(ipips_family, "\t%u protocol family mismatches\n"); |
p(ipips_family, "\t%u protocol family mismatche%s\n"); |
p(ipips_unspec, "\t%u attempts to use tunnel with unspecified endpoint(s)\n"); |
p(ipips_unspec, "\t%u attempt%s to use tunnel with unspecified endpoint(s)\n"); |
#undef p |
#undef p |
} |
} |
|
|
|
|
* Dump IPCOMP statistics structure. |
* Dump IPCOMP statistics structure. |
*/ |
*/ |
void |
void |
ipcomp_stats(off, name) |
ipcomp_stats(u_long off, char *name) |
u_long off; |
|
char *name; |
|
{ |
{ |
struct ipcompstat ipcompstat; |
struct ipcompstat ipcompstat; |
|
|