> 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.
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