Re: Kernel Multicast

From: Jean Tourrilhes (jt@bougret.hpl.hp.com)
Date: Tue Aug 28 2001 - 13:13:21 EST


On Tue, Aug 28, 2001 at 01:45:35PM -0400, Clayton, Mark wrote:
>
> Do you mind sharing your questions/thoughts? This topic
> interests me. I'd be interested in hearing the dialog.
>
> Thanks,
> Mark
> --
> [root@hjinc mclayton] /sbin/insmod stddisclaimer.o

        Ok, I'll try to be brief... I'm still not on the LKML...

        Linux 2.4.8, multiple network interfaces. I want to Rx/Tx
multicast junk on all interfaces or subset of them, on the same UDP
port.
        First, a bit of background : with multicast, packets are not
automatically sent on all interfaces. If you set a multicast route in
the routing table to an interface, they will be sent to this
interface, and only this one.
        The only way to bypass the routing table is to use the
IP_MULTICAST_IF option, but that select one specific outgoing
interface.
        Therefore, I'm trying to open a separate UDP multicast socket
on each interface active on the system (SIOCGIFCONF).

        I have a program that do (simplified) :
------------------------------------------
socket(AF_INET, SOCK_DGRAM, 0);
bind(sock, INADDR_ANY, MY_PORT);
setsockopt(IP_ADD_MEMBERSHIP, INADDR_ALLHOSTS_GROUP, ONE_INTERFACE);
setsockopt(IP_MULTICAST_IF, ONE_INTERFACE);
------------------------------------------
        First instance : work like a charm : multicast packet are
Tx/Rx on the selected interface without the need of explicit multicast
route.
        Second instance : "bind failed: Address already in use". In
other word, every time I try to bind a second socket on this port, it
fails...

        As "bind" is problematic, I tried as well :
------------------------------------------
bind(sock, INADDR_ALLHOSTS_GROUP, MY_PORT);
------------------------------------------
        This acts exactly as above, second bind fails.

        And finally, I tried :
------------------------------------------
bind(sock, ONE_INTERFACE, MY_PORT);
------------------------------------------
        First instance : Tx ok, doesn't Rx anything at all. I can
understand why, the Rx packet don't have a dest IP address matching
ONE_INTERFACE.

        That's it... As it's my first experiment with Multicast, I'm
probably missing something obvious...
        Thanks in advance...

        Jean
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Aug 31 2001 - 21:00:30 EST