multicast route global variable

Alexander Bluhm <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
Hi,

To move towards multiprocessor multicast routing, we have to get
rid of global variables.  This sin one is easy.

ok?

bluhm

Index: netinet/ip_mroute.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_mroute.c,v
diff -u -p -r1.150 ip_mroute.c
--- netinet/ip_mroute.c	19 Jul 2025 16:40:40 -0000	1.150
+++ netinet/ip_mroute.c	23 Jun 2026 17:44:39 -0000
@@ -740,8 +740,6 @@ get_api_config(struct mbuf *m)
 	return (0);
 }
 
-static struct sockaddr_in sin = { sizeof(sin), AF_INET };
-
 int
 add_vif(struct socket *so, struct mbuf *m)
 {
@@ -771,6 +769,8 @@ add_vif(struct socket *so, struct mbuf *
 	if (vifcp->vifc_flags & VIFF_TUNNEL)
 		return (EOPNOTSUPP);
 	{
+		struct sockaddr_in sin = { sizeof(sin), AF_INET };
+
 		sin.sin_addr = vifcp->vifc_lcl_addr;
 		ifa = ifa_ifwithaddr(sintosa(&sin), rtableid);
 		if (ifa == NULL)
@@ -1205,6 +1205,7 @@ ip_mforward(struct mbuf *m, struct ifnet
 		mrtstat_inc(mrts_no_route);
 
 		{
+			struct sockaddr_in sin = { sizeof(sin), AF_INET };
 			struct igmpmsg *im;
 
 			/*
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.