version 1.71, 2003/10/31 09:00:32 |
version 1.72, 2003/11/02 10:23:58 |
|
|
struct inpcbtable table; |
struct inpcbtable table; |
struct inpcb *head, *next, *prev; |
struct inpcb *head, *next, *prev; |
struct inpcb inpcb; |
struct inpcb inpcb; |
int istcp; |
int istcp, israw; |
int first = 1; |
int first = 1; |
char *name0; |
char *name0; |
char namebuf[20]; |
char namebuf[20]; |
|
|
if (off == 0) |
if (off == 0) |
return; |
return; |
istcp = strcmp(name, "tcp") == 0; |
istcp = strcmp(name, "tcp") == 0; |
|
israw = strncmp(name, "ip", 2) == 0; |
kread(off, (char *)&table, sizeof table); |
kread(off, (char *)&table, sizeof table); |
prev = head = |
prev = head = |
(struct inpcb *)&((struct inpcbtable *)off)->inpt_queue.cqh_first; |
(struct inpcb *)&((struct inpcbtable *)off)->inpt_queue.cqh_first; |
|
|
printf("%*p ", PLEN, prev); |
printf("%*p ", PLEN, prev); |
} |
} |
#ifdef INET6 |
#ifdef INET6 |
if (inpcb.inp_flags & INP_IPV6) { |
if (inpcb.inp_flags & INP_IPV6 && !israw) { |
strlcpy(namebuf, name0, sizeof namebuf); |
strlcpy(namebuf, name0, sizeof namebuf); |
strlcat(namebuf, "6", sizeof namebuf); |
strlcat(namebuf, "6", sizeof namebuf); |
name = namebuf; |
name = namebuf; |
|
|
printf(" %d", tcpcb.t_state); |
printf(" %d", tcpcb.t_state); |
else |
else |
printf(" %s", tcpstates[tcpcb.t_state]); |
printf(" %s", tcpstates[tcpcb.t_state]); |
|
} else if (israw) { |
|
struct protoent *pe = NULL; |
|
u_int8_t proto; |
|
#ifdef INET6 |
|
if (inpcb.inp_flags & INP_IPV6) |
|
proto = inpcb.inp_ipv6.ip6_nxt; |
|
else |
|
#endif |
|
proto = inpcb.inp_ip.ip_p; |
|
if (!nflag) |
|
pe = getprotobynumber(proto); |
|
if (pe) |
|
printf(" %s", pe->p_name); |
|
else |
|
printf(" %u", proto); |
} |
} |
putchar('\n'); |
putchar('\n'); |
} |
} |