From: Jeremy Sowden Date: Sun, 19 Jan 2020 10:58:01 +0000 (+0000) Subject: include: nf_tables: correct bitwise header comment. X-Git-Tag: v0.9.4~93 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f833cb3c9ce4174671eb2c55d458221b4c00dd48;p=thirdparty%2Fnftables.git include: nf_tables: correct bitwise header comment. The comment documenting how bitwise expressions work includes a table which summarizes the mask and xor arguments combined to express the supported boolean operations. However, the row for OR: mask xor 0 x is incorrect. dreg = (sreg & 0) ^ x is not equivalent to: dreg = sreg | x What the code actually does is: dreg = (sreg & ~x) ^ x Update the documentation to match. Signed-off-by: Jeremy Sowden Signed-off-by: Pablo Neira Ayuso --- diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h index c556ccd3..42ed5ca3 100644 --- a/include/linux/netfilter/nf_tables.h +++ b/include/linux/netfilter/nf_tables.h @@ -491,15 +491,16 @@ enum nft_immediate_attributes { * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes) * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes) * - * The bitwise expression performs the following operation: + * The bitwise expression supports boolean and shift operations. It implements + * the boolean operations by performing the following operation: * * dreg = (sreg & mask) ^ xor * - * which allow to express all bitwise operations: + * with these mask and xor values: * * mask xor * NOT: 1 1 - * OR: 0 x + * OR: ~x x * XOR: 1 x * AND: x 0 */