=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/netstat/inet.c,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- src/usr.bin/netstat/inet.c 2000/06/15 20:05:48 1.47 +++ src/usr.bin/netstat/inet.c 2000/06/30 20:04:01 1.48 @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.47 2000/06/15 20:05:48 angelos Exp $ */ +/* $OpenBSD: inet.c,v 1.48 2000/06/30 20:04:01 itojun Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -static char *rcsid = "$OpenBSD: inet.c,v 1.47 2000/06/15 20:05:48 angelos Exp $"; +static char *rcsid = "$OpenBSD: inet.c,v 1.48 2000/06/30 20:04:01 itojun Exp $"; #endif #endif /* not lint */ @@ -91,6 +91,8 @@ struct tcpcb tcpcb; struct socket sockb; +static void protopr0 __P((u_long, char *, int)); + char *inetname __P((struct in_addr *)); void inetprint __P((struct in_addr *, int, char *, int)); #ifdef INET6 @@ -109,6 +111,25 @@ u_long off; char *name; { + protopr0(off, name, AF_INET); +} + +#ifdef INET6 +void +ip6protopr(off, name) + u_long off; + char *name; +{ + protopr0(off, name, AF_INET6); +} +#endif + +static void +protopr0(off, name, af) + u_long off; + char *name; + int af; +{ struct inpcbtable table; register struct inpcb *head, *next, *prev; struct inpcb inpcb; @@ -134,6 +155,19 @@ } prev = next; next = inpcb.inp_queue.cqe_next; + + switch (af) { + case AF_INET: + if ((inpcb.inp_flags & INP_IPV6) != 0) + continue; + break; + case AF_INET6: + if ((inpcb.inp_flags & INP_IPV6) == 0) + continue; + break; + default: + break; + } if (!aflag && inet_lnaof(inpcb.inp_laddr) == INADDR_ANY)