diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-06-30 20:04:02 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-06-30 20:04:02 +0000 |
commit | d8555709fb109a1e472d5f62b8693801aa37dc4e (patch) | |
tree | 9e6e86034179dfc91877fa79ae53ddf5aaf29035 /usr.bin | |
parent | edf5208f386fde858a8737bfb193a107f482a1f7 (diff) |
split netstat -an -f inet and netstat -an -f inet6, for consistency.
Suggested by: fgs
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/netstat/inet.c | 38 | ||||
-rw-r--r-- | usr.bin/netstat/main.c | 8 | ||||
-rw-r--r-- | usr.bin/netstat/netstat.h | 5 |
3 files changed, 46 insertions, 5 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 88a3848193b..687ec34429a 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -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 inpcb inpcb; 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 @@ protopr(off, name) 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; @@ -135,6 +156,19 @@ protopr(off, name) 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) continue; diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index ea38e3308d5..9e8346677ba 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.21 2000/01/21 03:24:06 angelos Exp $ */ +/* $OpenBSD: main.c,v 1.22 2000/06/30 20:04:01 itojun Exp $ */ /* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */ /* @@ -44,7 +44,7 @@ char copyright[] = #if 0 static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94"; #else -static char *rcsid = "$OpenBSD: main.c,v 1.21 2000/01/21 03:24:06 angelos Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.22 2000/06/30 20:04:01 itojun Exp $"; #endif #endif /* not lint */ @@ -206,6 +206,10 @@ struct protox { #ifdef INET6 struct protox ip6protox[] = { + { N_TCBTABLE, N_TCPSTAT, 1, ip6protopr, + tcp_stats, "tcp" }, + { N_UDBTABLE, N_UDPSTAT, 1, ip6protopr, + udp_stats, "udp" }, { -1, N_IP6STAT, 1, 0, ip6_stats, "ip6" }, { -1, N_ICMP6STAT, 1, 0, diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index 88355fde585..b6343d3f455 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.h,v 1.14 2000/01/21 03:24:06 angelos Exp $ */ +/* $OpenBSD: netstat.h,v 1.15 2000/06/30 20:04:01 itojun Exp $ */ /* $NetBSD: netstat.h,v 1.6 1996/05/07 02:55:05 thorpej Exp $ */ /* @@ -69,6 +69,9 @@ char *plural __P((int)); char *plurales __P((int)); void protopr __P((u_long, char *)); +#ifdef INET6 +void ip6protopr __P((u_long, char *)); +#endif void tcp_stats __P((u_long, char *)); void udp_stats __P((u_long, char *)); void ip_stats __P((u_long, char *)); |