Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Andreas Herz <andi@geekosphere.org>
To: netfilter@vger.kernel.org
Subject: Question about packet processing in iptables/netfilter
Date: Wed, 24 Jun 2015 14:51:59 +0200	[thread overview]
Message-ID: <20150624125159.GN21348@kvmbude> (raw)

Hi,

i'm trying to understand the packet processing in iptables/netfilter in
regard to sequential and parallel processing.

I know the packet flow from raw -> mangle -> nat -> filter etc. as shown
in the graph:

https://en.wikipedia.org/wiki/File:Netfilter-packet-flow.svg

What i want to know is the processing of successive packets. Are they
processed packet after packet sequentially or in parallel (on a normal
intel nic without special multiqueue support)?

Let's take an example with an scan from one source 1.0.0.1 to X
destinations 2.0.0.1-2.0.0.100. 

Does the first packet A (1.0.0.1 - 2.0.0.1) have to go through every
matching rule before the second packet B (1.0.0.1 - 2.0.0.2) gets
analysed?
Or does netfilter analyse B already while A is going through the
ruleset?
And is it possible that B (or any other following packet) overhauls A?
Or is it limited to the tables like mangle, nat, filter, so A goes
through mangle and as soon as A enters nat B enters mangle and waits
until A went through nat table to enter itself?

The reason is that with a rather huge ruleset i get some conditions that
it looks like parallel processing or at least the way witht he dedicated
tables.

A ruleset might look like:

a) iptables -t mangle -m set --match-set test src -j DROP
[...]
z) iptables -t filter -m foobar -j SET --add-set test src

Is it possible that packet B already got to the rule a) and skip the
drop while packet A did not reach the rule z) although it would have
matched and thus B should have been dropped?
This wouldn't be possible if B waits for A to finish it processing but
this would be rather bad in terms of perfomance although it would
prevent the "race condition".

Thanks so far :)

-- 
Andreas Herz

                 reply	other threads:[~2015-06-24 12:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20150624125159.GN21348@kvmbude \
    --to=andi@geekosphere.org \
    --cc=netfilter@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox