Re: [RFC PATCH net-next] tun: support retrieving multiple packets in a single read with IFF_MULTI_READ

Alex Gartrell
2014-12-22T20:18:55Z

Hey Herbert,

Thanks for getting back to me

On 12/22/14 4:09 AM, Herbert Xu wrote:
> As tun already has a socket interface can we do this through
> recvmmsg?

This just presents an easier interface (IMHO) for accomplishing that.
And I say easier because I was unable how to figure out the recvmmsg way
to do it.

While fully aware that this makes me look like an idiot, I have to admit
that I've tried and failed to figure out how to get a socket fd out of
the tun device.

The regular fd doesn't work (which is obvious when you look at the
implementation sock_from_file), there's a tun_get_socket function but
it's only referenced by a single file, and none of the ioctl's jump out
at me as doing anything to enable this behavior. Additionally,
tuntap.txt makes no mention of sockets specifically.

FWIW, I don't feel strongly that IFF_MULTI_READ is the right way to do
this either.

Thanks,
--
Alex Gartrell <agartrell@fb.com>