[Mono-bugs] [Bug 80593][Nor] New - Endian issue when joining a UDP multicast group

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jan 23 22:16:35 EST 2007

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by monobugs at sharifibrahim.com.


--- shadow/80593	2007-01-23 22:16:34.000000000 -0500
+++ shadow/80593.tmp.6157	2007-01-23 22:16:35.000000000 -0500
@@ -0,0 +1,78 @@
+Bug#: 80593
+Product: Mono: Runtime
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: PowerPC
+Status: NEW   
+Priority: Normal
+Component: io-layer
+AssignedTo: dick at ximian.com                            
+ReportedBy: monobugs at sharifibrahim.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Endian issue when joining a UDP multicast group
+Description of Problem:
+It appears Mono may have a byte order bug when attempting to join UDP
+multicast groups on big-endian architectures.  I originally filed this on
+the Debian BTS (http://bugs.debian.org/406909) but have determined that the
+issue applies to Mono in FC5 as well so am filing it here.
+Steps to reproduce the problem:
+1. Compile and run the test program:
+namespace Test
+ 	using System.Net;
+ 	using System.Net.Sockets;
+ 	class Test
+ 	{
+ 		static void Main()
+ 		{
+			Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,
+			socket.SetSocketOption(SocketOptionLevel.Socket,
+SocketOptionName.ReuseAddress, 1);
+			socket.Bind(new IPEndPoint(IPAddress.Any, 1900));
+			socket.SetSocketOption(SocketOptionLevel.IP,
+SocketOptionName.AddMembership, new
+			socket.Close();
+ 		}
+ 	}
+Actual Results:
+Works on .NET and Mono on i386, fails on powerpc with the exception:
+Unhandled Exception: System.Net.Sockets.SocketException: Invalid arguments
+  at System.Net.Sockets.Socket.SetSocketOption (SocketOptionLevel level,
+SocketOptionName name, System.Object opt_value) [0x00000]
+  at Test.Test.Main () [0x00000]
+Expected Results:
+Run without error on all architectures.
+How often does this happen? 
+Every time on powerpc.
+Additional Information:
+I found a multicast program written in C and was able to run it
+successfully.  Using strace on both it and Mono revealed that Mono's call
+to setsockopt was using the wrong byte order for the multicast address:
+setsockopt(7, SOL_IP, IP_ADD_MEMBERSHIP, \372\377\377\357\0\0\0\0\0\0\0\0",
+12) = -1 EINVAL (Invalid argument)
+I confirmed this by modifying the C# test program to use the (invalid)
+multicast address  The compiled executable then worked on
+powerpc but failed on i386 Mono and .NET.
+I've tracked down the issue to mono/metadata/socket-io.c but don't know the
+best way to solve it there.  In any case, if my analysis is correct, then
+bug 75057 is probably a manifestation of this.

More information about the mono-bugs mailing list