git: 8aab44ce3b6a - main - netinet6?: move struct ip6?_moptions definition to in6?_var.h

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Fri, 18 Sep 2026 22:42:59 UTC
The branch main has been updated by glebius:

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

commit 8aab44ce3b6a538d63b10c65f67c57b720ce01f7
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-09-18 22:06:01 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-09-18 22:42:41 +0000

    netinet6?: move struct ip6?_moptions definition to in6?_var.h
    
    Rest of multicast related kernel structures live in in6?_var.h and this
    piece of ip6?_var.h was anyway requiring in6?_var.h to be included before.
    
    Differential Revision:  https://reviews.freebsd.org/D55963
---
 sys/netinet/in_var.h   | 14 +++++++++++---
 sys/netinet/ip_var.h   | 19 +------------------
 sys/netinet6/in6_var.h | 12 +++++++++---
 sys/netinet6/ip6_var.h | 16 +---------------
 4 files changed, 22 insertions(+), 39 deletions(-)

diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index e9db1efd9fe9..a0ef2f4d65b0 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -209,9 +209,18 @@ struct in_mfilter {
 };
 
 /*
- * Helper types and functions for IPv4 multicast filters.
+ * Structure attached to inpcb.ip_moptions and passed to ip_output() when IP
+ * multicast options are in use.
+ * This structure is lazy-allocated.
  */
-STAILQ_HEAD(ip_mfilter_head, in_mfilter);
+struct ip_moptions {
+	struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
+	struct in_addr imo_multicast_addr; /* ifindex/addr on MULTICAST_IF */
+	u_long imo_multicast_vif;	/* vif num outgoing multicasts */
+	u_char imo_multicast_ttl;	/* TTL for outgoing multicasts */
+	u_char imo_multicast_loop;	/* 1 => hear sends if a member */
+	STAILQ_HEAD(ip_mfilter_head, in_mfilter) imo_head;
+};
 
 struct in_mfilter *ip_mfilter_alloc(int mflags, int st0, int st1);
 void ip_mfilter_free(struct in_mfilter *);
@@ -419,7 +428,6 @@ inm_rele_locked(struct in_multi_head *inmh, struct in_multi *inm)
 #define MCAST_MUTED		3	/* [deprecated] */
 
 struct rib_head;
-struct	ip_moptions;
 struct ucred;
 
 struct in_multi *inm_lookup_locked(struct ifnet *, const struct in_addr);
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h
index 081938ec7ae4..3a6c3eb51151 100644
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -82,24 +82,6 @@ struct ipoption {
 	char	ipopt_list[MAX_IPOPTLEN];	/* options proper */
 };
 
-#if defined(_NETINET_IN_VAR_H_) && defined(_KERNEL)
-/*
- * Structure attached to inpcb.ip_moptions and
- * passed to ip_output when IP multicast options are in use.
- * This structure is lazy-allocated.
- */
-struct ip_moptions {
-	struct	ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
-	struct in_addr imo_multicast_addr; /* ifindex/addr on MULTICAST_IF */
-	u_long	imo_multicast_vif;	/* vif num outgoing multicasts */
-	u_char	imo_multicast_ttl;	/* TTL for outgoing multicasts */
-	u_char	imo_multicast_loop;	/* 1 => hear sends if a member */
-	struct ip_mfilter_head imo_head; /* group membership list */
-};
-#else
-struct ip_moptions;
-#endif
-
 struct	ipstat {
 	uint64_t ips_total;		/* total packets received */
 	uint64_t ips_badsum;		/* checksum bad */
@@ -191,6 +173,7 @@ struct inpcb;
 struct route;
 struct sockopt;
 struct inpcbinfo;
+struct ip_moptions;
 
 VNET_DECLARE(int, ip_defttl);			/* default IP ttl */
 VNET_DECLARE(int, ipforwarding);		/* ip forwarding */
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 655787c9ba53..7c8639841741 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -635,9 +635,16 @@ struct in6_mfilter {
 };
 
 /*
- * Helper types and functions for IPv4 multicast filters.
+ * Structure attached to inpcb.in6p_moptions and passed to ip6_output() when
+ * IPv6 multicast options are in use.
+ * This structure is lazy-allocated.
  */
-STAILQ_HEAD(ip6_mfilter_head, in6_mfilter);
+struct ip6_moptions {
+	struct ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
+	u_char im6o_multicast_hlim;	/* hoplimit for outgoing multicasts */
+	u_char im6o_multicast_loop;	/* 1 >= hear sends if a member */
+	STAILQ_HEAD(ip6_mfilter_head, in6_mfilter) im6o_head;
+};
 
 struct in6_mfilter *ip6_mfilter_alloc(int mflags, int st0, int st1);
 void ip6_mfilter_free(struct in6_mfilter *);
@@ -860,7 +867,6 @@ in6m_rele_locked(struct in6_multi_head *inmh, struct in6_multi *inm)
 	}
 }
 
-struct ip6_moptions;
 struct sockopt;
 struct inpcbinfo;
 struct rib_head;
diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
index 769a254cdf52..f96847ddc30f 100644
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -113,21 +113,6 @@ struct ip6_direct_ctx {
 	uint32_t	ip6dc_off;	/* offset to next header */
 };
 
-#if defined(_NETINET6_IN6_VAR_H_) && defined(_KERNEL)
-/*
- * Structure attached to inpcb.in6p_moptions and
- * passed to ip6_output when IPv6 multicast options are in use.
- * This structure is lazy-allocated.
- */
-struct ip6_moptions {
-	struct	ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
-	u_char	im6o_multicast_hlim;	/* hoplimit for outgoing multicasts */
-	u_char	im6o_multicast_loop;	/* 1 >= hear sends if a member */
-	struct ip6_mfilter_head im6o_head; /* group membership list */
-};
-#else
-struct ip6_moptions;
-#endif
 /*
  * Control options for outgoing packets
  */
@@ -395,6 +380,7 @@ struct inpcb;
 struct socket;
 struct sockopt;
 struct ucred;
+struct ip6_moptions;
 
 int	icmp6_ctloutput(struct socket *, struct sockopt *sopt);