The branch main has been updated by bms:

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

commit b451bdb7894dea69f74dd641861f800ac2268f5c
Author:     Bruce M Simpson <[email protected]>
AuthorDate: 2026-07-30 16:08:34 +0000
Commit:     Bruce M Simpson <[email protected]>
CommitDate: 2026-08-03 11:27:45 +0000

    netipsec: Refactor TCP-MD5 shim to use ip6_hdr_pseudo{} for brevity.
    
    This brings xform_tcp.c into line with possible future OCF related imports.
---
 sys/netipsec/xform_tcp.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/sys/netipsec/xform_tcp.c b/sys/netipsec/xform_tcp.c
index a87b27048dd7..f2e8f4975e35 100644
--- a/sys/netipsec/xform_tcp.c
+++ b/sys/netipsec/xform_tcp.c
@@ -63,6 +63,7 @@
 
 #ifdef INET6
 #include <netinet/ip6.h>
+#include <netinet6/ip6_var.h>
 #include <netipsec/ipsec6.h>
 #endif
 
@@ -154,25 +155,23 @@ ip_pseudo_compute(struct mbuf *m, MD5_CTX *ctx)
 static int
 ip6_pseudo_compute(struct mbuf *m, MD5_CTX *ctx)
 {
-       struct ip6_pseudo {
-               struct in6_addr src, dst;
-               uint32_t len;
-               uint32_t nxt;
-       } ip6p __aligned(4);
+       struct ip6_hdr_pseudo ip6ph = {
+               .ip6ph_zero = {}
+       };
        struct ip6_hdr *ip6;
        int hdr_len;
 
        ip6 = mtod(m, struct ip6_hdr *);
-       ip6p.src = ip6->ip6_src;
-       ip6p.dst = ip6->ip6_dst;
+       ip6ph.ip6ph_src = ip6->ip6_src;
+       ip6ph.ip6ph_dst = ip6->ip6_dst;
        hdr_len = sizeof(struct ip6_hdr);
        if (ip6->ip6_nxt == IPPROTO_UDP)
                /* TCP over UDP */
                hdr_len += sizeof(struct udphdr);
-       /* XXX: ext headers */
-       ip6p.len = htonl(m->m_pkthdr.len - hdr_len);
-       ip6p.nxt = htonl(IPPROTO_TCP);
-       MD5Update(ctx, (char *)&ip6p, sizeof(ip6p));
+       /* Append TCP segment and fixup length. */
+       ip6ph.ip6ph_len = htonl(m->m_pkthdr.len - hdr_len);
+       ip6ph.ip6ph_nxt = IPPROTO_TCP;
+       MD5Update(ctx, &ip6ph, sizeof(ip6ph));
        return (hdr_len);
 }
 #endif

Reply via email to