git: dc02374f5445 - main - Fix KASSERT in 80044c78 causing build failures

From: Allan Jude <allanjude_at_FreeBSD.org>
Date: Tue, 16 Jan 2024 23:15:18 UTC
The branch main has been updated by allanjude:

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

commit dc02374f54455e354495870c24f86bb2966a7960
Author:     Allan Jude <allanjude@FreeBSD.org>
AuthorDate: 2024-01-16 23:12:30 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2024-01-16 23:15:00 +0000

    Fix KASSERT in 80044c78 causing build failures
    
    Move the KASSERT to where struct ip6_hdr is populated
    
    Fixes:          80044c785cb040a2cf73779d23f9e1e81a00c6c3
    Reported-by:    bapt
    Reviewed-by:    markj
    Sponsored-by:   Klara, Inc.
---
 sys/netipsec/udpencap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/netipsec/udpencap.c b/sys/netipsec/udpencap.c
index 960e7d3d1c9f..e5b286b5ae69 100644
--- a/sys/netipsec/udpencap.c
+++ b/sys/netipsec/udpencap.c
@@ -259,8 +259,6 @@ udp_ipsec_output(struct mbuf *m, struct secasvar *sav)
 #endif
 #ifdef INET6
 	case AF_INET6:
-		KASSERT(ip6->ip6_nxt == IPPROTO_ESP,
-		    ("unexpected next header type %d", ip->ip6_nxt));
 		hlen = sizeof(struct ip6_hdr);
 		break;
 #endif
@@ -297,6 +295,8 @@ udp_ipsec_output(struct mbuf *m, struct secasvar *sav)
 		struct ip6_hdr *ip6;
 
 		ip6 = mtod(m, struct ip6_hdr *);
+		KASSERT(ip6->ip6_nxt == IPPROTO_ESP,
+		    ("unexpected next header type %d", ip6->ip6_nxt));
 		ip6->ip6_plen = htons(m->m_pkthdr.len);
 		ip6->ip6_nxt = IPPROTO_UDP;
 		udp->uh_sum = in6_cksum_pseudo(ip6,