git: 4a59a0cf99bb - main - netinet6: Add a definition of struct ip6_hdr_pseudo{} for OCF compatibility.

Bruce M Simpson <[email protected]> Mon, 03 Aug 2026 11:28:34 +0000
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a707b62.186ca.7f9db7bb__37890.9518754639$1785756564$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by bms:

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

commit 4a59a0cf99bb9a48ccea62e9499186e892cf51bc
Author:     Bruce M Simpson <[email protected]>
AuthorDate: 2026-07-30 15:53:11 +0000
Commit:     Bruce M Simpson <[email protected]>
CommitDate: 2026-08-03 11:27:44 +0000

    netinet6: Add a definition of struct ip6_hdr_pseudo{} for OCF compatibility.
    
    This change is intended to address @glebius comments from the original D55663.
    ip6_hdr_pseudo{} is referenced by certain OpenBSD OCF related components. I am
    using __aligned(4) and not __packed as urged by the late Hans-Petter Selasky.
    Use C99 types and style. We must eat the churn now cross-BSD compatibility
    is "Fade to Black".
    
    Put _Static_assert under #ifdef INVARIANTS to not disrupt regular compilation,
    as this resides in a commonly included header file.
---
 sys/netinet6/ip6_var.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
index 9a861ab20647..769a254cdf52 100644
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -66,6 +66,24 @@
 #include <sys/epoch.h>
 
 #ifdef _KERNEL
+/*
+ * For IPv6 pseudo header checksum; to be used by TCP-MD5,
+ * and for OCF source level compatibility with OpenBSD.
+ */
+struct ip6_hdr_pseudo {
+	struct in6_addr ip6ph_src;
+	struct in6_addr ip6ph_dst;
+	uint32_t	ip6ph_len;
+	uint8_t		ip6ph_zero[3];
+	uint8_t		ip6ph_nxt;
+} __aligned(4);
+
+#ifdef INVARIANTS
+/* Aligned size of pseudo-header must equal size of IPv6 header. */
+_Static_assert(sizeof(struct ip6_hdr_pseudo) == 40,
+    "IPv6 pseudo-header alignment failure");
+#endif
+
 struct ip6asfrag;		/* frag6.c */
 TAILQ_HEAD(ip6fraghead, ip6asfrag);