Blame SOURCES/0031-extensions-among-Fix-bitmask-check.patch

05e71a
From 4237aad9c04ac6a82756545a49ae8e9bd0fe9fac Mon Sep 17 00:00:00 2001
05e71a
From: Phil Sutter <phil@nwl.cc>
05e71a
Date: Mon, 12 Nov 2018 17:50:27 +0100
05e71a
Subject: [PATCH] extensions: among: Fix bitmask check
05e71a
05e71a
Boolean AND was applied instead of binary one, causing the exclamation
05e71a
mark to be printed whenever info->bitmask was non-zero. In practice,
05e71a
this leads to incorrect output if e.g. --among-src was given with an
05e71a
inverted match as well as --among-dst with a non-inverted one. Output
05e71a
would then list both matches as inverted.
05e71a
05e71a
Signed-off-by: Phil Sutter <phil@nwl.cc>
05e71a
Signed-off-by: Florian Westphal <fw@strlen.de>
05e71a
Signed-off-by: Phil Sutter <psutter@redhat.com>
05e71a
---
05e71a
 extensions/ebt_among.c | 4 ++--
05e71a
 1 file changed, 2 insertions(+), 2 deletions(-)
05e71a
05e71a
diff --git a/extensions/ebt_among.c b/extensions/ebt_among.c
05e71a
index b1560e8f09e8d..30c098cf69f96 100644
05e71a
--- a/extensions/ebt_among.c
05e71a
+++ b/extensions/ebt_among.c
05e71a
@@ -436,14 +436,14 @@ static void print(const struct ebt_u_entry *entry,
05e71a
 
05e71a
 	if (info->wh_dst_ofs) {
05e71a
 		printf("--among-dst ");
05e71a
-		if (info->bitmask && EBT_AMONG_DST_NEG) {
05e71a
+		if (info->bitmask & EBT_AMONG_DST_NEG) {
05e71a
 			printf("! ");
05e71a
 		}
05e71a
 		wormhash_printout(ebt_among_wh_dst(info));
05e71a
 	}
05e71a
 	if (info->wh_src_ofs) {
05e71a
 		printf("--among-src ");
05e71a
-		if (info->bitmask && EBT_AMONG_SRC_NEG) {
05e71a
+		if (info->bitmask & EBT_AMONG_SRC_NEG) {
05e71a
 			printf("! ");
05e71a
 		}
05e71a
 		wormhash_printout(ebt_among_wh_src(info));
05e71a
-- 
05e71a
2.21.0
05e71a