Pseudo raw socket support or multibind

90 views
Skip to first unread message

Shawn Bohrer

unread,
Apr 3, 2014, 3:24:20 PM4/3/14
to libvm...@googlegroups.com
I've got a feature request.  We commonly receive UDP multicast data that arrives on multiple multicast addresses and different ports.  In many cases we don't control the address or port selection.  Currently with VMA we have to open a new socket for each port because you can only bind() a socket to a single port.  Without VMA we can work around this by using a raw socket to consume all of the packets with a single socket, however VMA currently does not have support for raw sockets.

The fact that VMA uses raw packet QPs means that under the covers it is actually an improved version of raw sockets.  I'd love a vma_extra.h extension that uses flow steering to attach multiple multicast address:port feeds to a single socket.  I'd get all the packets I want, and none of the packets I don't.  For the record I _do_ still need a way to distinguish which multicast addr:port a packet came from.  With a raw socket I could use the packet headers, or I could possibly use something like IP_PKTINFO.

I've poked around VMA a little but I'm unsure what the best implementation might be.  Currently I can abuse recvfrom_zcopy() and get the packet headers with some pointer math on the buffer.  I think what is missing is a vma_extra.h api that lets me construct a flow key and ultimately calls sockinfo::attach_receiver().

Any thoughts on what the best implementation for this would be?

Thanks,
Shawn

Alex Rosenbaum

unread,
Apr 4, 2014, 2:32:06 PM4/4/14
to libvm...@googlegroups.com
Hello Shawn,

Did you look at the vma_recv_callback_t interface in vma_extra.h?
Your application can create all sockets + specific multiple bonded port, go into epoll and practically never come out. All packets will be received and passed to the application on that single recv_callback in a synchronized way. This will also allow processing of all packets as they come on the wire even if they came from different UDP sockets.

Also, the recv callback has the 'vma_info_t' structure which provide packet's scr + dst information (https://code.google.com/p/libvma/source/browse/src/vma/vma_extra.h#62).

Hope this help.
If not lets understand what is the difference and plan how to close the gap.

Alex
Reply all
Reply to author
Forward
0 new messages