diff options
Diffstat (limited to 'usr.bin/systat')
-rw-r--r-- | usr.bin/systat/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/systat/netcmds.c | 8 | ||||
-rw-r--r-- | usr.bin/systat/netstat.c | 39 |
3 files changed, 8 insertions, 43 deletions
diff --git a/usr.bin/systat/Makefile b/usr.bin/systat/Makefile index c9297af01e9..44612b558f6 100644 --- a/usr.bin/systat/Makefile +++ b/usr.bin/systat/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.14 2002/02/17 07:52:38 hugh Exp $ +# $OpenBSD: Makefile,v 1.15 2004/09/29 21:59:28 deraadt Exp $ PROG= systat @@ -12,8 +12,6 @@ LDADD= -lcurses -lm -lkvm BINGRP= kmem BINMODE=2555 -CPPFLAGS+=-DINET6 - .if (${MACHINE_ARCH} == "vax") cmds.o: ${CC} ${CFLAGS} ${CPPFLAGS} -O0 -c $< diff --git a/usr.bin/systat/netcmds.c b/usr.bin/systat/netcmds.c index 41786a583a5..0d9a54cbd37 100644 --- a/usr.bin/systat/netcmds.c +++ b/usr.bin/systat/netcmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netcmds.c,v 1.13 2004/04/26 19:22:30 itojun Exp $ */ +/* $OpenBSD: netcmds.c,v 1.14 2004/09/29 21:59:28 deraadt Exp $ */ /* $NetBSD: netcmds.c,v 1.4 1995/05/21 17:14:38 mycroft Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: netcmds.c,v 1.13 2004/04/26 19:22:30 itojun Exp $"; +static char rcsid[] = "$OpenBSD: netcmds.c,v 1.14 2004/09/29 21:59:28 deraadt Exp $"; #endif /* not lint */ /* @@ -260,13 +260,11 @@ addrcmp(struct sockaddr *sa1, struct sockaddr *sa2) ((struct sockaddr_in *)sa2)->sin_addr.s_addr) return 1; break; -#ifdef INET6 case AF_INET6: if (IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)sa1)->sin6_addr, &((struct sockaddr_in6 *)sa2)->sin6_addr)) return 1; break; -#endif default: if (memcmp(sa1, sa2, sa1->sa_len) == 0) return 1; @@ -319,7 +317,6 @@ checkhost(struct inpcb *inp) sin->sin_addr.s_addr == inp->inp_faddr.s_addr) return (p->onoff); } -#ifdef INET6 if (((struct sockaddr *)&p->addr)->sa_family == AF_INET6 && (inp->inp_flags & INP_IPV6)) { struct sockaddr_in6 *sin6; @@ -328,7 +325,6 @@ checkhost(struct inpcb *inp) IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr, &inp->inp_faddr6)) return (p->onoff); } -#endif } return (1); } diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c index 5ee0684460f..ba39b1b14a9 100644 --- a/usr.bin/systat/netstat.c +++ b/usr.bin/systat/netstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.c,v 1.25 2004/04/26 19:22:30 itojun Exp $ */ +/* $OpenBSD: netstat.c,v 1.26 2004/09/29 21:59:28 deraadt Exp $ */ /* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: netstat.c,v 1.25 2004/04/26 19:22:30 itojun Exp $"; +static char rcsid[] = "$OpenBSD: netstat.c,v 1.26 2004/09/29 21:59:28 deraadt Exp $"; #endif /* not lint */ /* @@ -78,10 +78,8 @@ static char rcsid[] = "$OpenBSD: netstat.c,v 1.25 2004/04/26 19:22:30 itojun Exp static void enter(struct inpcb *, struct socket *, int, char *); static const char *inetname(struct in_addr); static void inetprint(struct in_addr *, int, char *); -#ifdef INET6 static const char *inet6name(struct in6_addr *); static void inet6print(struct in6_addr *, int, char *); -#endif #define streq(a,b) (strcmp(a,b)==0) #define YMAX(w) ((w)->_maxy-1) @@ -105,14 +103,10 @@ struct netinfo { short nif_state; /* tcp state */ char *nif_proto; /* protocol */ struct in_addr nif_laddr; /* local address */ -#ifdef INET6 struct in6_addr nif_laddr6; /* local address */ -#endif long nif_lport; /* local port */ struct in_addr nif_faddr; /* foreign address */ -#ifdef INET6 struct in6_addr nif_faddr6; /* foreign address */ -#endif long nif_fport; /* foreign port */ long nif_rcvcc; /* rcv buffer character count */ long nif_sndcc; /* snd buffer character count */ @@ -216,20 +210,16 @@ again: prev = next; next = inpcb.inp_queue.cqe_next; -#ifndef INET6 if (inpcb.inp_flags & INP_IPV6) continue; -#endif if (!aflag) { if (!(inpcb.inp_flags & INP_IPV6) && inet_lnaof(inpcb.inp_laddr) == INADDR_ANY) continue; -#ifdef INET6 if ((inpcb.inp_flags & INP_IPV6) && IN6_IS_ADDR_UNSPECIFIED(&inpcb.inp_laddr6)) continue; -#endif } if (nhosts && !checkhost(&inpcb)) continue; @@ -262,12 +252,10 @@ enter(struct inpcb *inp, struct socket *so, int state, char *proto) * data structures. */ for (p = netcb.nif_forw; p != (struct netinfo *)&netcb; p = p->nif_forw) { -#ifdef INET6 if (p->nif_family == AF_INET && (inp->inp_flags & INP_IPV6)) continue; if (p->nif_family == AF_INET6 && !(inp->inp_flags & INP_IPV6)) continue; -#endif if (!streq(proto, p->nif_proto)) continue; if (p->nif_family == AF_INET) { @@ -278,18 +266,14 @@ enter(struct inpcb *inp, struct socket *so, int state, char *proto) p->nif_fport == inp->inp_fport) break; - } -#ifdef INET6 - else if (p->nif_family == AF_INET6) { + } else if (p->nif_family == AF_INET6) { if (p->nif_lport != inp->inp_lport || !IN6_ARE_ADDR_EQUAL(&p->nif_laddr6, &inp->inp_laddr6)) continue; if (IN6_ARE_ADDR_EQUAL(&p->nif_faddr6, &inp->inp_faddr6) && p->nif_fport == inp->inp_fport) break; - } -#endif - else + } else continue; } if (p == (struct netinfo *)&netcb) { @@ -306,14 +290,11 @@ enter(struct inpcb *inp, struct socket *so, int state, char *proto) p->nif_fport = inp->inp_fport; p->nif_proto = proto; p->nif_flags = NIF_LACHG|NIF_FACHG; -#ifdef INET6 if (inp->inp_flags & INP_IPV6) { p->nif_laddr6 = inp->inp_laddr6; p->nif_faddr6 = inp->inp_faddr6; p->nif_family = AF_INET6; - } else -#endif - { + } else { p->nif_laddr = inp->inp_laddr; p->nif_faddr = inp->inp_faddr; p->nif_family = AF_INET; @@ -399,12 +380,10 @@ shownetstat(void) inetprint(&p->nif_laddr, p->nif_lport, p->nif_proto); break; -#ifdef INET6 case AF_INET6: inet6print(&p->nif_laddr6, p->nif_lport, p->nif_proto); break; -#endif } p->nif_flags &= ~NIF_LACHG; } @@ -415,20 +394,16 @@ shownetstat(void) inetprint(&p->nif_faddr, p->nif_fport, p->nif_proto); break; -#ifdef INET6 case AF_INET6: inet6print(&p->nif_faddr6, p->nif_fport, p->nif_proto); break; -#endif } p->nif_flags &= ~NIF_FACHG; } mvwaddstr(wnd, p->nif_line, PROTO, p->nif_proto); -#ifdef INET6 if (p->nif_family == AF_INET6) waddstr(wnd, "6"); -#endif mvwprintw(wnd, p->nif_line, RCVCC, "%6d", p->nif_rcvcc); mvwprintw(wnd, p->nif_line, SNDCC, "%6d", p->nif_sndcc); if (streq(p->nif_proto, "tcp")) { @@ -475,7 +450,6 @@ inetprint(struct in_addr *in, int port, char *proto) waddstr(wnd, line); } -#ifdef INET6 static void inet6print(struct in6_addr *in6, int port, char *proto) { @@ -499,7 +473,6 @@ inet6print(struct in6_addr *in6, int port, char *proto) *cp = '\0'; waddstr(wnd, line); } -#endif /* * Construct an Internet address representation. @@ -542,7 +515,6 @@ inetname(struct in_addr in) return (line); } -#ifdef INET6 static const char * inet6name(struct in6_addr *in6) { @@ -562,7 +534,6 @@ inet6name(struct in6_addr *in6) return line; return "?"; } -#endif int cmdnetstat(char *cmd, char *args) |