From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Subject: [PATCH 4/4]: Add inversion to multiport match
Date: Tue, 25 Jan 2005 05:48:38 +0100 [thread overview]
Message-ID: <41F5CFA6.7030400@trash.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 04.diff --]
[-- Type: text/x-patch, Size: 2685 bytes --]
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/01/25 04:31:49+01:00 kernel@linuxace.com
# [NETFILTER]: Add inversion to multiport match
#
# Should add this to rev1 of multiport before 2.6.11 comes out.
#
# Signed-off-by: Phil Oester <kernel@linuxace.com>
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
# net/ipv4/netfilter/ipt_multiport.c
# 2005/01/25 04:31:40+01:00 kernel@linuxace.com +8 -7
# [NETFILTER]: Add inversion to multiport match
#
# Should add this to rev1 of multiport before 2.6.11 comes out.
#
# Signed-off-by: Phil Oester <kernel@linuxace.com>
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
# include/linux/netfilter_ipv4/ipt_multiport.h
# 2005/01/25 04:31:40+01:00 kernel@linuxace.com +1 -0
# [NETFILTER]: Add inversion to multiport match
#
# Should add this to rev1 of multiport before 2.6.11 comes out.
#
# Signed-off-by: Phil Oester <kernel@linuxace.com>
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
diff -Nru a/include/linux/netfilter_ipv4/ipt_multiport.h b/include/linux/netfilter_ipv4/ipt_multiport.h
--- a/include/linux/netfilter_ipv4/ipt_multiport.h 2005-01-25 04:37:23 +01:00
+++ b/include/linux/netfilter_ipv4/ipt_multiport.h 2005-01-25 04:37:23 +01:00
@@ -25,5 +25,6 @@
u_int8_t count; /* Number of ports */
u_int16_t ports[IPT_MULTI_PORTS]; /* Ports */
u_int8_t pflags[IPT_MULTI_PORTS]; /* Port flags */
+ u_int8_t invert; /* Invert flag */
};
#endif /*_IPT_MULTIPORT_H*/
diff -Nru a/net/ipv4/netfilter/ipt_multiport.c b/net/ipv4/netfilter/ipt_multiport.c
--- a/net/ipv4/netfilter/ipt_multiport.c 2005-01-25 04:37:23 +01:00
+++ b/net/ipv4/netfilter/ipt_multiport.c 2005-01-25 04:37:23 +01:00
@@ -64,30 +64,31 @@
if (minfo->flags == IPT_MULTIPORT_SOURCE
&& src >= s && src <= e)
- return 1;
+ return 1 ^ minfo->invert;
if (minfo->flags == IPT_MULTIPORT_DESTINATION
&& dst >= s && dst <= e)
- return 1;
+ return 1 ^ minfo->invert;
if (minfo->flags == IPT_MULTIPORT_EITHER
&& ((dst >= s && dst <= e)
|| (src >= s && src <= e)))
- return 1;
+ return 1 ^ minfo->invert;
} else {
/* exact port matching */
duprintf("src or dst matches with %d?\n", s);
+
if (minfo->flags == IPT_MULTIPORT_SOURCE
&& src == s)
- return 1;
+ return 1 ^ minfo->invert;
if (minfo->flags == IPT_MULTIPORT_DESTINATION
&& dst == s)
- return 1;
+ return 1 ^ minfo->invert;
if (minfo->flags == IPT_MULTIPORT_EITHER
&& (src == s || dst == s))
- return 1;
+ return 1 ^ minfo->invert;
}
}
- return 0;
+ return minfo->invert;
}
static int
reply other threads:[~2005-01-25 4:48 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=41F5CFA6.7030400@trash.net \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=netfilter-devel@lists.netfilter.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.