From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft 1/3] netlink: swap byteorder for host-endian concat data
Date: Fri, 29 Apr 2022 20:32:37 +0200 [thread overview]
Message-ID: <20220429183239.5569-2-fw@strlen.de> (raw)
In-Reply-To: <20220429183239.5569-1-fw@strlen.de>
All data must be passed in network byte order, else matching
won't work respectively kernel will reject the interval because
it thinks that start is after end
This is needed to allow use of 'ppp*' in interval sets with
concatenations.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/netlink.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/netlink.c b/src/netlink.c
index 240c937e3ac5..89d864ed046a 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -259,6 +259,10 @@ static int netlink_gen_concat_data_expr(int end, const struct expr *i,
mpz_t v;
mpz_init_bitmask(v, i->len - i->prefix_len);
+
+ if (i->byteorder == BYTEORDER_HOST_ENDIAN)
+ mpz_switch_byteorder(v, i->len / BITS_PER_BYTE);
+
mpz_add(v, i->prefix->value, v);
count = netlink_export_pad(data, v, i);
mpz_clear(v);
--
2.35.1
next prev parent reply other threads:[~2022-04-29 18:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 18:32 [PATCH nft 0/3] nftables: add support for wildcard interfaces Florian Westphal
2022-04-29 18:32 ` Florian Westphal [this message]
2022-04-29 18:32 ` [PATCH nft 2/3] segtree: add pretty-print support for wildcard strings in concatenated sets Florian Westphal
2022-04-29 18:32 ` [PATCH nft 3/3] sets_with_ifnames: add test case for concatenated range Florian Westphal
2022-05-02 18:58 ` [PATCH nft 0/3] nftables: add support for wildcard interfaces 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=20220429183239.5569-2-fw@strlen.de \
--to=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).