Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Feb 2026 13:51:17 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9df6a7f9a60b - main - ip_mroute: Try to make function pointer declarations more consistent
Message-ID:  <698b37d5.3d09c.3705f2b9@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by markj:

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

commit 9df6a7f9a60b76eda2ac82826528487ca43edf46
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-02-09 22:52:08 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-02-10 13:45:06 +0000

    ip_mroute: Try to make function pointer declarations more consistent
    
    The ip_mroute and ip6_mroute modules hook into the network stack via
    several function pointers.  Declarations for these pointers are
    scattered around several headers.  Put them all in the same place,
    ip(6)_mroute.h.
    
    No functional change intended.
    
    Reviewed by:    glebius
    MFC after:      2 weeks
    Sponsored by:   Stormshield
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D55058
---
 sys/netinet/igmp.c        |  1 +
 sys/netinet/in_mcast.c    |  1 +
 sys/netinet/ip_input.c    |  1 +
 sys/netinet/ip_mroute.h   | 21 ++++++++++++++++++---
 sys/netinet/ip_output.c   |  1 +
 sys/netinet/ip_var.h      | 10 ----------
 sys/netinet6/ip6_input.c  |  1 +
 sys/netinet6/ip6_mroute.h | 14 ++++++++++++++
 sys/netinet6/ip6_output.c |  1 +
 sys/netinet6/ip6_var.h    |  2 --
 sys/netinet6/mld6.c       |  1 +
 11 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index de9d38c7fb9d..35128dadffe6 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -79,6 +79,7 @@
 #include <netinet/ip_options.h>
 #include <netinet/igmp.h>
 #include <netinet/igmp_var.h>
+#include <netinet/ip_mroute.h>
 
 #include <machine/in_cksum.h>
 
diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c
index 131e72780ebe..20e6f9d8b322 100644
--- a/sys/netinet/in_mcast.c
+++ b/sys/netinet/in_mcast.c
@@ -66,6 +66,7 @@
 #include <net/if_private.h>
 #include <netinet/ip_var.h>
 #include <netinet/igmp_var.h>
+#include <netinet/ip_mroute.h>
 
 #ifndef KTR_IGMPV3
 #define KTR_IGMPV3 KTR_INET
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 1e1747d04c45..4b8294c93967 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -82,6 +82,7 @@
 #include <machine/in_cksum.h>
 #include <netinet/ip_carp.h>
 #include <netinet/in_rss.h>
+#include <netinet/ip_mroute.h>
 #ifdef SCTP
 #include <netinet/sctp_var.h>
 #endif
diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h
index ed98e59a7c77..6f09006ec9e2 100644
--- a/sys/netinet/ip_mroute.h
+++ b/sys/netinet/ip_mroute.h
@@ -356,14 +356,29 @@ struct bw_meter {
 };
 
 #ifdef _KERNEL
+VNET_DECLARE(struct socket *, ip_mrouter);	/* multicast routing daemon */
+#define	V_ip_mrouter		VNET(ip_mrouter)
 
+struct ifnet;
+struct ip;
+struct ip_moptions;
+struct mbuf;
+struct socket;
 struct sockopt;
 
-extern int	(*ip_mrouter_set)(struct socket *, struct sockopt *);
-extern int	(*ip_mrouter_get)(struct socket *, struct sockopt *);
+extern u_long	(*ip_mcast_src)(int);
+extern int	(*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
+		    struct ip_moptions *);
 extern int	(*ip_mrouter_done)(void);
-extern int	(*mrt_ioctl)(u_long, caddr_t, int);
+extern int	(*ip_mrouter_get)(struct socket *, struct sockopt *);
+extern int	(*ip_mrouter_set)(struct socket *, struct sockopt *);
+
+extern void	(*ip_rsvp_force_done)(struct socket *);
+extern int	(*ip_rsvp_vif)(struct socket *, struct sockopt *);
 
+extern int	(*legal_vif_num)(int);
+extern int	(*mrt_ioctl)(u_long, caddr_t, int);
+extern int	(*rsvp_input_p)(struct mbuf **, int *, int);
 #endif /* _KERNEL */
 
 #endif /* _NETINET_IP_MROUTE_H_ */
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index f1aa3c498ef7..1edc4906b542 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -78,6 +78,7 @@
 #include <netinet/in_var.h>
 #include <netinet/ip_var.h>
 #include <netinet/ip_options.h>
+#include <netinet/ip_mroute.h>
 
 #include <netinet/udp.h>
 #include <netinet/udp_var.h>
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h
index c113484079a3..934ca80a083d 100644
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -199,9 +199,6 @@ VNET_DECLARE(int, ipsendredirects);
 VNET_DECLARE(int, ipstealth);			/* stealth forwarding */
 #endif
 VNET_DECLARE(struct socket *, ip_rsvpd);	/* reservation protocol daemon*/
-VNET_DECLARE(struct socket *, ip_mrouter);	/* multicast routing daemon */
-extern int	(*legal_vif_num)(int);
-extern u_long	(*ip_mcast_src)(int);
 VNET_DECLARE(int, rsvp_on);
 VNET_DECLARE(int, drop_redirect);
 VNET_DECLARE(int, ip_random_id);
@@ -214,7 +211,6 @@ VNET_DECLARE(int, ip_random_id);
 #define	V_ipstealth		VNET(ipstealth)
 #endif
 #define	V_ip_rsvpd		VNET(ip_rsvpd)
-#define	V_ip_mrouter		VNET(ip_mrouter)
 #define	V_rsvp_on		VNET(rsvp_on)
 #define	V_drop_redirect		VNET(drop_redirect)
 #define	V_ip_random_id		VNET(ip_random_id)
@@ -227,9 +223,6 @@ int	ip_ctloutput(struct socket *, struct sockopt *sopt);
 int	ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,
 	    u_long if_hwassist_flags);
 void	ip_forward(struct mbuf *m, int srcrt);
-extern int
-	(*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
-	    struct ip_moptions *);
 int	ip_output(struct mbuf *,
 	    struct mbuf *, struct route *, int, struct ip_moptions *,
 	    struct inpcb *);
@@ -244,9 +237,6 @@ int	rsvp_input(struct mbuf **, int *, int);
 
 int	ip_rsvp_init(struct socket *);
 int	ip_rsvp_done(void);
-extern int	(*ip_rsvp_vif)(struct socket *, struct sockopt *);
-extern void	(*ip_rsvp_force_done)(struct socket *);
-extern int	(*rsvp_input_p)(struct mbuf **, int *, int);
 
 typedef int	ipproto_input_t(struct mbuf **, int *, int);
 struct icmp;
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index a23f5d46d6a3..656b3b996f90 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -118,6 +118,7 @@
 #include <netinet6/mld6_var.h>
 #include <netinet6/nd6.h>
 #include <netinet6/in6_rss.h>
+#include <netinet6/ip6_mroute.h>
 #ifdef SCTP
 #include <netinet/sctp_pcb.h>
 #include <netinet6/sctp6_var.h>
diff --git a/sys/netinet6/ip6_mroute.h b/sys/netinet6/ip6_mroute.h
index dd23196c799a..2f298df6a1ce 100644
--- a/sys/netinet6/ip6_mroute.h
+++ b/sys/netinet6/ip6_mroute.h
@@ -270,10 +270,24 @@ struct rtdetq {		/* XXX: rtdetq is also defined in ip_mroute.h */
 #endif
 
 #define MAX_UPQ6	4		/* max. no of pkts in upcall Q */
+#endif /* _KERNEL || KERNEL */
 
+#ifdef _KERNEL
+VNET_DECLARE(struct socket *, ip6_mrouter);	/* multicast routing daemon */
+#define	V_ip6_mrouter			VNET(ip6_mrouter)
+
+struct ifnet;
+struct ip6_hdr;
+struct mbuf;
+struct socket;
+struct sockopt;
+
+extern int	(*ip6_mforward)(struct ip6_hdr *, struct ifnet *,
+		    struct mbuf *);
 extern int	(*ip6_mrouter_set)(struct socket *so, struct sockopt *sopt);
 extern int	(*ip6_mrouter_get)(struct socket *so, struct sockopt *sopt);
 extern int	(*ip6_mrouter_done)(void);
+
 extern int	(*mrt6_ioctl)(u_long, caddr_t);
 #endif /* _KERNEL */
 
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index dca1bcf04371..4b0c08b4e493 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -110,6 +110,7 @@
 #include <netinet/tcp_var.h>
 #include <netinet6/nd6.h>
 #include <netinet6/in6_rss.h>
+#include <netinet6/ip6_mroute.h>
 
 #include <netipsec/ipsec_support.h>
 #if defined(SCTP) || defined(SCTP_SUPPORT)
diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
index c1645f587483..4951f43ea4da 100644
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -309,7 +309,6 @@ VNET_DECLARE(int, ip6_v6only);
 #define	V_ip6_mcast_pmtu		VNET(ip6_mcast_pmtu)
 #define	V_ip6_v6only			VNET(ip6_v6only)
 
-VNET_DECLARE(struct socket *, ip6_mrouter);	/* multicast routing daemon */
 VNET_DECLARE(int, ip6_sendredirects);	/* send IP redirects when forwarding? */
 VNET_DECLARE(int, ip6_accept_rtadv);	/* Acts as a host not a router */
 VNET_DECLARE(int, ip6_no_radr);		/* No defroute from RA */
@@ -320,7 +319,6 @@ VNET_DECLARE(int, ip6_rfc6204w3);	/* Accept defroute from RA even when
 VNET_DECLARE(int, ip6_hdrnestlimit);	/* upper limit of # of extension
 					 * headers */
 VNET_DECLARE(int, ip6_dad_count);	/* DupAddrDetectionTransmits */
-#define	V_ip6_mrouter			VNET(ip6_mrouter)
 #define	V_ip6_sendredirects		VNET(ip6_sendredirects)
 #define	V_ip6_accept_rtadv		VNET(ip6_accept_rtadv)
 #define	V_ip6_no_radr			VNET(ip6_no_radr)
diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c
index f14d2c76ffda..d00a9c13ec8d 100644
--- a/sys/netinet6/mld6.c
+++ b/sys/netinet6/mld6.c
@@ -90,6 +90,7 @@
 #include <netinet6/ip6_var.h>
 #include <netinet6/scope6_var.h>
 #include <netinet/icmp6.h>
+#include <netinet6/ip6_mroute.h>
 #include <netinet6/mld6.h>
 #include <netinet6/mld6_var.h>
 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?698b37d5.3d09c.3705f2b9>