]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
include: nf_tables: correct bitwise header comment.
authorJeremy Sowden <jeremy@azazel.net>
Sun, 19 Jan 2020 10:58:01 +0000 (10:58 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 22 Jan 2020 22:06:56 +0000 (23:06 +0100)
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/linux/netfilter/nf_tables.h

index c556ccd3dbf7235fbc2de9b24ef8002d24dc32b4..42ed5ca39477e13fbaedb00f6525ca5f45a078ce 100644 (file)
@@ -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:               x
+ * OR:         ~x      x
  * XOR:                1       x
  * AND:                x       0
  */