]> git.ipfire.org Git - thirdparty/nftables.git/commit
netlink_linearize: fix flagcmp op
authorPatrick McHardy <kaber@trash.net>
Sun, 16 Feb 2014 18:33:16 +0000 (18:33 +0000)
committerPatrick McHardy <kaber@trash.net>
Sun, 16 Feb 2014 18:33:24 +0000 (18:33 +0000)
commit20162176b5def48a6203534313299e011a76b640
treeb5dddc3735825df780179b6856931f75ae0ebf47
parentf534b9a7ca87cd3b170b6bb22449e51361d2a9e3
netlink_linearize: fix flagcmp op

Florian reports that flag comparisons generate incorrect instructions:

$ nft --debug=netlink add rule filter output ct labels foo
ip filter output 0 0
 [ ct load labels => reg 1 ]
 [ bitwise reg 1 = (reg=1 & 0x00000001 0x00000000 0x00000000 0x00000000 ) ^ 0x00000000 0x00000000 0x00000000 0x00000000 ]
 [ cmp neq reg 1 0x00000001 0x00000000 0x00000000 0x00000000 ]

The "cmp new" should compare to zero. This was broken by commit aae836a7
(src: use libnftables by using expr->right instead of zero.

Slightly rearrange the code as well to prevent similar problems in the
future.

Signed-off-by: Patrick McHardy <kaber@trash.net>
src/netlink_linearize.c