version 1.4, 1996/08/06 18:05:51 |
version 1.5, 1996/08/12 19:45:47 |
|
|
#include <netinet/ip.h> |
#include <netinet/ip.h> |
#include <netinet/in_pcb.h> |
#include <netinet/in_pcb.h> |
|
|
|
#include <arpa/inet.h> |
|
|
#include <ctype.h> |
#include <ctype.h> |
#include <errno.h> |
#include <errno.h> |
#include <kvm.h> |
#include <kvm.h> |
|
|
switch(dom.dom_family) { |
switch(dom.dom_family) { |
case AF_INET: |
case AF_INET: |
getinetproto(proto.pr_protocol); |
getinetproto(proto.pr_protocol); |
if (proto.pr_protocol == IPPROTO_TCP ) { |
if (proto.pr_protocol == IPPROTO_TCP) { |
if (so.so_pcb) { |
if (so.so_pcb == NULL) |
if (kvm_read(kd, (u_long)so.so_pcb, |
break; |
(char *)&inpcb, sizeof(struct inpcb)) |
if (kvm_read(kd, (u_long)so.so_pcb, (char *)&inpcb, |
!= sizeof(struct inpcb)) { |
sizeof(struct inpcb)) != sizeof(struct inpcb)) { |
dprintf(stderr, |
dprintf(stderr, "can't read inpcb at %x\n", |
"can't read inpcb at %x\n", |
so.so_pcb); |
so.so_pcb); |
goto bad; |
goto bad; |
|
} |
|
printf(" %lx", (long)inpcb.inp_ppcb); |
|
} |
} |
} |
printf(" %lx", (long)inpcb.inp_ppcb); |
else if (so.so_pcb) |
printf(" %s:%d", |
|
inpcb.inp_laddr.s_addr == INADDR_ANY ? "*" : |
|
inet_ntoa(inpcb.inp_laddr), |
|
ntohs(inpcb.inp_lport)); |
|
if (inpcb.inp_fport) |
|
printf(" -> %s:%d", |
|
inpcb.inp_faddr.s_addr == INADDR_ANY ? "*" : |
|
inet_ntoa(inpcb.inp_faddr), |
|
ntohs(inpcb.inp_fport)); |
|
} else if (proto.pr_protocol == IPPROTO_UDP) { |
|
if (so.so_pcb == NULL) |
|
break; |
|
if (kvm_read(kd, (u_long)so.so_pcb, (char *)&inpcb, |
|
sizeof(struct inpcb)) != sizeof(struct inpcb)) { |
|
dprintf(stderr, "can't read inpcb at %x\n", |
|
so.so_pcb); |
|
goto bad; |
|
} |
|
printf(" %s:%d", |
|
inpcb.inp_laddr.s_addr == INADDR_ANY ? "*" : |
|
inet_ntoa(inpcb.inp_laddr), |
|
ntohs(inpcb.inp_lport)); |
|
if (inpcb.inp_fport) |
|
printf(" -> %s:%d", |
|
inpcb.inp_faddr.s_addr == INADDR_ANY ? "*" : |
|
inet_ntoa(inpcb.inp_faddr), |
|
ntohs(inpcb.inp_fport)); |
|
} else if (so.so_pcb) |
printf(" %lx", (long)so.so_pcb); |
printf(" %lx", (long)so.so_pcb); |
break; |
break; |
case AF_UNIX: |
case AF_UNIX: |