adding new address families (AF_xxx)

Hello,

I came across the kernel driver code implementing some sort of IGMP snooping backend and as part of its functionalilty it creates a new socket address family, AF_IGMPSNOOP, but actually implements just a few operations for this type of socket:

static struct proto_ops igmp_snoop_ops = { family: AF_IGMP_SNOOP, release: _igmp_snoop_sock_release, bind: sock_no_bind, connect: sock_no_connect, socketpair: sock_no_socketpair, accept: sock_no_accept, getname: sock_no_getname, poll: datagram_poll, ioctl: sock_no_ioctl, listen: sock_no_listen, shutdown: sock_no_shutdown, setsockopt: _igmp_snoop_setsockopt, getsockopt: sock_no_getsockopt, sendmsg: _igmp_snoop_sock_sendmsg, recvmsg: _igmp_snoop_sock_recvmsg, mmap: sock_no_mmap, sendpage: sock_no_sendpage, }

However from a user space perspective a socket is created as:

fd = socket (AF_IGMPSNOOP, SOCK_RAW, IPPROTO_IGMP)

I'm wondering what is the rationale for adding a new family, while in fact a raw socket is being used to access the stack for IGMP packets? Would not it be the same to just create AF_INET raw socket and do the things?

Looking forward to hearing form you ! Thanks.

Mark

Reply to
Mark
Loading thread data ...

Possibly.

I'm pretty sure IGMP snooping is really a "bridge" thing.

formatting link

I don't know why you'd need a socket for bridge-based IGMP snooping at all. Bridges don't need no steenking sockets. This being said, this is another one of those things...

( text from RFC 4541 ): " In recent years, a number of commercial vendors have introduced products described as "IGMP snooping switches" to the market. These devices do not adhere to the conceptual model that provides the strict separation of functionality between different communications layers in the ISO model, and instead utilize information in the upper level protocol headers as factors to be considered in processing at the lower levels. This is analogous to the manner in which a router can act as a firewall by looking into the transport protocol's header before allowing a packet to be forwarded to its destination address."

formatting link

So *sigh*.

--
Les Cargill
Reply to
Les Cargill

formatting link

Thanks for the response. Another thing that comes to my mind is that perhaps the implementor of AF_IGMPSNOOP family wanted to have just a small subset of socket operations, not a full-blown socket, basically only the 'release', 'poll', setsockopt, sendmsg and recvmsg are implemented for this new family. May be they wanted to have a light-weight mechanism.

Mark

Reply to
Mark

formatting link

Dunno - find the appropriate mailing list and ask them. But yes - it looks like only those callbacks are allowed.

--
Les Cargill
Reply to
Les Cargill

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.