Skip to contentSkip to conversation

netfilter: nft_bitwise: correct uapi header comment.

PATCH Applied Jeremy Sowden 2 participants 2 messages Jan 1, 2020 – Jan 16, 2020 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: nft_bitwise: correct uapi 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.

---
 include/uapi/linux/netfilter/nf_tables.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/netfilter/nf_tables.h +1 -1
index e237ecbdcd8a..dd4611767933 100644
@@ -501,7 +501,7 @@ enum nft_immediate_attributes {
  *
  * 		mask	xor
  * NOT:		1	1
- * OR:		0	x
+ * OR:		~x	x
  * XOR:		1	x
  * AND:		x	0
  */
Signature · 1 line
2.24.1
maintainer Applied
#1 lore raw
Quoted 13 lines · Jeremy Sowden

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:

Quoted 7 lines

dreg = sreg | x

What the code actually does is:

dreg = (sreg & ~x) ^ x

Update the documentation to match.

Applied, thanks.