summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2009-03-04 03:40:02 +0000
committerbms <bms@FreeBSD.org>2009-03-04 03:40:02 +0000
commitea92a550571a3d29f97a8b8070814e82a370da64 (patch)
tree84cb5cb00f4b523868a5b7d3df1cb64626377f22
parentd92111a8dc86baa72bb5660ebba5ad3f2665dca9 (diff)
downloadFreeBSD-src-ea92a550571a3d29f97a8b8070814e82a370da64.zip
FreeBSD-src-ea92a550571a3d29f97a8b8070814e82a370da64.tar.gz
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.
-rw-r--r--sys/netinet/in_mcast.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c
index c43b328..7d9aecb 100644
--- a/sys/netinet/in_mcast.c
+++ b/sys/netinet/in_mcast.c
@@ -121,6 +121,13 @@ static int inp_leave_group(struct inpcb *, struct sockopt *);
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;
OpenPOWER on IntegriCloud