From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Ian Pilcher <arequipeno@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [RFC PATCH 1/1] libnftnl: Fix res_id byte order
Date: Fri, 21 Oct 2022 11:28:20 +0200 [thread overview]
Message-ID: <Y1JmNDW8iLZgHo4f@salvia> (raw)
In-Reply-To: <a93c58a1-4006-0aaf-9f5b-7e3c3bba16c1@gmail.com>
On Thu, Oct 20, 2022 at 10:05:22AM -0500, Ian Pilcher wrote:
> On 10/19/22 01:44, Pablo Neira Ayuso wrote:
> > On Tue, Oct 18, 2022 at 11:45:28AM -0500, Ian Pilcher wrote:
> > > The res_id member of struct nfgenmsg is supposed to be in network
> > > byte order (big endian). Call htons() in __nftnl_nlmsg_build_hdr()
> > > to ensure that this is true on little endian systems.
> >
> > LGTM, this is zero all the time at this moment. But it might be useful
> > in the future to bump it.
>
> Actually it isn't always zero. I only noticed this because
> nftnl_batch_begin() and nftnl_batch_end() set res_id to
> NFNL_SUBSYS_NFTABLES (instead of putting it in the high 8 bits of
> nlmsg_type).
Indeed, nfnetlink batch uses this for begin and end message.
> It's entirely possible that this is also a bug, as the fact that the
> value isn't currently being byte-swapped doesn't seem to make any
> difference.
There is code to workaround this issue in the kernel, it was added in 4.3.
commit a9de9777d613500b089a7416f936bf3ae5f070d2
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Fri Aug 28 21:01:43 2015 +0200
netfilter: nfnetlink: work around wrong endianess in res_id field
oldest stable kernel is 4.9.
next prev parent reply other threads:[~2022-10-21 9:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 16:45 [RFC PATCH 0/1] libnftnl: Incorrect res_id byte order? Ian Pilcher
2022-10-18 16:45 ` [RFC PATCH 1/1] libnftnl: Fix res_id byte order Ian Pilcher
2022-10-19 6:44 ` Pablo Neira Ayuso
2022-10-20 15:05 ` Ian Pilcher
2022-10-21 9:28 ` Pablo Neira Ayuso [this message]
2022-10-25 10:37 ` Pablo Neira Ayuso
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=Y1JmNDW8iLZgHo4f@salvia \
--to=pablo@netfilter.org \
--cc=arequipeno@gmail.com \
--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