From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: nftables batch abi broken ...
Date: Thu, 27 Aug 2015 18:46:13 +0200 [thread overview]
Message-ID: <20150827164613.GD3431@salvia> (raw)
In-Reply-To: <20150827153151.GA17804@breakpoint.cc>
On Thu, Aug 27, 2015 at 05:31:51PM +0200, Florian Westphal wrote:
> Hi.
>
> batch handling in libnftnl uses this:
> libnftnl/src/common.c: nfg->res_id = NFNL_SUBSYS_NFTABLES;
>
> It SHOULD be:
> libnftnl/src/common.c: nfg->res_id = htons(NFNL_SUBSYS_NFTABLES)
>
> since res_id is a __be16.
>
> The kernel contains the same error when decoding batch messages
> which is why this works :-/
>
> I found this problem when looking at sparse error reports on the kernel
> where sparse complains about the following line in nfnetlink_rcv():
>
> nfnetlink_rcv_batch(skb, nlh, nfgenmsg->res_id);
>
> and sparse complaint is correct, __be16 is treated as u16 without
> conversion.
>
> How to fix this?
> If we want to maintain ABI on Little Endian only solution is to "fix"
> it in kernel by annotating this with explicit cast to u16.
>
> But it sucks since ->res_id is used via htons/ntohs in all other places
> :-/
>
> Any ideas?
We only have one subsystem that supports batching at this moment, ie.
nft, so we can add a workaround now, fix userspace and then drop the
workaround from the kernel at some point.
prev parent reply other threads:[~2015-08-27 16:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-27 15:31 nftables batch abi broken Florian Westphal
2015-08-27 16:46 ` Pablo Neira Ayuso [this message]
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=20150827164613.GD3431@salvia \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--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).