[Live-devel] multicast & linux information
Piers Hawksley
piers.hawksley at panogenics.com
Fri Oct 25 09:40:44 PDT 2013
>> It seems that kernel maintainers chose to keep the backward
compatibility with a default that cause receiving data from all
multicast groups and not only from joined multicast group.
>> But they add since kernel 2.6.31 an option that allow to avoid this.
> That's good to hear. (I guess this is the closest they'll ever come
to admitting that the default behavior is a bug :-)
>> Do you think it could be possible to set this option in
socketJoinGroup in a future release of live555 ?
> Done! I've just installed a new version (2013.10.03) of the "LIVE555
Streaming Media" code that sets this option to 0 if it's defined.
Attached is the changes I made to Linux 2.6.29 to port the
IP_MULTICAST_ALL socket option from 2.6.31.
Sorry for this being an svn diff - but it isn't a big change, only a few
lines to 5 files.
Hopefully it is of interest and not too off-topic. I've tested it within
the limits of what it is meant to do (and only on one (custom ARM)
embedded Linux platform) so ymmv.
Cheers,
Piers Hawksley
-------------- next part --------------
Index: include/net/inet_sock.h
===================================================================
--- include/net/inet_sock.h (revision 5965)
+++ include/net/inet_sock.h (working copy)
@@ -130,7 +130,8 @@
freebind:1,
hdrincl:1,
mc_loop:1,
- transparent:1;
+ transparent:1,
+ mc_all:1; // From 2.6.31
int mc_index;
__be32 mc_addr;
struct ip_mc_socklist *mc_list;
Index: include/linux/in.h
===================================================================
--- include/linux/in.h (revision 5965)
+++ include/linux/in.h (working copy)
@@ -107,6 +107,7 @@
#define MCAST_JOIN_SOURCE_GROUP 46
#define MCAST_LEAVE_SOURCE_GROUP 47
#define MCAST_MSFILTER 48
+#define IP_MULTICAST_ALL 49 // From 2.6.31
#define MCAST_EXCLUDE 0
#define MCAST_INCLUDE 1
Index: net/ipv4/af_inet.c
===================================================================
--- net/ipv4/af_inet.c (revision 5965)
+++ net/ipv4/af_inet.c (working copy)
@@ -376,6 +376,7 @@
inet->uc_ttl = -1;
inet->mc_loop = 1;
inet->mc_ttl = 1;
+ inet->mc_all = 1; // From 2.6.31
inet->mc_index = 0;
inet->mc_list = NULL;
Index: net/ipv4/ip_sockglue.c
===================================================================
--- net/ipv4/ip_sockglue.c (revision 5965)
+++ net/ipv4/ip_sockglue.c (working copy)
@@ -449,6 +449,7 @@
(1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) |
(1<<IP_PASSSEC) | (1<<IP_TRANSPARENT))) ||
optname == IP_MULTICAST_TTL ||
+ optname == IP_MULTICAST_ALL || // From 2.6.31
optname == IP_MULTICAST_LOOP ||
optname == IP_RECVORIGDSTADDR) {
if (optlen >= sizeof(int)) {
@@ -895,6 +896,13 @@
kfree(gsf);
break;
}
+ case IP_MULTICAST_ALL: // From 2.6.31
+ if (optlen < 1)
+ goto e_inval;
+ if (val != 0 && val != 1)
+ goto e_inval;
+ inet->mc_all = val;
+ break;
case IP_ROUTER_ALERT:
err = ip_ra_control(sk, val ? 1 : 0, NULL);
break;
@@ -1147,6 +1155,9 @@
release_sock(sk);
return err;
}
+ case IP_MULTICAST_ALL: // From 2.6.31
+ val = inet->mc_all;
+ break;
case IP_PKTOPTIONS:
{
struct msghdr msg;
Index: net/ipv4/igmp.c
===================================================================
--- net/ipv4/igmp.c (revision 5965)
+++ net/ipv4/igmp.c (working copy)
@@ -2196,7 +2196,7 @@
break;
}
if (!pmc)
- return 1;
+ return inet->mc_all; // From 2.6.31
psl = pmc->sflist;
if (!psl)
return pmc->sfmode == MCAST_EXCLUDE;
More information about the live-devel
mailing list