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