From: Patrick McHardy <kaber@trash.net>
To: Philip Craig <philipc@snapgear.com>
Cc: Netfilter Developer Mailing List <netfilter-devel@lists.netfilter.org>
Subject: Re: [RFC][PATCH] optimise iptables interface matching
Date: Thu, 24 May 2007 19:43:12 +0200 [thread overview]
Message-ID: <4655CEB0.4060306@trash.net> (raw)
In-Reply-To: <465528CB.4020108@snapgear.com>
Philip Craig wrote:
> Optimise iptables for rules that specify 0 or 1 interface matches,
> which is the more common case (at least for my rulesets).
>
> Below are the oprofile cpu cycle percentages from a 30 second
> period of an iperf throughput test on a 667MHz IXP465 with
> Realtek 8169 network interfaces.
>
> rules iface % cpu before % cpu after saving (adjusted)
> 0 7.7662 4.9191 2.8471
> 10 0 15.9798 9.8453 3.2874
> 20 0 23.6914 14.2051 6.6392
> 10 1 14.6068 11.7332 0.0265
> 20 1 21.1646 17.1905 1.1270
> 10 2 14.6497 13.0306 -1.2280
> 20 2 21.1647 20.3536 -2.0360
>
> - saving with 0 rules is due to policies
> - adjusted saving means with the 0 rules saving subtracted
> - iface 0 means "iptables -I FORWARD"
> - iface 1 means "iptables -I FORWARD -i eth0"
> - iface 2 means "iptables -I FORWARD -i eth0 -o eth1"
>
> If you think this is an acceptable approach then I can update
> the patch for IPv6. Any suggestions for other parts of
> netfilter/iptables to look at optimising are also welcome.
I don't like the kernel-internal fiddling with the flags too
much, but I don't see a way around it. But even if there is
no other way,
> @@ -884,6 +897,15 @@ copy_entries_to_user(unsigned int total_
> goto free_counters;
> }
>
> + flags = e->ip.flags & IPT_F_MASK;
> + if (copy_to_user(userptr + off
> + + offsetof(struct ipt_entry, ip.flags),
> + &flags,
> + sizeof(flags)) != 0) {
> + ret = -EFAULT;
> + goto free_counters;
> + }
> +
userspace should just ignore unknown flags.
next prev parent reply other threads:[~2007-05-24 17:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-24 5:55 [RFC][PATCH] optimise iptables interface matching Philip Craig
2007-05-24 17:43 ` Patrick McHardy [this message]
2007-05-24 23:07 ` Philip Craig
2007-05-26 8:47 ` Patrick McHardy
2007-05-25 0:44 ` Yasuyuki KOZAKAI
2007-05-25 0:56 ` Philip Craig
2007-05-25 4:11 ` Yasuyuki KOZAKAI
2007-05-26 9:20 ` Patrick McHardy
2007-05-28 19:53 ` Henrik Nordstrom
2007-05-29 0:24 ` Philip Craig
2007-05-30 1:34 ` Henrik Nordstrom
2007-06-06 5:49 ` Philip Craig
2007-06-06 6:13 ` Eric Dumazet
2007-05-29 9:54 ` Patrick McHardy
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=4655CEB0.4060306@trash.net \
--to=kaber@trash.net \
--cc=netfilter-devel@lists.netfilter.org \
--cc=philipc@snapgear.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.