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 diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index b858b328a74a..2a2cafa6ae9b 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1619,6 +1619,7 @@ iovlist_append(struct iovlist *il, const char *str) } } +#if defined(INET) || defined(INET6) static void iovlist_truncate(struct iovlist *il, size_t size) { @@ -1639,6 +1640,7 @@ iovlist_truncate(struct iovlist *il, size_t size) } } } +#endif static void fprintlog_write(struct filed *f, struct iovlist *il, int flags) @@ -2959,7 +2961,11 @@ timedout(int sig __unused) * Returns -1 on error, 0 if the argument was valid. */ static int +#if defined(INET) || defined(INET6) allowaddr(char *s) +#else +allowaddr(char *s __unused) +#endif { #if defined(INET) || defined(INET6) char *cp1, *cp2; @@ -3121,13 +3127,13 @@ allowaddr(char *s) } printf("port = %d\n", ap->port); } -#endif return (0); err: if (res != NULL) freeaddrinfo(res); free(ap); +#endif return (-1); }