diff options
Diffstat (limited to 'sbin/routed/if.c')
-rw-r--r-- | sbin/routed/if.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/sbin/routed/if.c b/sbin/routed/if.c index f8038f6a..09b03af 100644 --- a/sbin/routed/if.c +++ b/sbin/routed/if.c @@ -452,7 +452,6 @@ check_remote(struct interface *ifp) static void ifdel(struct interface *ifp) { - struct ip_mreq m; struct interface *ifp1; @@ -491,25 +490,23 @@ ifdel(struct interface *ifp) ifdel(ifp1); } - if ((ifp->int_if_flags & IFF_MULTICAST) -#ifdef MCAST_PPP_BUG - && !(ifp->int_if_flags & IFF_POINTOPOINT) -#endif - && rip_sock >= 0) { - m.imr_multiaddr.s_addr = htonl(INADDR_RIP_GROUP); -#ifdef MCAST_IFINDEX - m.imr_interface.s_addr = htonl(ifp->int_index); -#else - m.imr_interface.s_addr = ((ifp->int_if_flags - & IFF_POINTOPOINT) - ? ifp->int_dstaddr - : ifp->int_addr); + if ((ifp->int_if_flags & IFF_MULTICAST) && rip_sock >= 0) { + struct group_req gr; + struct sockaddr_in *sin; + + memset(&gr, 0, sizeof(gr)); + gr.gr_interface = ifp->int_index; + sin = (struct sockaddr_in *)&gr.gr_group; + sin->sin_family = AF_INET; +#ifdef _HAVE_SIN_LEN + sin->sin_len = sizeof(struct sockaddr_in); #endif - if (setsockopt(rip_sock,IPPROTO_IP,IP_DROP_MEMBERSHIP, - &m, sizeof(m)) < 0 + sin->sin_addr.s_addr = htonl(INADDR_RIP_GROUP); + if (setsockopt(rip_sock, IPPROTO_IP, MCAST_LEAVE_GROUP, + &gr, sizeof(gr)) < 0 && errno != EADDRNOTAVAIL && !TRACEACTIONS) - LOGERR("setsockopt(IP_DROP_MEMBERSHIP RIP)"); + LOGERR("setsockopt(MCAST_LEAVE_GROUP RIP)"); if (rip_sock_mcast == ifp) rip_sock_mcast = 0; } |