From: Florian Westphal <fw@strlen.de>
To: Sven-Haegar Koch <haegar@sdinet.de>
Cc: netfilter-devel@vger.kernel.org,
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Subject: Re: iptables/ipset "-m set" alignment problem 64bit kernel 32bit userspace
Date: Fri, 31 Oct 2014 23:50:37 +0100 [thread overview]
Message-ID: <20141031225037.GP10069@breakpoint.cc> (raw)
In-Reply-To: <alpine.DEB.2.11.1410312256090.1586@aurora.sdinet.de>
Sven-Haegar Koch <haegar@sdinet.de> wrote:
> Hallo,
>
> Problem with 32bit userspace iptables, 64bit kernel and the "-m set"
> ipset match.
>
> iptables:
> 32bit, debian 1.4.21-2 plus the ipset patch from the git branch
>
> kernel:
> 64bit, debian 3.2.63-2+deb7u1 plus ipset 6.23
>
> When trying to add an iptables set match it fails with the following
> error when using 64bit kernel and 32bit userspace:
>
> sims:~# iptables -A OUTPUT -m set --match-set testset src -j ACCEPT
> iptables: Invalid argument. Run `dmesg' for more information.
>
> In syslog:
> x_tables: ip_tables: set.3 match: invalid size 48 (kernel) != (user) 32
>
>
> Adding some hacky paddings to the userspace iptables makes it work with
> my 64bit kernel, but this way is naturally no real solution:
>
> (whitespace damaged, cut&paste)
>
> --- a/include/linux/netfilter/ipset/ip_set.h
> +++ b/include/linux/netfilter/ipset/ip_set.h
> @@ -238,6 +238,7 @@ enum {
>
> struct ip_set_counter_match {
> __u8 op;
> + __u8 padding[7];
> __u64 value;
Ouch.
> I do not see a way to cleanly fix the revision 3 set match, as any
> change would break it for either existing 32+32 or 64+64 environments -
Right.
The unclean fix is to provide compat fixup hooks to transparently
convert it in the kernel.
See net/netfilter/xt_limit.c for full example, essentially the
target/match description has to provide
static struct xt_match limit_mt_reg __read_mostly = {
.name = "limit",
[..]
#ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_xt_rateinfo),
.compat_from_user = limit_mt_compat_from_user,
.compat_to_user = limit_mt_compat_to_user,
#endif
The size of the 32bit layout and convert hooks that translate
from the 32 to 64 bit layout (and vice versa).
Jozsef -- v4 or compat crap? :-)
next prev parent reply other threads:[~2014-10-31 22:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-31 22:30 iptables/ipset "-m set" alignment problem 64bit kernel 32bit userspace Sven-Haegar Koch
2014-10-31 22:50 ` Florian Westphal [this message]
2014-10-31 22:57 ` Jan Engelhardt
2014-11-01 9:51 ` Jozsef Kadlecsik
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=20141031225037.GP10069@breakpoint.cc \
--to=fw@strlen.de \
--cc=haegar@sdinet.de \
--cc=kadlec@blackhole.kfki.hu \
--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 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.