Module Name:    src
Committed By:   ozaki-r
Date:           Mon May 25 07:17:17 UTC 2015

Modified Files:
        src/tests/net/mcast: t_mcast.c

Log Message:
Fix specifying an interface for IPV6_JOIN_GROUP

Using always an interface of index=1 is not good idea; it varies
depending on runtime environments. We can use index=0 instead,
which allows the kernel to pick an appropriate interface for mcast.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/net/mcast/t_mcast.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/mcast/t_mcast.c
diff -u src/tests/net/mcast/t_mcast.c:1.15 src/tests/net/mcast/t_mcast.c:1.16
--- src/tests/net/mcast/t_mcast.c:1.15	Tue May 19 04:14:04 2015
+++ src/tests/net/mcast/t_mcast.c	Mon May 25 07:17:17 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mcast.c,v 1.15 2015/05/19 04:14:04 ozaki-r Exp $	*/
+/*	$NetBSD: t_mcast.c,v 1.16 2015/05/25 07:17:17 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 #include <sys/cdefs.h>
 #ifdef __RCSID
-__RCSID("$NetBSD: t_mcast.c,v 1.15 2015/05/19 04:14:04 ozaki-r Exp $");
+__RCSID("$NetBSD: t_mcast.c,v 1.16 2015/05/25 07:17:17 ozaki-r Exp $");
 #else
 extern const char *__progname;
 #define getprogname() __progname
@@ -132,12 +132,12 @@ addmc(int s, struct addrinfo *ai, bool b
 		if (setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
 		    &ifc, sizeof(ifc)) == -1)
 			return -1;
-		ifc = 1;
+		ifc = 1; /* XXX should pick a proper interface */
 		if (setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifc,
 		    sizeof(ifc)) == -1)
 			return -1;
 #else
-		ifc = 1;
+		ifc = 0; /* Let pick an appropriate interface */
 #endif
 		m6.ipv6mr_interface = ifc;
 		m6.ipv6mr_multiaddr = s6->sin6_addr;

Reply via email to