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/output.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/output.c')
-rw-r--r-- | sbin/routed/output.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/sbin/routed/output.c b/sbin/routed/output.c index c9db470..c555c21 100644 --- a/sbin/routed/output.c +++ b/sbin/routed/output.c @@ -104,7 +104,6 @@ output(enum output_type type, int flags; const char *msg; int res; - naddr tgt_mcast; int soc; int serrno; @@ -150,31 +149,17 @@ output(enum output_type type, } else { msg = "Send mcast"; if (rip_sock_mcast != ifp) { -#ifdef MCAST_IFINDEX - /* specify ifindex */ - tgt_mcast = htonl(ifp->int_index); -#else -#ifdef MCAST_PPP_BUG - /* Do not specify the primary interface - * explicitly if we have the multicast - * point-to-point kernel bug, since the - * kernel will do the wrong thing if the - * local address of a point-to-point link - * is the same as the address of an ordinary - * interface. - */ - if (ifp->int_addr == myaddr) { - tgt_mcast = 0; - } else -#endif - tgt_mcast = ifp->int_addr; -#endif + struct ip_mreqn mreqn; + + memset(&mreqn, 0, sizeof(struct ip_mreqn)); + mreqn.imr_ifindex = ifp->int_index; if (0 > setsockopt(rip_sock, - IPPROTO_IP, IP_MULTICAST_IF, - &tgt_mcast, - sizeof(tgt_mcast))) { + IPPROTO_IP, + IP_MULTICAST_IF, + &mreqn, + sizeof(mreqn))) { serrno = errno; - LOGERR("setsockopt(rip_sock," + LOGERR("setsockopt(rip_sock, " "IP_MULTICAST_IF)"); errno = serrno; ifp = 0; |