summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-11-12 17:50:27 +0100
committerFlorian Westphal <fw@strlen.de>2018-11-12 18:18:03 +0100
commitca223bf49807d55c80d4fe1604dc943e6dc069d7 (patch)
treed03ebfb720a918e17ae8f1fb418e7036c5ea29a5 /extensions
parent3de42b55ae249573425d11a5d77ab65f4bc5c628 (diff)
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 <phil@nwl.cc> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/ebt_among.c4
1 files 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));