Hello!!! I have been testing the igmp system in udp-cast. I have discovered that is not necessary to manual send any IGMP packet. This entire job is done by the linux kernel. It’s very important define the socket as a multicast socket. This is done setting IP_ADD_MEMBERSHIP option. This is done in this line:
(source code, file socklib.c, line 418)
static int mcastListen(int sock, net_if_t *net_if, struct sockaddr_in *addr) { return mcastOp(sock, net_if, getSinAddr(addr), IP_ADD_MEMBERSHIP, "Subscribe to multicast group"); }
With this definition, the system controls the IGMP session. When you open the socket, the linux kernel sends the IGMP Membership to join this group. And, when you close the socket, the linux kernel sends the IGMP Leave. During the session, the kernel sends the notifications to maintain the group.
It's very important ensure the igmp support in the kernel. To avoid compatibility problems, it's also important to verify the IGMP version in router and clients.
To see the IGMP table, you can:
cat /proc/net/igmp
dx Device : Count Querier Group Users Timer Reporter 1 lo : 1 V3 010000E0 1 0:00000000 0 2 eth0 : 2 V2 250000E1 1 0:00000000 1 010000E0 1 0:00000000 0
IGMP group table:
netstat -gn
IPv6/IPv4 Group Memberships Interface RefCnt Group --------------- ------ --------------------- lo 1 224.0.0.1 eth0 1 225.0.0.37 eth0 1 224.0.0.1 lo 1 ff02::1 eth0 1 ff02::1:ff04:c68b eth0 1 ff02::1
IGMP groups registered:
ip maddr
1: lo inet 224.0.0.1 inet6 ff02::1 2: eth0 link 01:00:5e:00:00:01 link 33:33:00:00:00:01 link 33:33:ff:04:c6:8b link 01:00:5e:00:00:25 inet 225.0.0.37 inet 224.0.0.1 inet6 ff02::1:ff04:c68b inet6 ff02::1
Force IGMP version echo "2" > /proc/sys/net/ipv4/conf/eth<X>/force_igmp_version (to force v2)
My problem was that udp-cast uses a broadcast to locate clients and servers, and then, there is no multicast traffic sent. If you specify a ttl>1, then, all the igmp process is initiated normally.
There was another problem: the igmp packet is only sent when the client when you open the socket, not immediately. The udp-receiver waits for udp-sender signal to register the multicast generated group.
Finally, I have to say that all works perfect, it was bad testing options! Congratulations for your software!!