Multicast membership isn't reported to IGMP querier

Discussion in 'Linux Networking' started by Bjoern D. Rasmussen, Oct 18, 2012.

  1. Anyone know how to make Linux respond to a IGMP query (IGMP_MEMBERSHIP_QUERY)? When I join a multicast group, e.g. 229.34.34.34, then Linux reports membership but when a membership query is sent to 224.0.0.1 from my IGMP switch then my Linux box doesn't say that it belongs to 229.34.34.34. This eventually results in my IGMP switch closing the membership and I need to manually report membership again.

    Here's the program I've written (btw, I've forced IGMPv2 use on my Linux):

    int main()
    {
    struct ip_mreq mreq = {0};
    struct sockaddr_in localSock = {0}, peerAddr = {0};
    char buff[2000], addr[100];
    int ret;
    socklen_t size;

    int sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
    if(sd < 0)
    {
    perror("Opening datagram socket error");
    exit(1);
    }
    else
    printf("Opening the datagram socket...OK.\n");

    localSock.sin_family = AF_INET;
    localSock.sin_port = htons(4321);
    localSock.sin_addr.s_addr = inet_addr("192.168.0.101");
    if(bind(sd, (struct sockaddr*)&localSock, sizeof(localSock)))
    {
    perror("Binding datagram socket error");
    exit(1);
    }
    else
    printf("Binding datagram socket...OK.\n");

    mreq.imr_multiaddr.s_addr = inet_addr("229.34.34.34");
    mreq.imr_interface.s_addr = inet_addr("192.168.0.101");

    if(setsockopt(sd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mreq,
    sizeof(mreq)) < 0)
    {
    perror("Setting local interface error");
    exit(1);
    }
    else
    printf("Setting the local interface...OK\n");

    sleep(1000000);

    return 0;
    }

    When I run the program above on a Windows7 box it re-reports memberships when the querier asks. Why doesn't it do this on Linux?

    -- Bjoern
     
    Bjoern D. Rasmussen, Oct 18, 2012
    #1
    1. Advertisements

  2. Hm, removing this from /etc/sysctrl.conf on my OpenSuse 11.3 fixed the problem:

    net.ipv4.conf.all.rp_filter = 1

    -- Bjoern
     
    Bjoern D. Rasmussen, Oct 30, 2012
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.