Re: 4.2 IP Multicast issues

Jonathan Stanton <[email protected]> Wed, 6 Jun 2012 08:24:37 -0400
Newsgroups gmane.network.spread.user
Message-ID <[email protected]>
Hello Marcelo,

I've isolated what was going wrong with the multicast joins in this case, it was a change in behavior of the underlying multicast code we use. Please try the attached patch which applies to the 4.2.0rc2 release. It should fix the problem. 

I'll also release a new version in the next day. 

Thanks,

Jonathan


-------------------------------------------------------------------------------
Jonathan Stanton		[email protected]
Spread Group Messaging	www.spread.org
Spread Concepts LLC 	www.spreadconcepts.com
-------------------------------------------------------------------------------



On May 9, 2012, at 7:21 PM, Marcelo San-Martin wrote:

> Hi,
> I was working with Spread 4.1 using multicast addresses with no problems and when I switch to 4.2 it doesn't work anymore.
> I get an alarm and exit with the following error:
> 
> [Wed 09 May 2012 16:13:35] DL_init_channel: problem in setsockopt to multicast address 239.10.10.10 
> Exit caused by Alarm(EXIT)
> 
> I check the code in data_link.c and I do not see much differences with the previous version.
> 
> My configuration looks like this:
> 
> Spread_Segment 239.10.10.10:4803 {
> 	ASD-SC1	10.21.69.51 
> 	{
> 		D 10.21.69.51 
> 		C 127.0.0.1
> 	}
> 	ASD-SC2	10.21.69.52 
> 	{
> 		D 10.21.69.52 
> 		C 127.0.0.1
> 	}
> 	ASD-SC3	10.21.69.53 
> 	{
> 		D 10.21.69.53 
> 		C 127.0.0.1
> 	}
> 	ASD-SC4	10.21.69.54 
> 	{
> 		D 10.21.69.54 
> 		C 127.0.0.1
> 	}
> }
> 
> This config file works with 4.1.
> 
> Have there been any changes on this area?
> 
> Thanks, 
> Marcelo
> 
> _______________________________________________
> Spread-users mailing list
> [email protected]
> http://lists.spread.org/mailman/listinfo/spread-users

_______________________________________________
Spread-users mailing list
[email protected]
http://lists.spread.org/mailman/listinfo/spread-users
fix_multicast_join.patch (application/octet-stream, 2 KB)
Index: libspread-util/src/data_link.c
===================================================================
--- libspread-util/src/data_link.c	(revision 527)
+++ libspread-util/src/data_link.c	(working copy)
@@ -147,12 +147,21 @@
                         /* WAS: mreq.imr_interface.s_addr = INADDR_ANY;
                          * If specified, then want to route through it instead of
                          * based on routing decisions at the kernel */
-                        mreq.imr_interface.s_addr = htonl( interface_address );
- 
+			/* IP_ADD_MEMBERSHIP requires that the imr_interface be an actual physical interface
+			 * or INADDR_ANY. So if this is the special case of binding to multicast or broadcast,
+			 * switch the join to use INADDR_ANY. In the case when the passed in interface
+			 * is a regular physical interface, then join only on that one.
+			 */
+			if ( IS_MCAST_ADDR(interface_address) )
+			  mreq.imr_interface.s_addr = htonl( INADDR_ANY );
+			else
+			  mreq.imr_interface.s_addr = htonl( interface_address );
+
+
         		if (setsockopt(chan, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void *)&mreq, 
 		       		sizeof(mreq)) < 0) 
 			{
-				Alarm( EXIT, "DL_init_channel: problem in setsockopt to multicast address " IPF "\n", IP(mcast_address) );
+			  Alarm( EXIT, "DL_init_channel: problem (errno %d:%s) in setsockopt to multicast address " IPF "\n", sock_errno, sock_strerror(sock_errno), IP(mcast_address) );
 			}
 
                         if ( channel_type & NO_LOOP ) 
@@ -160,7 +169,7 @@
                             if (setsockopt(chan, IPPROTO_IP, IP_MULTICAST_LOOP, 
                                         (void *)&off, 1) < 0) 
                             { 
-                                Alarm( EXIT, "DL_init_channel: problem in setsockopt loop setting " IPF "\n", IP(mcast_address)); 
+			      Alarm( EXIT, "DL_init_channel: problem (errno %d:%s) in setsockopt loop setting " IPF "\n", sock_errno, sock_strerror(sock_errno), IP(mcast_address)); 
                             } 
 			}