Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Jörg Lübbert" <j.luebbert@login-lanstation.de>
To: netfilter@vger.kernel.org
Subject: Netfilter and performance
Date: Sat, 17 Nov 2007 14:24:20 +0100	[thread overview]
Message-ID: <473EEB84.3@login-lanstation.de> (raw)

Hello,

In an effort to optimize my rule generating script, I came to a point 
where I wonder about the internal workings of iptables and about which 
is faster and what not. Maybe you guys can help me out with the 3 
scenarios I wonder about:

First:

What is faster. Matching "-m state --state NEW" or "-m mark --mark 1" 
for every packet? Probably makes no or little difference, or?



Second in an extra chain of the mangle table:

many_matches -j MARK --set-mark i
-m mark --mark i -j RETURN
many_matches -j MARK --set-mark j
-m mark --mark j -j RETURN
more like these for an undefined number of times

or

many_matches -m mark ! --mark 0/0 -j MARK --set-mark i
many_matches -m mark ! --mark 0/0 -j MARK --set-mark j
more like these for an undefined number of times

So here we have one extra rule per match with the advantage to skip the 
rest of the rules as soon as one packet is marked vs one extra rule per 
match without the possibility to skip the rest of the matches.



And third, also in an extra chain of the mangle table:

many_matches -j CLASSIFY --set-class i:j
same_as_above_matches -j RETURN
many_matches -j CLASSIFY --set-class n:m
same_as_above_matches b match b -j RETURN
more like these for an undefined number of times

or

many_matches -j MARK --set-mark i
-m mark i -j RETURN
tc filter add ... handle i fw flowid n:m
many_matches -j MARK --set-mark j
-m mark j -j RETURN
tc filter add ... handle j fw flowid o:p
more like these for an undefined number of times



Thanks for your help

- Jörg Lübbert

                 reply	other threads:[~2007-11-17 13:24 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=473EEB84.3@login-lanstation.de \
    --to=j.luebbert@login-lanstation.de \
    --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