Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/net/mcast Fix specifying an interface for IPV6_JOIN_GROUP



details:   https://anonhg.NetBSD.org/src/rev/c598fdbd6f8d
branches:  trunk
changeset: 808589:c598fdbd6f8d
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon May 25 07:17:17 2015 +0000

description:
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.

diffstat:

 tests/net/mcast/t_mcast.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r c370a43fa22c -r c598fdbd6f8d tests/net/mcast/t_mcast.c
--- a/tests/net/mcast/t_mcast.c Mon May 25 05:48:18 2015 +0000
+++ b/tests/net/mcast/t_mcast.c Mon May 25 07:17:17 2015 +0000
@@ -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 @@
                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;



Home | Main Index | Thread Index | Old Index