commit: r530 - in trunk/libspread-util: . src
[email protected] Mon, 18 Jun 2012 13:47:23 -0400
| Newsgroups | gmane.network.spread.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: jonathan Date: 2012-06-18 13:47:23 -0400 (Mon, 18 Jun 2012) New Revision: 530 Modified: trunk/libspread-util/Changelog trunk/libspread-util/src/data_link.c Log: Update libspread-util to libspreadutil release 4.2.0rc1 Modified: trunk/libspread-util/Changelog =================================================================== --- trunk/libspread-util/Changelog 2012-06-18 17:29:58 UTC (rev 529) +++ trunk/libspread-util/Changelog 2012-06-18 17:47:23 UTC (rev 530) @@ -1,3 +1,9 @@ +Mon Jun 18 13:24:41 2012 Jonathan Stanton <[email protected]> + + * src/data_link.c (DL_init_channel): Fix DL_init_channels algorithm for selecting which + interface to bind for multicast and broadcast receive sockets. Fixes regression in Spread + usage of DL for multicast sockets. + 2012-05-02 Jonathan Stanton <[email protected]> * src/data_link.c (DL_init_channel): The version of data_link.c's DL_init_channel function has Modified: trunk/libspread-util/src/data_link.c =================================================================== --- trunk/libspread-util/src/data_link.c 2012-06-18 17:29:58 UTC (rev 529) +++ trunk/libspread-util/src/data_link.c 2012-06-18 17:47:23 UTC (rev 530) @@ -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)); } }