From: Adrian Turcu <adrian.turcu@gmvinteractive.com>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] MARK vs CLASSIFY with tc
Date: Wed, 06 Apr 2005 16:54:56 +0000 [thread overview]
Message-ID: <200504061754.58927.adrian.turcu@gmvinteractive.com> (raw)
In-Reply-To: <200504061628.35365.adrian.turcu@gmvinteractive.com>
Hi Wang Jian,
On Wed 06 Apr 2005 17:18, Wang Jian wrote:
> ...
> It depends. You must consider the ruleset size and ruleset pattern.
>
> For a large ruleset. It is not good to let every packet goes through the
> rule and gets matched on some class. Think about 200 rules as an example.
>
> It is better to have some kind of memory on a flow. If first packet of a
> flow is classified as class C1, then it good to remember it and every
> following packet of this flow is classified as class C1.
>
> iptables/netfilter has CONNMARK support, which can be used to remember
> an u32 number, and then set packet's mark from this CONNMARK.
>
> You can use such scheme
>
> # if the flag is set, then restore connmark to mark
> iptables -m connmark --mark value/mask -j CONNMARK --restore-mark --mask
> mask
Do you know if this mask here is able to match more then one mark? Like if
say, to mach the marks range from 10000 (0x2710) to 20000 (0x4e20) the above
will be:
iptables ... -m connmark --mark 0x2710/0xb1df -j CONNMARK --restore-mask
--mask 0xb1df
where 0xb1df is (65535 XOR 20000). I guess is just XOR not XOR then +1 (this
will give a mask value of 0xb1e0) which I saw in some examples (google) of
using the masking bits.
> # else, do the various match
> iptables <match rule 1> -j CONNMARK --set-mark value/mask
> iptables <match rule 1> -j RETURN
> iptables <match rule 2> -j CONNMARK --set-mark value/mask
> iptables <match rule 2> -j RETURN
>
it makes a lot of sense (have to review a bit the netfilter/iptables docs to
bring myself up to speed)
> Using this method, first packet is matched in O(N), but following
> packets are matched in O(1).
>
> So it is good to use iptables CONNMARK + MARK and tc fw filter.
>
> But, if the ruleset is small, the difference should be small. You then
> should choose the better one for you:
>
> 1. netfilter is more flexible;
> 2. tc filter is expected to be a little faster (I am not sure);
>
Thanks a lot,
Adrian
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
prev parent reply other threads:[~2005-04-06 16:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-06 15:28 [LARTC] MARK vs CLASSIFY with tc Adrian Turcu
2005-04-06 16:18 ` Wang Jian
2005-04-06 16:54 ` Adrian Turcu [this message]
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=200504061754.58927.adrian.turcu@gmvinteractive.com \
--to=adrian.turcu@gmvinteractive.com \
--cc=lartc@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 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.