* [PATCH nf-next] netfilter: nft_bitwise: correct uapi header comment.
@ 2020-01-01 13:41 Jeremy Sowden
2020-01-16 14:51 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Sowden @ 2020-01-01 13:41 UTC (permalink / raw)
To: Netfilter Devel
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 <jeremy@azazel.net>
---
include/uapi/linux/netfilter/nf_tables.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index e237ecbdcd8a..dd4611767933 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -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
*/
--
2.24.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH nf-next] netfilter: nft_bitwise: correct uapi header comment.
2020-01-01 13:41 [PATCH nf-next] netfilter: nft_bitwise: correct uapi header comment Jeremy Sowden
@ 2020-01-16 14:51 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-01-16 14:51 UTC (permalink / raw)
To: Jeremy Sowden; +Cc: Netfilter Devel
On Wed, Jan 01, 2020 at 01:41:32PM +0000, Jeremy Sowden wrote:
> 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.
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-16 14:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-01 13:41 [PATCH nf-next] netfilter: nft_bitwise: correct uapi header comment Jeremy Sowden
2020-01-16 14:51 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).