commit: r514 - in libspreadutil/trunk: . include src
[email protected] Wed, 02 May 2012 16:48:25 -0400
| Newsgroups | gmane.network.spread.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: jonathan Date: 2012-05-02 16:48:25 -0400 (Wed, 02 May 2012) New Revision: 514 Modified: libspreadutil/trunk/Changelog libspreadutil/trunk/include/spu_data_link.h libspreadutil/trunk/src/data_link.c Log: Add new DL_BIND_ALL channel option to DL_init_channel to allow selection of multicast bind semantics in the new API Modified: libspreadutil/trunk/Changelog =================================================================== --- libspreadutil/trunk/Changelog 2012-05-02 18:32:53 UTC (rev 513) +++ libspreadutil/trunk/Changelog 2012-05-02 20:48:25 UTC (rev 514) @@ -1,3 +1,13 @@ +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 + changed semantics from the version previously used by Spread. When you create a channel with a + multicast address, it will now only bind that socket to the multicast address not to INADDR_ANY. + This is needed for some uses of datalink (like in Spines) but is the wrong semantics if you want + one socket to receive both multicast and unicast traffic sent to the same port. So to support that + semantics a new channel_type modifier was added to the API DL_BIND_ALL which when passed in will force + the bind to be to INADDR_ANY unless a specific interface address was provided. + Tue Mar 20 17:57:44 2012 Jonathan Stanton <[email protected]> * configure.in: Make use of dladdr in the function name lookup code a compile time option so Modified: libspreadutil/trunk/include/spu_data_link.h =================================================================== --- libspreadutil/trunk/include/spu_data_link.h 2012-05-02 18:32:53 UTC (rev 513) +++ libspreadutil/trunk/include/spu_data_link.h 2012-05-02 20:48:25 UTC (rev 514) @@ -45,6 +45,7 @@ #define RECV_CHANNEL 0x00000002 #define NO_LOOP 0x00000004 #define REUSE_ADDR 0x00000008 +#define DL_BIND_ALL 0x00000010 #define IS_MCAST_ADDR(addr) ( ( (addr) & 0xF0000000 ) == 0xE0000000 ) #define IS_MCAST_ADDR_NET(addr) ( ( (unsigned char*) &(addr) )[0] == 0xE0 ) Modified: libspreadutil/trunk/src/data_link.c =================================================================== --- libspreadutil/trunk/src/data_link.c 2012-05-02 18:32:53 UTC (rev 513) +++ libspreadutil/trunk/src/data_link.c 2012-05-02 20:48:25 UTC (rev 514) @@ -105,7 +105,7 @@ /* If mcast channel, the interface means the interface to receive mcast packets on, and not interface to bind. Must bind multicast address instead */ - if (mcast_address != 0) + if (mcast_address != 0 && IS_MCAST_ADDR(mcast_address) && !(channel_type & DL_BIND_ALL) ) soc_addr.sin_addr.s_addr= htonl(mcast_address); else if (interface_address != 0) soc_addr.sin_addr.s_addr= htonl(interface_address);