git: 54f8c44ecf4a - main - cxgbe nic TLS: Correct IPv6 payload length

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 30 May 2025 23:30:03 UTC
The branch main has been updated by jhb:

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

commit 54f8c44ecf4a28a649d75ad6d0daaf3206ae9247
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-05-30 23:17:45 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-05-30 23:29:42 +0000

    cxgbe nic TLS: Correct IPv6 payload length
    
    Sponsored by:   Chelsio Communications
---
 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 897773d2d867..04bb6c944050 100644
--- a/sys/dev/cxgbe/crypto/t6_kern_tls.c
+++ b/sys/dev/cxgbe/crypto/t6_kern_tls.c
@@ -1167,7 +1167,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) |
@@ -1267,7 +1268,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) |
@@ -1911,7 +1913,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) |