git: 331335c1b846 - releng/13.1 - Fix kernel build without INET or INET6

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 30 Mar 2022 19:07:27 UTC
The branch releng/13.1 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=331335c1b846fce7044bba1aac76c9017cf70800

commit 331335c1b846fce7044bba1aac76c9017cf70800
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-12-30 21:49:35 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-03-30 19:06:40 +0000

    Fix kernel build without INET or INET6
    
    Reported by:    Gary Jennejohn
    Fixes:          ff3a85d32411 ("[lltable] Add per-family lltable ...")
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 818952c638a72bd677345fd8ddd05c31b34a2aee)
    (cherry picked from commit 85f3c0a1c3762f32dd133deea5951de205e2450b)
    
    Reviewed by:    brooks, melifaro
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D33718
    
    (cherry picked from commit a6668e31aa3cc855bfb37d6edc05122514592a47)
    (cherry picked from commit 1c487a5d3daccb8489c710d8cfabaa83fde1ca58)
    
    Approved by:    re (gjb)
---
 sys/net/if_llatbl.c      | 6 ++++++
 sys/net/route/nhop_ctl.c | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c
index c61a19f39de2..b82bc9fc104c 100644
--- a/sys/net/if_llatbl.c
+++ b/sys/net/if_llatbl.c
@@ -443,7 +443,9 @@ char *
 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));
@@ -781,10 +783,14 @@ struct lltable *
 lltable_get(struct ifnet *ifp, int family)
 {
 	switch (family) {
+#ifdef INET
 	case AF_INET:
 		return (in_lltable_get(ifp));
+#endif
+#ifdef INET6
 	case AF_INET6:
 		return (in6_lltable_get(ifp));
+#endif
 	}
 
 	return (NULL);
diff --git a/sys/net/route/nhop_ctl.c b/sys/net/route/nhop_ctl.c
index 233a2a677678..16b8ca46739a 100644
--- a/sys/net/route/nhop_ctl.c
+++ b/sys/net/route/nhop_ctl.c
@@ -830,7 +830,9 @@ nhops_update_ifmtu(struct rib_head *rh, struct ifnet *ifp, uint32_t mtu)
 char *
 nhop_print_buf(const struct nhop_object *nh, char *buf, size_t bufsize)
 {
+#if defined(INET) || defined(INET6)
 	char abuf[INET6_ADDRSTRLEN];
+#endif
 	struct nhop_priv *nh_priv = nh->nh_priv;
 	const char *upper_str = rib_print_family(nh->nh_priv->nh_upper_family);