From: Jan Engelhardt <jengelh@medozas.de>
To: kaber@trash.net
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 09/11] netfilter: ebtables: change ebt_basic_match to xt convention
Date: Mon, 3 May 2010 11:51:34 +0200 [thread overview]
Message-ID: <1272880297-11198-10-git-send-email-jengelh@medozas.de> (raw)
In-Reply-To: <1272880297-11198-1-git-send-email-jengelh@medozas.de>
When this will become an xt_match, it needs the xt semantics;
this mandates changing the return values from 1/0 to 0/1.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
net/bridge/netfilter/ebtables.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 1f8256b..7f3ba94 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -122,7 +122,7 @@ ebt_dev_check(const char *entry, const struct net_device *device)
#define FWINV2(bool,invflg) ((bool) ^ !!(e->invflags & invflg))
/* process standard matches */
-static inline int
+static inline bool
ebt_basic_match(const struct ebt_entry *e, const struct ethhdr *h,
const struct net_device *in, const struct net_device *out)
{
@@ -130,21 +130,21 @@ ebt_basic_match(const struct ebt_entry *e, const struct ethhdr *h,
if (e->bitmask & EBT_802_3) {
if (FWINV2(ntohs(h->h_proto) >= 1536, EBT_IPROTO))
- return 1;
+ return false;
} else if (!(e->bitmask & EBT_NOPROTO) &&
FWINV2(e->ethproto != h->h_proto, EBT_IPROTO))
- return 1;
+ return false;
if (FWINV2(ebt_dev_check(e->in, in), EBT_IIN))
- return 1;
+ return false;
if (FWINV2(ebt_dev_check(e->out, out), EBT_IOUT))
- return 1;
+ return false;
if ((!in || !in->br_port) ? 0 : FWINV2(ebt_dev_check(
e->logical_in, in->br_port->br->dev), EBT_ILOGICALIN))
- return 1;
+ return false;
if ((!out || !out->br_port) ? 0 : FWINV2(ebt_dev_check(
e->logical_out, out->br_port->br->dev), EBT_ILOGICALOUT))
- return 1;
+ return false;
if (e->bitmask & EBT_SOURCEMAC) {
verdict = 0;
@@ -152,7 +152,7 @@ ebt_basic_match(const struct ebt_entry *e, const struct ethhdr *h,
verdict |= (h->h_source[i] ^ e->sourcemac[i]) &
e->sourcemsk[i];
if (FWINV2(verdict != 0, EBT_ISOURCE) )
- return 1;
+ return false;
}
if (e->bitmask & EBT_DESTMAC) {
verdict = 0;
@@ -160,9 +160,9 @@ ebt_basic_match(const struct ebt_entry *e, const struct ethhdr *h,
verdict |= (h->h_dest[i] ^ e->destmac[i]) &
e->destmsk[i];
if (FWINV2(verdict != 0, EBT_IDEST) )
- return 1;
+ return false;
}
- return 0;
+ return true;
}
static inline __pure
@@ -209,7 +209,7 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb,
base = private->entries;
i = 0;
while (i < nentries) {
- if (ebt_basic_match(point, eth_hdr(skb), in, out))
+ if (!ebt_basic_match(point, eth_hdr(skb), in, out))
goto letscontinue;
if (EBT_MATCH_ITERATE(point, ebt_do_match, skb, &acpar) != 0)
--
1.7.0.5
next prev parent reply other threads:[~2010-05-03 9:52 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 ` [PATCH 03/11] netfilter: xtables: dissolve do_match function Jan Engelhardt
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 ` Jan Engelhardt [this message]
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-10-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).