* AF_PACKET + PACKET_FANOUT: tx packet delivered back in rx
@ 2012-07-12 8:30 Aleksandr Kotov
2012-08-16 21:53 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Aleksandr Kotov @ 2012-07-12 8:30 UTC (permalink / raw)
To: David Miller, netdev, MvS
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@drinkel.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
--
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-16 21:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-12 8:30 AF_PACKET + PACKET_FANOUT: tx packet delivered back in rx Aleksandr Kotov
2012-08-16 21:53 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).