diff options
author | Nathan Bahr <nbahr@atcorp.com> | 2020-08-19 21:42:07 +0200 |
---|---|---|
committer | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2020-08-26 17:47:04 +0200 |
commit | d05d3f7a6fac8351a39026bf750cbf2ce8b7ad51 (patch) | |
tree | 445c050181b22b2cd08fe9c708a1dcf7c8175a2b /pimd/pim_igmp.c | |
parent | pimd: fix IGMP receive handling (diff) | |
download | frr-d05d3f7a6fac8351a39026bf750cbf2ce8b7ad51.tar.xz frr-d05d3f7a6fac8351a39026bf750cbf2ce8b7ad51.zip |
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 <nbahr@atcorp.com>
Reviewed-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
Diffstat (limited to 'pimd/pim_igmp.c')
-rw-r--r-- | pimd/pim_igmp.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index a8612f91f..97deac8b8 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -995,6 +995,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; @@ -1006,6 +1007,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); |