git: 5fce28c2f81d - stable/14 - cxgbe nic TLS: Correct IPv6 payload length

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 29 Jan 2026 15:39:54 UTC
The branch stable/14 has been updated by jhb:

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

commit 5fce28c2f81d070c6321c9c5dc8d03831f32b242
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-05-30 23:17:45 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-01-29 15:18:17 +0000

    cxgbe nic TLS: Correct IPv6 payload length
    
    Sponsored by:   Chelsio Communications
    
    (cherry picked from commit 54f8c44ecf4a28a649d75ad6d0daaf3206ae9247)
---
 sys/dev/cxgbe/crypto/t6_kern_tls.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sys/dev/cxgbe/crypto/t6_kern_tls.c b/sys/dev/cxgbe/crypto/t6_kern_tls.c
index 0e7bd305869b..d0da7ec2f61d 100644
--- a/sys/dev/cxgbe/crypto/t6_kern_tls.c
+++ b/sys/dev/cxgbe/crypto/t6_kern_tls.c
@@ -1168,7 +1168,8 @@ ktls_write_tcp_options(struct sge_txq *txq, void *dst, struct mbuf *m,
 	} else {
 		ip6 = (void *)((char *)eh + m->m_pkthdr.l2hlen);
 		newip6 = *ip6;
-		newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen);
+		newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen -
+		    sizeof(*ip6));
 		copy_to_txd(&txq->eq, (caddr_t)&newip6, &out, sizeof(newip6));
 		MPASS(m->m_pkthdr.l3hlen == sizeof(*ip6));
 		ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP6) |
@@ -1268,7 +1269,8 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *dst, struct mbuf *m,
 	} else {
 		ip6 = (void *)((char *)eh + m->m_pkthdr.l2hlen);
 		newip6 = *ip6;
-		newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen);
+		newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen -
+		    sizeof(*ip6));
 		copy_to_txd(&txq->eq, (caddr_t)&newip6, &out, sizeof(newip6));
 		MPASS(m->m_pkthdr.l3hlen == sizeof(*ip6));
 		ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP6) |
@@ -1912,7 +1914,8 @@ ktls_write_tcp_fin(struct sge_txq *txq, void *dst, struct mbuf *m,
 	} else {
 		ip6 = (void *)((char *)eh + m->m_pkthdr.l2hlen);
 		newip6 = *ip6;
-		newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen);
+		newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen -
+		    sizeof(*ip6));
 		copy_to_txd(&txq->eq, (caddr_t)&newip6, &out, sizeof(newip6));
 		MPASS(m->m_pkthdr.l3hlen == sizeof(*ip6));
 		ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP6) |