]> git.ipfire.org Git - thirdparty/nftables.git/commit
netlink: make checksum fixup work with odd-sized header fields
authorFlorian Westphal <fw@strlen.de>
Mon, 1 Aug 2016 15:11:41 +0000 (17:11 +0200)
committerFlorian Westphal <fw@strlen.de>
Mon, 1 Aug 2016 15:11:41 +0000 (17:11 +0200)
commitf9069cefdf991939da1c84b00edeea0ddd772b70
tree95a644d84a16daf28ee93f36f3ce43ec25647cc1
parentac94031b8f3ba79de5e4fd15a456c01bd5e1b8b4
netlink: make checksum fixup work with odd-sized header fields

The kernel checksum functions want even-sized lengths except for
the last block at the end of the data.

This means that

nft --debug=netlink add rule filter output ip ecn set 1

must generate a two byte read and a two byte write:

[ payload load 2b @ network header + 0 => reg 1 ]
[ bitwise reg 1 = (reg=1 & 0x0000fcff ) ^ 0x00000100 ]
[ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 ]

Otherwise, while a one-byte write is enough, the kernel will
generate invalid checksums (unless checksum is offloaded).

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c