]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables-nft: fix -f fragment option
authorFlorian Westphal <fw@strlen.de>
Sun, 11 Nov 2018 21:02:39 +0000 (22:02 +0100)
committerFlorian Westphal <fw@strlen.de>
Sun, 11 Nov 2018 21:03:29 +0000 (22:03 +0100)
This needs to be passed in network byte order.

Reported-by: Arno van Amersfoort <arnova@rocky.eld.leidenuniv.nl>
Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1292
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/nft-ipv4.c

index 6a8a7cedf6e349fbe84e0f30ff9dcf40223436ff..ffb439b4a1128ea8be659d550b9e91a643245709 100644 (file)
@@ -64,7 +64,7 @@ static int nft_ipv4_add(struct nftnl_rule *r, void *data)
                add_payload(r, offsetof(struct iphdr, frag_off), 2,
                            NFT_PAYLOAD_NETWORK_HEADER);
                /* get the 13 bits that contain the fragment offset */
-               add_bitwise_u16(r, 0x1fff, 0);
+               add_bitwise_u16(r, htons(0x1fff), 0);
 
                /* if offset is non-zero, this is a fragment */
                op = NFT_CMP_NEQ;