multicast for SOCK_PACKET

multicast for SOCK_PACKET

Post by Andi Klee » Thu, 29 Oct 1998 04:00:00





> Hi there,
> Is there multicast support for SOCK_PACKET type socket that is similar to that
> for IP protocol (i.e., using setsockopt())? I looked through the Linux source
> and found nothing, but thought I should ask in case I missed something.

You should be able to use the standard SOL_IP IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP
socket options. They should set the needed L2 multicast filters on the ethernet
card.

In Linux 2.1 a more generic and better solution has been implemented for
PF_PACKET sockets (the sucessor of SOCK_PACKET):

[Here is the part of the new rewriten man pages that describe it]

 MULTICAST AND PROMISCUOUS MODE SUPPORT
       Linux 2.2 supports a new way to configure  physical  layer
       multicasting  and promiscuous mode over packet sockets. It
       works by calling setsockopt(2)  on  a  packet  socket  for
       SOL_PACKET and one of the options PACKET_ADD_MEMBERSHIP or
       PACKET_DROP_MEMBERSHIP.  They both expects  a  packet_mreq
       structure as argument:

              struct packet_mreq
              {
                   int       mr_ifindex;       /* interface index */
                   unsigned short mr_type;     /* mreq type as defined below */
                   unsigned short mr_alen;     /* address length */
                   unsigned char  mr_address[8];    /* physical layer address */
              };

       mr_interface  contains  the interface index for the inter-
       face whose status should be changed.   Valid  options  for
       mr_type  are PACKET_MR_MULTICAST to bind the socket to the
       physical layer multicast group specified in mr_address and
       mr_alen,  PACKET_MR_PROMISC  to enable promiscuous mode on
       the interface to receive all packets on  a  shared  media,
       PACKET_MR_ALLMULTI  sets the socket up to receive all mul-
       ticast    packets    arriving    at     the     interface.
       PACKET_DROP_MEMBERSHIP removes the binding or setting.

-Andi

 
 
 

multicast for SOCK_PACKET

Post by Andi Klee » Thu, 29 Oct 1998 04:00:00






>> Hi there,
>> Is there multicast support for SOCK_PACKET type socket that is similar to that
>> for IP protocol (i.e., using setsockopt())? I looked through the Linux source
>> and found nothing, but thought I should ask in case I missed something.
> You should be able to use the standard SOL_IP IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP
> socket options. They should set the needed L2 multicast filters on the ethernet
> card.

[...]

I forgot. Of course you can use the low level SIOCADDMULTI/SIOCDELMULTI
ioctls too. They are probably the most appropiate for a packet socket.
They get a standard ifreq structure as argument.

-Andi

 
 
 

1. Linux multicast is slower than Windows multicast ?

I'm developing 2 applications :

1- A program that runs under linux (mandrake 9.0) and sends multicast
packets (code is very simple, similar to this:
http://www.linuxsocket.org/books/Sockets/programs/part4/chap17/mcast_...)

2- A program under Windows2000 that receives multicast packets (sent
by linux program)

I noticed that linux transmitter is very slow. I tried to transmit
same packets using Windows application and I noticed that win2000 is
faster (10 times) than Linux. I tried different packet sizes:
transmission under linux is slower than Windows only for big packets
(>20KB).
Have somebody noticed same behaviour ?
Is there some configuration (kernel or user) that can improve Linux
performance ?

Thanks,

Manuel

2. process at boot time

3. SOCK_PACKET and datalink layer access from user space program

4. Kerberos authentication with Windows 2000

5. libpcap - writing using Linux SOCK_PACKET

6. Dual Pentium Pro Machine

7. SOCK_PACKET

8. FTP Install missing IFUP from boot disks

9. SOCK_PACKET corruption problems in 2.0.5

10. What replaced socket(AF_INET,SOCK_PACKET....

11. SOCK_PACKET & LINUX

12. question about SOCK_PACKET

13. SOCK_PACKET ???