git: 0b103f72376b - main - mrouter: do not loopback packets unconditionally
Wojciech Macek
wma at FreeBSD.org
Tue May 11 10:37:33 UTC 2021
The branch main has been updated by wma:
URL: https://cgit.FreeBSD.org/src/commit/?id=0b103f72376b5ec7c9a9d574c976e42805ae88a4
commit 0b103f72376b5ec7c9a9d574c976e42805ae88a4
Author: Wojciech Macek <wma at FreeBSD.org>
AuthorDate: 2021-04-23 06:49:27 +0000
Commit: Wojciech Macek <wma at FreeBSD.org>
CommitDate: 2021-05-11 10:36:07 +0000
mrouter: do not loopback packets unconditionally
Looping back router multicast traffic signifficantly
stresses network stack. Add possibility to disable or enable
loopbacked based on sysctl value.
Reported by: Daniel Deville
Reviewed by: mw
Differential Revision: https://reviews.freebsd.org/D29947
---
sys/netinet/ip_mroute.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 8ecc983ea58f..b8e677ba9af1 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -244,6 +244,8 @@ static const struct encaptab *pim_encap_cookie;
static int pim_encapcheck(const struct mbuf *, int, int, void *);
static int pim_input(struct mbuf *, int, int, void *);
+extern int in_mcast_loop;
+
static const struct encap_config ipv4_encap_cfg = {
.proto = IPPROTO_PIM,
.min_length = sizeof(struct ip) + PIM_MINLEN,
@@ -1685,7 +1687,7 @@ send_packet(struct vif *vifp, struct mbuf *m)
imo.imo_multicast_ifp = vifp->v_ifp;
imo.imo_multicast_ttl = mtod(m, struct ip *)->ip_ttl - 1;
- imo.imo_multicast_loop = 1;
+ imo.imo_multicast_loop = !!in_mcast_loop;
imo.imo_multicast_vif = -1;
STAILQ_INIT(&imo.imo_head);
More information about the dev-commits-src-main
mailing list