summaryrefslogtreecommitdiff
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2019-04-19 17:28:38 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2019-04-19 17:28:38 +0000
commit75b3fc347129e3beed815011d580efd575e8ada5 (patch)
treed2b2884c907bf6eecaf86e94bfc1ac8678a77144 /usr.bin/netstat
parentfe018360ad25240be89de775e2f39eea4dd22857 (diff)
Notes
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/inet.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 71219210c141..67a74300b817 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -85,8 +85,10 @@ __FBSDID("$FreeBSD$");
#include "netstat.h"
#include "nl_defs.h"
-void inetprint(const char *, struct in_addr *, int, const char *, int,
+#ifdef INET
+static void inetprint(const char *, struct in_addr *, int, const char *, int,
const int);
+#endif
#ifdef INET6
static int udp_done, tcp_done, sdp_done;
#endif /* INET6 */
@@ -390,6 +392,7 @@ protopr(u_long off, const char *name, int af1, int proto)
so->so_rcv.sb_cc, so->so_snd.sb_cc);
}
if (numeric_port) {
+#ifdef INET
if (inp->inp_vflag & INP_IPV4) {
inetprint("local", &inp->inp_laddr,
(int)inp->inp_lport, name, 1, af1);
@@ -397,8 +400,12 @@ protopr(u_long off, const char *name, int af1, int proto)
inetprint("remote", &inp->inp_faddr,
(int)inp->inp_fport, name, 1, af1);
}
+#endif
+#if defined(INET) && defined(INET6)
+ else
+#endif
#ifdef INET6
- else if (inp->inp_vflag & INP_IPV6) {
+ if (inp->inp_vflag & INP_IPV6) {
inet6print("local", &inp->in6p_laddr,
(int)inp->inp_lport, name, 1);
if (!Lflag)
@@ -407,6 +414,7 @@ protopr(u_long off, const char *name, int af1, int proto)
} /* else nothing printed now */
#endif /* INET6 */
} else if (inp->inp_flags & INP_ANONPORT) {
+#ifdef INET
if (inp->inp_vflag & INP_IPV4) {
inetprint("local", &inp->inp_laddr,
(int)inp->inp_lport, name, 1, af1);
@@ -414,8 +422,12 @@ protopr(u_long off, const char *name, int af1, int proto)
inetprint("remote", &inp->inp_faddr,
(int)inp->inp_fport, name, 0, af1);
}
+#endif
+#if defined(INET) && defined(INET6)
+ else
+#endif
#ifdef INET6
- else if (inp->inp_vflag & INP_IPV6) {
+ if (inp->inp_vflag & INP_IPV6) {
inet6print("local", &inp->in6p_laddr,
(int)inp->inp_lport, name, 1);
if (!Lflag)
@@ -424,6 +436,7 @@ protopr(u_long off, const char *name, int af1, int proto)
} /* else nothing printed now */
#endif /* INET6 */
} else {
+#ifdef INET
if (inp->inp_vflag & INP_IPV4) {
inetprint("local", &inp->inp_laddr,
(int)inp->inp_lport, name, 0, af1);
@@ -433,8 +446,12 @@ protopr(u_long off, const char *name, int af1, int proto)
inp->inp_lport != inp->inp_fport,
af1);
}
+#endif
+#if defined(INET) && defined(INET6)
+ else
+#endif
#ifdef INET6
- else if (inp->inp_vflag & INP_IPV6) {
+ if (inp->inp_vflag & INP_IPV6) {
inet6print("local", &inp->in6p_laddr,
(int)inp->inp_lport, name, 0);
if (!Lflag)
@@ -1314,10 +1331,11 @@ pim_stats(u_long off __unused, const char *name, int af1 __unused,
xo_close_container(name);
}
+#ifdef INET
/*
* Pretty print an Internet address (net address + port).
*/
-void
+static void
inetprint(const char *container, struct in_addr *in, int port,
const char *proto, int num_port, const int af1)
{
@@ -1404,3 +1422,4 @@ inetname(struct in_addr *inp)
}
return (line);
}
+#endif