From e0d28b66f11f337d41fcc94a0a3009b8882d9bc7 Mon Sep 17 00:00:00 2001 From: Nathan Bahr Date: Wed, 19 Aug 2020 14:42:07 -0500 Subject: [PATCH] pimd: fix IGMP source address on transmit IGMP queries should contain the source address of the IGMP socket they are being sent from. Added binding the IGMP sockets to their specific source, otherwise interfaces with multiple addresses will send multiple queries using the same source, which is determined by the kernel. Signed-off-by: Nathan Bahr Reviewed-by: Jafar Al-Gharaibeh --- pimd/pim_igmp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index 851b00b2ac..62954400f1 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -997,6 +997,7 @@ struct igmp_sock *pim_igmp_sock_add(struct list *igmp_sock_list, { struct pim_interface *pim_ifp; struct igmp_sock *igmp; + struct sockaddr_in sin; int fd; pim_ifp = ifp->info; @@ -1008,6 +1009,15 @@ struct igmp_sock *pim_igmp_sock_add(struct list *igmp_sock_list, return 0; } + sin.sin_family = AF_INET; + sin.sin_addr = ifaddr; + sin.sin_port = 0; + if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) != 0) { + zlog_warn("Could not bind IGMP socket for %s on %s", + inet_ntoa(ifaddr), ifp->name); + return 0; + } + igmp = igmp_sock_new(fd, ifaddr, ifp, mtrace_only); igmp_read_on(igmp); -- 2.39.5