diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -153,6 +153,14 @@ CFLAGS+= ${GCOV_CFLAGS} +INET_ENABLED!= grep INET opt_inet.h || true ; echo +INET6_ENABLED!= grep INET6 opt_inet6.h || true ; echo +.if empty(INET_ENABLED) || empty(INET6_ENABLED) +CONF_CFLAGS+= -Wno-error=unused-variable +CONF_CFLAGS+= -Wno-error=unused-but-set-variable +CONF_CFLAGS+= -Wno-error=unused-function +.endif + # Put configuration-specific C flags last so that they can override # the others. CFLAGS+= ${CONF_CFLAGS} diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -208,10 +208,8 @@ { uint32_t lleflags = 0; int error = 0; -#if defined(INET) || defined(INET6) struct ether_header *eh = (struct ether_header *)phdr; uint16_t etype; -#endif if (plle) *plle = NULL; diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -477,9 +477,7 @@ llentry_print_buf(const struct llentry *lle, struct ifnet *ifp, int family, char *buf, size_t bufsize) { -#if defined(INET) || defined(INET6) char abuf[INET6_ADDRSTRLEN]; -#endif const char *valid = (lle->r_flags & RLLE_VALID) ? "valid" : "no_l2"; const char *upper_str = rib_print_family(llentry_get_upper_family(lle, family)); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -476,9 +476,7 @@ rtm_get_jailed(struct rt_addrinfo *info, struct ifnet *ifp, struct nhop_object *nh, union sockaddr_union *saun, struct ucred *cred) { -#if defined(INET) || defined(INET6) struct epoch_tracker et; -#endif /* First, see if the returned address is part of the jail. */ if (prison_if(cred, nh->nh_ifa->ifa_addr) == 0) { @@ -1003,7 +1001,6 @@ } #endif -#if defined(INET6) || defined(INET) static struct sockaddr * alloc_sockaddr_aligned(struct linear_buffer *lb, int len) { @@ -1014,7 +1011,6 @@ lb->offset += len; return (sa); } -#endif static int rts_send(struct socket *so, int flags, struct mbuf *m, @@ -1023,11 +1019,9 @@ struct rt_msghdr *rtm = NULL; struct rt_addrinfo info; struct epoch_tracker et; -#ifdef INET6 struct sockaddr_storage ss; struct sockaddr_in6 *sin6; int i, rti_need_deembed = 0; -#endif int alloc_len = 0, len, error = 0, fibnum; sa_family_t saf = AF_UNSPEC; struct rib_cmd_info rc;