Subject: Re: Single socket with TX_RING and RX_RING

From: Ricardo Tubío <[email-masked]>
Date: Wed, 15 May 2013 14:58:06 +0000 (UTC)

Daniel Borkmann <dborkman <at> redhat.com> writes:

> 
> No, just as a side note, I think here you rather wanted to say ...
> 
>   setsockopt(socket, SOL_PACKET, PACKET_RX_RING, ...);
>   setsockopt(socket, SOL_PACKET, PACKET_TX_RING, ...);
> 
> ... and then only once:
> 
>   ring = mmap(NULL, ..., socket, 0);
> 
> > I haven't tried it out yet, and currently also do not really have time
to. But
> > looking at the mmap code, it seems that the size of the mmap area is
accumulated
> > for rx and tx ring. However, the header status bits are not really
interoperable
> > with each other. So looks you will need to have two sockets ...
> 

I have already tried that and, if I use the same socket_fd twice with
setsockopt(), I get the EBUSY errno from Kernel. Tomorrow, I will try the
first solution with both sockets (it seems the easiest way); afterwards, I
will try to use the TX_RING socket for TX and for RX at a time.

I will come back with the results.