All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Cc: linux-kselftest@vger.kernel.org,
	Network Development <netdev@vger.kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Willem de Bruijn <willemb@google.com>,
	David Miller <davem@davemloft.net>,
	shuah@kernel.org
Subject: Re: [PATCH net-next 2/2] tools: psock_tpacket: verify that packet was received on lo before counting it
Date: Wed, 4 Jan 2017 10:03:43 -0500	[thread overview]
Message-ID: <CAF=yD-KUw8M+RGnN2eXLVgv836F6mxd4+b0h=2CP6X7mv+ScWg@mail.gmail.com> (raw)
In-Reply-To: <20170104144424.GD9641@oracle.com>

On Wed, Jan 4, 2017 at 9:44 AM, Sowmini Varadhan
<sowmini.varadhan@oracle.com> wrote:
> On (01/04/17 09:30), Willem de Bruijn wrote:
>>
>> The common and simpler solution to this problem is to open the socket
>> with protocol 0 to reject all packets, add the BPF filter and only then bind
>> with sll_ifindex set to lo. That way no false positives can arrive.
>
> Yes, I thought of that too (and I've seen that done in one commercial
> implementation), but given that tpacket nicely returns the incoming
> interface, I figured, why not use the test prog to use this (thus
> verifying it, and also showing how to use it)

This approach is less restrictive. It still allows incorrect packets
to be enqueued in the time between the socket call and attaching the
bpf filter. Also, if packets are restricted to a single packet, using
bind with sll_ifindex is simpler.

  reply	other threads:[~2017-01-04 15:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 23:27 [PATCH net-next 0/2] tools: psock_tpacket bug fixes Sowmini Varadhan
2017-01-03 23:27 ` [PATCH net-next 1/2] tools: psock_lib: tighten conditions checked in sock_setfilter Sowmini Varadhan
2017-01-04 14:27   ` Willem de Bruijn
2017-01-03 23:27 ` [PATCH net-next 2/2] tools: psock_tpacket: verify that packet was received on lo before counting it Sowmini Varadhan
2017-01-04 14:30   ` Willem de Bruijn
2017-01-04 14:44     ` Sowmini Varadhan
2017-01-04 15:03       ` Willem de Bruijn [this message]
2017-01-04 15:13         ` Sowmini Varadhan
2017-01-04 16:07           ` Willem de Bruijn
2017-01-04 16:12             ` Sowmini Varadhan
2017-01-04 16:24               ` Willem de Bruijn
2017-01-04 16:27                 ` Sowmini Varadhan

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='CAF=yD-KUw8M+RGnN2eXLVgv836F6mxd4+b0h=2CP6X7mv+ScWg@mail.gmail.com' \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=sowmini.varadhan@oracle.com \
    --cc=willemb@google.com \
    /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.