From: Jan Engelhardt <jengelh@medozas.de>
To: kaber@trash.net
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 03/11] netfilter: xtables: dissolve do_match function
Date: Mon, 3 May 2010 11:51:28 +0200 [thread overview]
Message-ID: <1272880297-11198-4-git-send-email-jengelh@medozas.de> (raw)
In-Reply-To: <1272880297-11198-1-git-send-email-jengelh@medozas.de>
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
net/ipv4/netfilter/ip_tables.c | 22 +++++-----------------
net/ipv6/netfilter/ip6_tables.c | 22 +++++-----------------
2 files changed, 10 insertions(+), 34 deletions(-)
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index f92818f..265cedf 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -173,21 +173,6 @@ ipt_error(struct sk_buff *skb, const struct xt_target_param *par)
return NF_DROP;
}
-/* Performance critical - called for every packet */
-static inline bool
-do_match(const struct ipt_entry_match *m, const struct sk_buff *skb,
- struct xt_match_param *par)
-{
- par->match = m->u.kernel.match;
- par->matchinfo = m->data;
-
- /* Stop iteration if it doesn't match */
- if (!m->u.kernel.match->match(skb, par))
- return true;
- else
- return false;
-}
-
/* Performance critical */
static inline struct ipt_entry *
get_entry(const void *base, unsigned int offset)
@@ -379,9 +364,12 @@ ipt_do_table(struct sk_buff *skb,
continue;
}
- xt_ematch_foreach(ematch, e)
- if (do_match(ematch, skb, &mtpar) != 0)
+ xt_ematch_foreach(ematch, e) {
+ mtpar.match = ematch->u.kernel.match;
+ mtpar.matchinfo = ematch->data;
+ if (!mtpar.match->match(skb, &mtpar))
goto no_match;
+ }
ADD_COUNTER(e->counters, ntohs(ip->tot_len), 1);
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 7afa117..f8ac4a0 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -205,21 +205,6 @@ ip6t_error(struct sk_buff *skb, const struct xt_target_param *par)
return NF_DROP;
}
-/* Performance critical - called for every packet */
-static inline bool
-do_match(const struct ip6t_entry_match *m, const struct sk_buff *skb,
- struct xt_match_param *par)
-{
- par->match = m->u.kernel.match;
- par->matchinfo = m->data;
-
- /* Stop iteration if it doesn't match */
- if (!m->u.kernel.match->match(skb, par))
- return true;
- else
- return false;
-}
-
static inline struct ip6t_entry *
get_entry(const void *base, unsigned int offset)
{
@@ -402,9 +387,12 @@ ip6t_do_table(struct sk_buff *skb,
continue;
}
- xt_ematch_foreach(ematch, e)
- if (do_match(ematch, skb, &mtpar) != 0)
+ xt_ematch_foreach(ematch, e) {
+ mtpar.match = ematch->u.kernel.match;
+ mtpar.matchinfo = ematch->data;
+ if (!mtpar.match->match(skb, &mtpar))
goto no_match;
+ }
ADD_COUNTER(e->counters,
ntohs(ipv6_hdr(skb)->payload_len) +
--
1.7.0.5
next prev parent reply other threads:[~2010-05-03 9:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-03 9:51 nf-next: a mixed bag Jan Engelhardt
2010-05-03 9:51 ` [PATCH 01/11] netfilter: ip_tables: fix compilation when debug is enabled Jan Engelhardt
2010-05-03 9:51 ` [PATCH 02/11] netfilter: xtables: fix incorrect return code Jan Engelhardt
2010-05-03 9:51 ` Jan Engelhardt [this message]
2010-05-03 9:51 ` [PATCH 04/11] netfilter: xtables: combine struct xt_match_param and xt_target_param Jan Engelhardt
2010-05-03 9:51 ` [PATCH 05/11] netfilter: xtables: substitute temporary defines by final name Jan Engelhardt
2010-05-03 9:51 ` [PATCH 06/11] netfilter: xtables: deconstify struct xt_action_param for matches Jan Engelhardt
2010-05-03 9:51 ` [PATCH 07/11] netfilter: xtables: change hotdrop pointer to direct modification Jan Engelhardt
2010-05-03 9:51 ` [PATCH 08/11] netfilter: xtables: combine built-in extension structs Jan Engelhardt
2010-05-03 9:51 ` [PATCH 09/11] netfilter: ebtables: change ebt_basic_match to xt convention Jan Engelhardt
2010-05-03 9:51 ` [PATCH 10/11] netfilter: xtables: move functions around Jan Engelhardt
2010-05-03 9:51 ` [PATCH 11/11] netfilter: xtables: convert basic nfproto match functions into xt matches Jan Engelhardt
2010-05-11 12:59 ` Patrick McHardy
2010-05-11 13:38 ` Jan Engelhardt
2010-05-11 13:45 ` Patrick McHardy
2010-05-11 16:08 ` Jan Engelhardt
2010-05-07 20:11 ` nf-next: a mixed bag Jan Engelhardt
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=1272880297-11198-4-git-send-email-jengelh@medozas.de \
--to=jengelh@medozas.de \
--cc=kaber@trash.net \
--cc=netfilter-devel@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;
as well as URLs for NNTP newsgroup(s).