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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=81891 --- shadow/81891 2007-06-16 13:26:58.000000000 -0400 +++ shadow/81891.tmp.27082 2007-06-16 13:26:58.000000000 -0400 @@ -0,0 +1,80 @@ +Bug#: 81891 +Product: Mono: Class Libraries +Version: 1.2 +OS: other +OS Details: FreeBSD 6.2 +Status: NEW +Resolution: +Severity: +Priority: Wishlist +Component: System +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: SO_REUSEADDR should also set SO_REUSEPORT on FreeBSD UDP sockets + +Description of Problem: +When dealing with multicast udp sockets, its common to set the socket +option SO_REUSEADDR to allow multiple sockets/applications on one +interface to bind to the same address and recieve the same multicast (or +broadcast) datagrams. + +On Linux and Windows, setting SocketOptionName.ReuseAddress to 1 will +allow this behaviour: Multiple sockets/applications can bind to the same +address:port. + +However, on freebsd this functionality is slightly different. SO_REUSEADDR +allows a socket to bind to a socket that is in a TIME_WAIT state, whereas +SO_REUSEPORT allows a socket to bind to a address and port that are +already in use. + +On Linux and Windows, setting SO_REUSEADDR implies that SO_REUSEPORT has +been set. However, on FreeBSD both have to be set separately. However, +mono does not allow for arbitrary socketoptions to be set, so which ever +application binds to the address/port first will have exclusive access to +it, which is different functionality than Windows/Linux, effectively +breaking the usefulness of UDP multicast on freebsd. + + +Steps to reproduce the problem: +EndPoint multicast = new IPEndPoint(IPAddress.Any, 9090); + +socket_a = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, +ProtocolType.Udp); +socket_a.SetSocketOption(SocketOptionLevel.Socket, +SocketOptionName.ReuseAddress, 1); +socket_a.SetSocketOption(SocketOptionLevel.IP, +SocketOptionName.MulticastLoopback, 1); +socket_a.SetSocketOption(SocketOptionLevel.IP, +SocketOptionName.MulticastTimeToLive, 1); +socket_a.Bind(multicast); + +socket_b = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, +ProtocolType.Udp); +socket_b.SetSocketOption(SocketOptionLevel.Socket, +SocketOptionName.ReuseAddress, 1); +socket_b.SetSocketOption(SocketOptionLevel.IP, +SocketOptionName.MulticastLoopback, 1); +socket_b.SetSocketOption(SocketOptionLevel.IP, +SocketOptionName.MulticastTimeToLive, 1); +socket_b.Bind(multicast); + +Actual Results: +Windows/Linux success. + +FreeBSD throws a SocketException + +Expected Results: +Windows/Linux/FreeBSD success. + +How often does this happen? +Every time + +Additional Information: +Setting SO_REUSEPORT with SO_REUSEADDR should only be assumed with the +socket type is SocketType.Dgram. Stream protocols like TCP should only set +SO_REUSEADDR (setting SO_REUSEPORT on stream protocols could be concidered +a security risk) _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
