diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-09-01 18:49:53 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-12-21 20:26:08 -0500 |
| commit | 21391ed8d887a4c5967e73f50018b9433e717a83 (patch) | |
| tree | 000e4ab8ac37690c7899540d97e85cde4f89eeb5 /pimd/pim_sock.c | |
| parent | 5f6f65b14c79cc7ab3d80cd48a03910001e0f90f (diff) | |
pimd: Allow interfaces to be unnumbered.
Specify the ifindex of the interface that we want
to turn on IP_MULTICAST_IF on instead of the
address. If we pass in the address then the
fact that we have multiple interfaces with the
same ip address causes confusion in the kernel.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_sock.c')
| -rw-r--r-- | pimd/pim_sock.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c index 8f8f4f191f..4312fe73b2 100644 --- a/pimd/pim_sock.c +++ b/pimd/pim_sock.c @@ -113,6 +113,7 @@ pim_socket_bind (int fd, struct interface *ifp) int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, u_char loop) { + struct ip_mreqn mreq; int fd; fd = pim_socket_raw(protocol); @@ -214,8 +215,10 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, u_char lo return PIM_SOCK_ERR_LOOP; } + memset (&mreq, 0, sizeof (mreq)); + mreq.imr_ifindex = ifindex; if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, - (void *) &ifaddr, sizeof(ifaddr))) { + (void *) &mreq, sizeof(mreq))) { zlog_warn("Could not set Outgoing Interface Option on socket fd=%d: errno=%d: %s", fd, errno, safe_strerror(errno)); close(fd); |
