summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2022-04-29 20:32:37 +0200
committerFlorian Westphal <fw@strlen.de>2022-05-09 09:11:58 +0200
commit806ab081dc9ae3ea313ae9e471ee1c97c7a9e2ad (patch)
tree8faff6fffd9266616443776f019780dec663c947
parentc224aa6bc04fec945bd941aadccdb388b3ba32e6 (diff)
netlink: swap byteorder for host-endian concat data
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>
-rw-r--r--src/netlink.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/netlink.c b/src/netlink.c
index 240c937e..89d864ed 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);