specify interface by using interface index (set/getsockopt with 0.0.0.0/8).
This commit is contained in:
parent
9b47b68152
commit
7846de58b2
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: defs.h,v 1.18 1999/02/23 10:47:40 christos Exp $ */
|
||||
/* $NetBSD: defs.h,v 1.19 2001/01/15 13:19:12 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
|
@ -115,11 +115,19 @@
|
|||
#define _HAVE_SIN_LEN
|
||||
#endif
|
||||
|
||||
/* Turn on if IP_DROP_MEMBERSHIP and IP_ADD_MEMBERSHIP do not look at
|
||||
* the dstaddr of point-to-point interfaces.
|
||||
/* Turn on if IP_{ADD,DROP}_MEMBERSHIP and IP_MULTICAST_IF considers address
|
||||
* within 0.0.0.0/8 as interface index.
|
||||
*/
|
||||
#ifdef __NetBSD__
|
||||
#define MCAST_PPP_BUG
|
||||
#define MCAST_IFINDEX
|
||||
#endif
|
||||
|
||||
/* Turn on if IP_DROP_MEMBERSHIP and IP_ADD_MEMBERSHIP do not look at
|
||||
* the dstaddr of point-to-point interfaces.
|
||||
#undef MCAST_PPP_BUG
|
||||
*/
|
||||
#ifdef MCAST_IFINDEX
|
||||
#undef MCAST_PPP_BUG
|
||||
#endif
|
||||
|
||||
#define DAY (24*60*60)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if.c,v 1.20 2000/06/11 23:43:17 christos Exp $ */
|
||||
/* $NetBSD: if.c,v 1.21 2001/01/15 13:19:12 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
static char sccsid[] __attribute__((unused)) = "@(#)if.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: if.c,v 1.20 2000/06/11 23:43:17 christos Exp $");
|
||||
__RCSID("$NetBSD: if.c,v 1.21 2001/01/15 13:19:12 itojun Exp $");
|
||||
#endif
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -498,10 +498,14 @@ ifdel(struct interface *ifp)
|
|||
#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);
|
||||
#endif
|
||||
if (setsockopt(rip_sock,IPPROTO_IP,IP_DROP_MEMBERSHIP,
|
||||
&m, sizeof(m)) < 0
|
||||
&& errno != EADDRNOTAVAIL
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.26 2001/01/10 03:47:41 lukem Exp $ */
|
||||
/* $NetBSD: main.c,v 1.27 2001/01/15 13:19:12 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
|
@ -38,7 +38,7 @@ static char sccsid[] __attribute__((unused)) = "@(#)main.c 8.1 (Berkeley) 6/5/93
|
|||
#define __COPYRIGHT(a) char copyright[] = a;
|
||||
#elif defined(__NetBSD__)
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: main.c,v 1.26 2001/01/10 03:47:41 lukem Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.27 2001/01/15 13:19:12 itojun Exp $");
|
||||
#endif
|
||||
__COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
|
@ -721,9 +721,13 @@ rip_mcast_on(struct interface *ifp)
|
|||
#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);
|
||||
#endif
|
||||
if (setsockopt(rip_sock,IPPROTO_IP, IP_ADD_MEMBERSHIP,
|
||||
&m, sizeof(m)) < 0)
|
||||
LOGERR("setsockopt(IP_ADD_MEMBERSHIP RIP)");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: output.c,v 1.18 2000/07/20 22:50:16 thorpej Exp $ */
|
||||
/* $NetBSD: output.c,v 1.19 2001/01/15 13:19:12 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
static char sccsid[] __attribute__((unused)) = "@(#)output.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: output.c,v 1.18 2000/07/20 22:50:16 thorpej Exp $");
|
||||
__RCSID("$NetBSD: output.c,v 1.19 2001/01/15 13:19:12 itojun Exp $");
|
||||
#endif
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -152,6 +152,10 @@ 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
|
||||
|
@ -166,6 +170,7 @@ output(enum output_type type,
|
|||
} else
|
||||
#endif
|
||||
tgt_mcast = ifp->int_addr;
|
||||
#endif
|
||||
if (0 > setsockopt(rip_sock,
|
||||
IPPROTO_IP, IP_MULTICAST_IF,
|
||||
&tgt_mcast,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rdisc.c,v 1.10 2000/03/02 21:00:41 christos Exp $ */
|
||||
/* $NetBSD: rdisc.c,v 1.11 2001/01/15 13:19:12 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995
|
||||
|
@ -37,7 +37,7 @@
|
|||
static char sccsid[] __attribute__((unused)) = "@(#)rdisc.c 8.1 (Berkeley) x/y/95";
|
||||
#elif defined(__NetBSD__)
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: rdisc.c,v 1.10 2000/03/02 21:00:41 christos Exp $");
|
||||
__RCSID("$NetBSD: rdisc.c,v 1.11 2001/01/15 13:19:12 itojun Exp $");
|
||||
#endif
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -191,9 +191,13 @@ set_rdisc_mg(struct interface *ifp,
|
|||
return;
|
||||
#endif
|
||||
memset(&m, 0, sizeof(m));
|
||||
#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);
|
||||
#endif
|
||||
if (supplier
|
||||
|| (ifp->int_state & IS_NO_ADV_IN)
|
||||
|| !on) {
|
||||
|
@ -733,6 +737,10 @@ send_rdisc(union ad_u *p,
|
|||
}
|
||||
if (rdisc_sock_mcast != ifp) {
|
||||
/* select the right interface. */
|
||||
#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
|
||||
|
@ -746,6 +754,7 @@ send_rdisc(union ad_u *p,
|
|||
} else
|
||||
#endif
|
||||
tgt_mcast = ifp->int_addr;
|
||||
#endif
|
||||
if (0 > setsockopt(rdisc_sock,
|
||||
IPPROTO_IP, IP_MULTICAST_IF,
|
||||
&tgt_mcast, sizeof(tgt_mcast))) {
|
||||
|
|
Loading…
Reference in New Issue