I am curious how kernel chooses the interface to join a mcast group when INADDR_ANY is used:
struct ip_mreq req;
req.imr_multiaddr.s_addr = inet_addr(someMcastIP);
req.imr_interface.s_addr = htonl(INADDR_ANY);
if ((setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void*) &req, sizeof(req))) < 0) {
...
}
Let's say there are few interfaces on the machine. How does the kernel choose?