git: 93c5ba5a83d6 - main - sys/netpfil/pf: fix non-INET module build

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 23 Apr 2024 21:43:23 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=93c5ba5a83d6e23329e9ca9b9ed72eea613b611d

commit 93c5ba5a83d6e23329e9ca9b9ed72eea613b611d
Author:     Lexi Winter <lexi@le-Fay.ORG>
AuthorDate: 2024-04-22 21:59:12 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-23 21:13:21 +0000

    sys/netpfil/pf: fix non-INET module build
    
    pf.ko, when built as a module without 'options INET' but with 'options
    VIMAGE', won't load:
    
    link_elf_obj: symbol vnet_entry_in_loopback_mask undefined
    
    This is because it uses IN_LOOPBACK(), which in the VIMAGE case uses
    INET-specific symbols.
    
    Fix by making this check conditional on #ifdef INET.
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1157
---
 sys/netpfil/pf/pf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index cbf5ebfc0e56..0dd4da5f271a 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -7956,7 +7956,10 @@ pf_dummynet_route(struct pf_pdesc *pd, struct pf_kstate *s,
 
 		if (s != NULL && s->nat_rule.ptr != NULL &&
 		    s->nat_rule.ptr->action == PF_RDR &&
-		    ((pd->af == AF_INET && IN_LOOPBACK(ntohl(pd->dst->v4.s_addr))) ||
+		    (
+#ifdef INET
+		    (pd->af == AF_INET && IN_LOOPBACK(ntohl(pd->dst->v4.s_addr))) ||
+#endif
 		    (pd->af == AF_INET6 && IN6_IS_ADDR_LOOPBACK(&pd->dst->v6)))) {
 			/*
 			 * If we're redirecting to loopback mark this packet