svn commit: r189357 - head/sys/netinet

Bruce M Simpson bms at FreeBSD.org
Tue Mar 3 19:40:03 PST 2009


Author: bms
Date: Wed Mar  4 03:40:02 2009
New Revision: 189357
URL: http://svn.freebsd.org/changeset/base/189357

Log:
  Add sysctl net.inet.ip.mcast.loop. This controls whether or not
  IPv4 multicast sends are looped back to senders by default
  on a stack-wide basis, rather than relying on the socket option.
  Note that the sysctl only applies to newly created multicast sockets.

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c	Wed Mar  4 03:38:51 2009	(r189356)
+++ head/sys/netinet/in_mcast.c	Wed Mar  4 03:40:02 2009	(r189357)
@@ -121,6 +121,13 @@ static int	inp_leave_group(struct inpcb 
 static int	inp_set_multicast_if(struct inpcb *, struct sockopt *);
 static int	inp_set_source_filters(struct inpcb *, struct sockopt *);
 
+SYSCTL_NODE(_net_inet_ip, OID_AUTO, mcast, CTLFLAG_RW, 0, "IPv4 multicast");
+
+int in_mcast_loop = IP_DEFAULT_MULTICAST_LOOP;
+SYSCTL_INT(_net_inet_ip_mcast, OID_AUTO, loop, CTLFLAG_RW | CTLFLAG_TUN,
+    &in_mcast_loop, 0, "Loopback multicast datagrams by default");
+TUNABLE_INT("net.inet.ip.mcast.loop", &in_mcast_loop);
+
 /*
  * Resize the ip_moptions vector to the next power-of-two minus 1.
  * May be called with locks held; do not sleep.
@@ -695,7 +702,7 @@ inp_findmoptions(struct inpcb *inp)
 	imo->imo_multicast_addr.s_addr = INADDR_ANY;
 	imo->imo_multicast_vif = -1;
 	imo->imo_multicast_ttl = IP_DEFAULT_MULTICAST_TTL;
-	imo->imo_multicast_loop = IP_DEFAULT_MULTICAST_LOOP;
+	imo->imo_multicast_loop = in_mcast_loop;
 	imo->imo_num_memberships = 0;
 	imo->imo_max_memberships = IP_MIN_MEMBERSHIPS;
 	imo->imo_membership = immp;


More information about the svn-src-all mailing list