Bug 5504 - Test System.Net.Sockets.UdpClientTest.JoinMulticastGroup1_IPv6 Fail
Summary: Test System.Net.Sockets.UdpClientTest.JoinMulticastGroup1_IPv6 Fail
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Martin Baulig
URL:
: 5496 5497 5498 5505 5506 ()
Depends on:
Blocks:
 
Reported: 2012-06-03 23:20 UTC by Vinicius Jarina
Modified: 2012-06-28 14:43 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
setsockopt() test (1.16 KB, application/octet-stream)
2012-06-27 00:21 UTC, Martin Baulig
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Vinicius Jarina 2012-06-03 23:20:08 UTC
System.ArgumentException : Value does not fall within the expected range.
at System.Net.Sockets.Socket.SetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, System.Object optionValue) [0x0013f] in /private/tmp/source/bockbuild/profiles/mono-mac-release/build-root/mono-2.11/_build/mono-2.11.git/mcs/class/System/System.Net.Sockets/Socket.cs:2105
at System.Net.Sockets.UdpClient.JoinMulticastGroup (System.Net.IPAddress multicastAddr) [0x0003c] in /private/tmp/source/bockbuild/profiles/mono-mac-release/build-root/mono-2.11/_build/mono-2.11.git/mcs/class/System/System.Net.Sockets/UdpClient.cs:250
at MonoTests.System.Net.Sockets.UdpClientTest.JoinMulticastGroup1_IPv6 () [0x00034] in /private/tmp/source/bockbuild/profiles/mono-mac-release/build-root/mono-2.11/_build/mono-2.11.git/mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs:515
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d5] in /private/tmp/source/bockbuild/profiles/mono-mac-release/build-root/mono-2.11/_build/mono-2.11.git/mcs/class/corlib/System.Reflection/MonoMethod.cs:229
Comment 1 Martin Baulig 2012-06-27 00:21:15 UTC
Created attachment 2121 [details]
setsockopt() test
Comment 2 Martin Baulig 2012-06-27 00:23:13 UTC
In the attached testcase, the setsockopt() call fails when

	mreq.ipv6mr_interface = 0;

It works when using an actual interface id.  However, 0 is a valid number according to the manpage.
Comment 3 Martin Baulig 2012-06-27 00:42:00 UTC
See also #5496 and #5497.
Comment 4 Martin Baulig 2012-06-27 01:21:32 UTC
Testing on Linux and Windows shows that they only join the multicast group on one NIC (which actually seems to be a random one on Windows) when using interface id 0.

To test:

====
	IPAddress mcast_addr = IPAddress.Parse ("ff02::888");

	using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.IPv6Any, 9999))) {
		client.JoinMulticastGroup (mcast_addr);
		IPEndPoint ep = null;
		client.Receive (ref ep);
	}
====

Then do 'netsh interface ipv6 show joins' on Windows and 'netstat -nag' on Linux.

This means that I could actually fix that quite easily in the runtime using that code from commit 504e2341 using if_nametoindex() on the interface that belongs to the machine's ip address.
Comment 5 Martin Baulig 2012-06-28 14:34:46 UTC
Fixed; commit b6b410.
Comment 6 Martin Baulig 2012-06-28 14:35:15 UTC
*** Bug 5496 has been marked as a duplicate of this bug. ***
Comment 7 Martin Baulig 2012-06-28 14:36:03 UTC
*** Bug 5506 has been marked as a duplicate of this bug. ***
Comment 8 Martin Baulig 2012-06-28 14:36:51 UTC
*** Bug 5505 has been marked as a duplicate of this bug. ***
Comment 9 Martin Baulig 2012-06-28 14:42:44 UTC
*** Bug 5497 has been marked as a duplicate of this bug. ***
Comment 10 Martin Baulig 2012-06-28 14:43:11 UTC
*** Bug 5498 has been marked as a duplicate of this bug. ***