summaryrefslogtreecommitdiffstats
path: root/src/netlink.c
diff options
context:
space:
mode:
authorJeremy Sowden <jeremy@azazel.net>2021-12-21 19:36:51 +0000
committerFlorian Westphal <fw@strlen.de>2022-01-15 17:07:43 +0100
commit6217dfe0f7055612a7691fddef23e4317ce245ed (patch)
treec1827129a87a3d71706ce03f54207311d31bc6e4 /src/netlink.c
parent419b07764d5c4ed5ee269546732b3602583be80d (diff)
src: remove arithmetic on booleans
Instead of subtracting a boolean from the protocol base for stacked payloads, just decrement the base variable itself. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/netlink.c')
-rw-r--r--src/netlink.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/netlink.c b/src/netlink.c
index 359d801c..5aad8659 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -1868,7 +1868,6 @@ static void trace_gen_stmts(struct list_head *stmts,
const void *hdr;
uint32_t hlen;
unsigned int n;
- bool stacked;
if (!nftnl_trace_is_set(nlt, attr))
return;
@@ -1923,6 +1922,8 @@ restart:
n = 0;
next:
list_for_each_entry(stmt, &unordered, list) {
+ enum proto_bases b = base;
+
rel = stmt->expr;
lhs = rel->left;
@@ -1935,17 +1936,18 @@ next:
list_move_tail(&stmt->list, stmts);
n++;
- stacked = payload_is_stacked(desc, rel);
+ if (payload_is_stacked(desc, rel))
+ b--;
if (lhs->flags & EXPR_F_PROTOCOL &&
pctx->pbase == PROTO_BASE_INVALID) {
- payload_dependency_store(pctx, stmt, base - stacked);
+ payload_dependency_store(pctx, stmt, b);
} else {
/* Don't strip 'icmp type' from payload dump. */
if (pctx->icmp_type == 0)
payload_dependency_kill(pctx, lhs, ctx->family);
if (lhs->flags & EXPR_F_PROTOCOL)
- payload_dependency_store(pctx, stmt, base - stacked);
+ payload_dependency_store(pctx, stmt, b);
}
goto next;