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-next>] [day] [month] [year] [list]
Date:	Thu, 12 Jul 2012 12:30:17 +0400
From:	Aleksandr Kotov <a1k@...l.ru>
To:	David Miller <davem@...emloft.net>,
	netdev@...r.kernel.org, MvS <miquels@...nkel.ow.org>
Subject: AF_PACKET + PACKET_FANOUT: tx packet delivered back in rx

I have a problem using AF_PACKET socket with PACKET_RX_RING, PACKET_TX_RING and PACKET_FANOUT options enabled.
I am seeing my TX packets get back to the same socket in RX ring. Socket is created and gets bind with ETH_P_ALL protocol type. The problem is in the fanout_add function 
which sets af_packet_priv to "match" variable, but not sk one describing socket and in dev_queue_xmit_nit skb get bounced back to the socket despite the comment left in the function.

fanout_add(struct sock *sk, u16 id, u16 type_flags)
    ....
     match->prot_hook.af_packet_priv = match;
    ....

dev_queue_xmit_nit
       list_for_each_entry_rcu(ptype, &ptype_all, list) {
                /* Never send packets back to the socket
                 * they originated from - MvS (miquels@...nkel.ow.org)
                 */
                if ((ptype->dev == dev || !ptype->dev) &&
                    (ptype->af_packet_priv == NULL ||
                     (struct sock *)ptype->af_packet_priv != skb->sk)) {

As said in David Miller comment for PACKET_FANOUT patch:

"The implementation is agnostic to the type of AF_PACKET sockets in
use.  You can use _mmap_ based, and non-mmap based, AF_PACKET sockets.
It simply doesn't care."
So I think it is legal to used mmaped AF_PACKET/.


Is there any way to use it correctly with packets not mirroring in rx? 

Best regard, Aleksandr Kotov

-- 

Powered by blists - more mailing lists