git: b20f0e608df2 - stable/15 - divert: unbreak the LINT-NOIP build

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 01 Apr 2026 00:33:28 UTC
The branch stable/15 has been updated by markj:

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

commit b20f0e608df2cbb50f382b6d347a71904cb1faeb
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-02-26 23:06:36 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-04-01 00:27:24 +0000

    divert: unbreak the LINT-NOIP build
    
    Only expose `dcb` when either `INET` or `INET6` is defined.
    
    Reported by:    clang (`-Wunused`)
    MFC after:      1 week
    Fixes 5547a7bb39 ("divert: Use a better source identifier...")
    Differential Revision: https://reviews.freebsd.org/D55548
    
    (cherry picked from commit bd758ebac3272f720c051570e043e4bc653dcd48)
---
 sys/netinet/ip_divert.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 75371c7dacb3..046df7f99ed8 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -503,10 +503,11 @@ static int
 div_output_inbound(int family, struct socket *so, struct mbuf *m,
     struct sockaddr_in *sin)
 {
-	struct divcb *dcb;
+#if defined(INET) || defined(INET6)
+	struct divcb *dcb = so->so_pcb;
+#endif
 	struct ifaddr *ifa;
 
-	dcb = so->so_pcb;
 	if (m->m_pkthdr.rcvif == NULL) {
 		/*
 		 * No luck with the name, check by IP address.