Fix compilation of world with WITHOUT_{INET,INET6}_SUPPORT or both set.

Buildworld failed when both WITHOUT_INET6_SUPPORT and INET equivalent were set.
Fix netstat and syslogd by applying appropriate #ifdef INET/INET6 to make world
compile again.

Reviewed by:		ngie, hrs, ume
Welcomed by:		Michael Dexter (D17040)
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D19418
This commit is contained in:
Bjoern A. Zeeb 2019-03-03 10:00:26 +00:00
parent 27a1e60984
commit 9784899d58
2 changed files with 31 additions and 6 deletions

View File

@ -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

View File

@ -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);
}