diff options
author | phk <phk@FreeBSD.org> | 2008-07-30 11:56:15 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2008-07-30 11:56:15 +0000 |
commit | 2f3eaa65d516cc9b503141da15b0c4032c949af0 (patch) | |
tree | e1b1c915012698a693779a70eb2a8a279838d72f /sbin/routed/main.c | |
parent | 19bf5e280722ebf99ad48917f4b8d0af5dbd14e1 (diff) | |
download | FreeBSD-src-2f3eaa65d516cc9b503141da15b0c4032c949af0.zip FreeBSD-src-2f3eaa65d516cc9b503141da15b0c4032c949af0.tar.gz |
Update routed to use the RFC 3678 protocol-independent multicast API. Use
IP_MULTICAST_IF with struct ip_mreqn (obtained from Linux) to tell the
stack which interface index to use for sending IPv4 datagrams.
Submitted by: bms
Tested by: phk
Diffstat (limited to 'sbin/routed/main.c')
-rw-r--r-- | sbin/routed/main.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/sbin/routed/main.c b/sbin/routed/main.c index 7c3c5ac..674d232 100644 --- a/sbin/routed/main.c +++ b/sbin/routed/main.c @@ -713,25 +713,23 @@ rip_off(void) static void rip_mcast_on(struct interface *ifp) { - struct ip_mreq m; + struct group_req gr; + struct sockaddr_in *sin; if (!IS_RIP_IN_OFF(ifp->int_state) && (ifp->int_if_flags & IFF_MULTICAST) -#ifdef MCAST_PPP_BUG - && !(ifp->int_if_flags & IFF_POINTOPOINT) -#endif && !(ifp->int_state & IS_ALIAS)) { - 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); + 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_ADD_MEMBERSHIP, - &m, sizeof(m)) < 0) - LOGERR("setsockopt(IP_ADD_MEMBERSHIP RIP)"); + sin->sin_addr.s_addr = htonl(INADDR_RIP_GROUP); + if (setsockopt(rip_sock, IPPROTO_IP, MCAST_JOIN_GROUP, + &gr, sizeof(gr)) < 0) + LOGERR("setsockopt(MCAST_JOIN_GROUP RIP)"); } } |