From: Pavel Emelyanov <xemul@openvz.org>
To: David Miller <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>,
Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH (resend)][EBTABLES]: Fix alignment checks in ebt_among.ko module.
Date: Fri, 29 Feb 2008 11:28:44 +0300 [thread overview]
Message-ID: <47C7C23C.2050100@openvz.org> (raw)
I've sent this patch some days ago to Bart, but with no answer...
When trying to do
# ebtables -A FORWARD --among-src 0:12:34:56:78:9a=192.168.0.10 -j ACCEPT
on x86_64 box the ebt_among->check() callback warns me that
ebtables: among: wrong size: 1060 against expected 1056, rounded to 1056
Checking the ebtables sources, I found that the alignment is done
differently in the tool and the kernel. Tool makes it like this:
EBT_ALIGN(sizeof(struct ebt_among_info)) + X
while the kernel module like this:
EBT_ALIGN(sizeof(struct ebt_among_info) + X)
So the suggested fix is to move the alignment in the kernel. After
the fix the rule is added and appears in the ebtables -L output.
Originally developed by Evgeny Kravtsunov.
Signed-off-by: Evgeny Kravtsunov <emkravts@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c
index 70b6dca..349a543 100644
--- a/net/bridge/netfilter/ebt_among.c
+++ b/net/bridge/netfilter/ebt_among.c
@@ -182,7 +182,7 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask,
unsigned int datalen)
{
const struct ebt_among_info *info = data;
- int expected_length = sizeof(struct ebt_among_info);
+ int expected_length = EBT_ALIGN(sizeof(struct ebt_among_info));
const struct ebt_mac_wormhash *wh_dst, *wh_src;
int err;
@@ -191,7 +191,7 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask,
expected_length += ebt_mac_wormhash_size(wh_dst);
expected_length += ebt_mac_wormhash_size(wh_src);
- if (datalen != EBT_ALIGN(expected_length)) {
+ if (datalen != expected_length) {
printk(KERN_WARNING
"ebtables: among: wrong size: %d "
"against expected %d, rounded to %Zd\n",
next reply other threads:[~2008-02-29 8:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-29 8:28 Pavel Emelyanov [this message]
2008-02-29 12:48 ` [PATCH (resend)][EBTABLES]: Fix alignment checks in ebt_among.ko module Patrick McHardy
2008-02-29 15:40 ` Jan Engelhardt
2008-02-29 17:23 ` Bart De Schuymer
2008-02-29 18:46 ` Jan Engelhardt
2008-03-02 15:12 ` Bart De Schuymer
2008-03-03 8:50 ` Pavel Emelyanov
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=47C7C23C.2050100@openvz.org \
--to=xemul@openvz.org \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=netdev@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).