All of lore.kernel.org
 help / color / mirror / Atom feed
From: Norbert van Bolhuis <nvbolhuis@aimvalley.nl>
To: netdev@vger.kernel.org
Cc: Daniel Borkmann <dborkman@redhat.com>,
	David Miller <davem@davemloft.net>,
	uaca@alumni.uv.es
Subject: single process receives own frames due to PACKET_MMAP
Date: Mon, 06 Jan 2014 23:58:01 +0100	[thread overview]
Message-ID: <52CB34F9.6020906@aimvalley.nl> (raw)
In-Reply-To: <52B4465E.2090904@aimvalley.nl>


Our application uses raw AF_PACKET socket to send and receive
on one particular ethernet interface.

Recently we started using PACKET_MMAP (TPACKET_V2). This makes
the Appl use a TX socket and a RX socket.
Both sockets are bound to the same (eth) interface. I noticed
the RX socket receives all frames that are sent via the
TX socket (same process, different thread). This I do not want.

I know it is supposed to happen for different processes
(otherwise wireshark won't work), but I did not expect it to
happen for one single process (with different threads).

I can filter them out in user-space (PACKET_OUTGOING)
or via kernel packet filter (SO_ATTACH_FILTER), but performance is
critical.

I wonder whether this (PACKET_MMAP) behaviour is OK.

It did not happen before (with a non-PACKET_MMAP AF_PACKET socket
which was used by both threads of the same Appl process). So
why is it happening now ?
I'd say it makes no sense to make the same process receive its
own transmitted frames on that same interface (unless its lo).

If I'm not doing something wrong, this means this behaviour
causes my CPU to be loaded much more (since all transmitted frames
have to be filtered out).

Let me know what you think.

thanks,
Norbert van Bolhuis

  parent reply	other threads:[~2014-01-06 22:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20 13:30 i386 vs x86_64 struct tpacket_hdr layout Norbert van Bolhuis
2013-12-20 18:38 ` David Miller
2013-12-20 18:45   ` Daniel Borkmann
2013-12-20 21:22     ` Norbert van Bolhuis
2014-01-06 22:58 ` Norbert van Bolhuis [this message]
2014-01-07  9:32   ` single process receives own frames due to PACKET_MMAP Daniel Borkmann
2014-01-07 10:06     ` Jesper Dangaard Brouer
2014-01-07 13:16       ` Norbert van Bolhuis
2014-01-07 13:47         ` Daniel Borkmann
2014-01-07 14:09         ` Jesper Dangaard Brouer
2014-01-07 15:16           ` Norbert van Bolhuis
2014-01-07 15:26             ` Daniel Borkmann
2014-01-07 15:46               ` Norbert van Bolhuis
2014-01-07 15:57                 ` Daniel Borkmann
2014-01-08 14:18                   ` Norbert van Bolhuis
2014-01-08 14:24                     ` Daniel Borkmann
2014-01-08 14:36                       ` Norbert van Bolhuis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52CB34F9.6020906@aimvalley.nl \
    --to=nvbolhuis@aimvalley.nl \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=uaca@alumni.uv.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.