lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <loom.20130516T111446-437@post.gmane.org>
Date:	Thu, 16 May 2013 09:18:03 +0000 (UTC)
From:	Ricardo Tubío <rtpardavila@...il.com>
To:	netdev@...r.kernel.org
Subject: Re: Single socket with TX_RING and RX_RING

Phil Sutter <phil <at> nwl.cc> writes:

> 
> On Wed, May 15, 2013 at 12:53:55PM +0000, Ricardo Tubío wrote:
> > Once I tell kernel to export the TX_RING through setsockopt() (see code
> > below) I always get an error (EBUSY) if i try to tell kernel to export the
> > RX_RING with the same socket descriptor. Therefore, I have to open an
> > additional socket for the RX_RING and I require of two sockets when I though
> > that I would only require of one socket for both TX and RX using mmap()ed
> > memory.
> > 
> > Do I need both sockets or am I doing something wrong?
> 
> After requesting the rings, a single mmap() call suffices for both. So
> pseudo-code basically looks like this:
> 
> | setsockopt(fd, SOL_PACKET, PACKET_RX_RING, p, sizeof(p));
> | setsockopt(fd, SOL_PACKET, PACKET_TX_RING, p, sizeof(p));
> | rx_ring = mmap(NULL, ring_len * 2, PROT_READ | PROT_WRITE, MAP_SHARED,
fd, 0);
> | tx_ring = rx_ring + ring_len;
> 
> Note that packet_mmap() in net/packet/af_packet.c always maps the TX
> ring memory right after the RX one.
> 
> HTH, Phil
> 

Phil, the issue comes precisely when I try to do that: the second call to
setsockopt() returns an "EBUSY" error message from the kernel. It seems that
if you have initialized one socket for beeing either TX_RING or RX_RING, you
cannot initialize the same socket again for the other option (RX_RING or
TX_RING).

Does anybody really know whether I am right or wrong?



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ