[PATCH 03/12] Leave VRRP multicast group by ifindex

[email protected] (Quentin Armitage)
Newsgroups gmane.linux.keepalived.devel
Message-ID <[email protected]>
If the interfaces is using a vmac and it is in backup mode, then
it won't have an addresses, and therefore the IP_DROP_MEMBERSHIP
doesn't have an address to specify. Therefore specify the interface
by index.

Signed-off-by: Quentin Armitage <[email protected]>
---
 keepalived/vrrp/vrrp_if.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/keepalived/vrrp/vrrp_if.c b/keepalived/vrrp/vrrp_if.c
index 8374df1..9355a5c 100644
--- a/keepalived/vrrp/vrrp_if.c
+++ b/keepalived/vrrp/vrrp_if.c
@@ -488,7 +488,7 @@ if_join_vrrp_group(sa_family_t family, int *sd, interface_t *ifp, int proto)
 int
 if_leave_vrrp_group(sa_family_t family, int sd, interface_t *ifp)
 {
-	struct ip_mreq imr;
+	struct ip_mreqn imr;
 	struct ipv6_mreq imr6;
 	int ret = 0;
 
@@ -500,9 +500,9 @@ if_leave_vrrp_group(sa_family_t family, int sd, interface_t *ifp)
 	if (family == AF_INET) {
 		memset(&imr, 0, sizeof(imr));
 		imr.imr_multiaddr = ((struct sockaddr_in *) &global_data->vrrp_mcast_group4)->sin_addr;
-		imr.imr_interface.s_addr = IF_ADDR(ifp);
+		imr.imr_ifindex = IF_INDEX(ifp);
 		ret = setsockopt(sd, IPPROTO_IP, IP_DROP_MEMBERSHIP,
-				 (char *) &imr, sizeof(struct ip_mreq));
+				 (char *) &imr, sizeof(imr));
 	} else {
 		memset(&imr6, 0, sizeof(imr6));
 		imr6.ipv6mr_multiaddr = ((struct sockaddr_in6 *) &global_data->vrrp_mcast_group6)->sin6_addr;
-- 
1.7.7.6


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.