Commit 354bf5a0 authored by Patrick McHardy's avatar Patrick McHardy Committed by Pablo Neira Ayuso

netfilter: nf_tables: consolidate tracing invocations

* JUMP and GOTO are equivalent except for JUMP pushing the current
  context to the stack

* RETURN and implicit RETURN (CONTINUE) are equivalent except that
  the logged rule number differs

Result:

  nft_do_chain              | -112
 1 function changed, 112 bytes removed, diff: -112
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 01ef16c2
...@@ -170,26 +170,23 @@ nft_do_chain(struct nft_pktinfo *pkt, const struct nf_hook_ops *ops) ...@@ -170,26 +170,23 @@ nft_do_chain(struct nft_pktinfo *pkt, const struct nf_hook_ops *ops)
switch (data[NFT_REG_VERDICT].verdict) { switch (data[NFT_REG_VERDICT].verdict) {
case NFT_JUMP: case NFT_JUMP:
nft_trace_packet(pkt, chain, rulenum, NFT_TRACE_RULE);
BUG_ON(stackptr >= NFT_JUMP_STACK_SIZE); BUG_ON(stackptr >= NFT_JUMP_STACK_SIZE);
jumpstack[stackptr].chain = chain; jumpstack[stackptr].chain = chain;
jumpstack[stackptr].rule = rule; jumpstack[stackptr].rule = rule;
jumpstack[stackptr].rulenum = rulenum; jumpstack[stackptr].rulenum = rulenum;
stackptr++; stackptr++;
chain = data[NFT_REG_VERDICT].chain; /* fall through */
goto do_chain;
case NFT_GOTO: case NFT_GOTO:
nft_trace_packet(pkt, chain, rulenum, NFT_TRACE_RULE); nft_trace_packet(pkt, chain, rulenum, NFT_TRACE_RULE);
chain = data[NFT_REG_VERDICT].chain; chain = data[NFT_REG_VERDICT].chain;
goto do_chain; goto do_chain;
case NFT_CONTINUE:
rulenum++;
/* fall through */
case NFT_RETURN: case NFT_RETURN:
nft_trace_packet(pkt, chain, rulenum, NFT_TRACE_RETURN); nft_trace_packet(pkt, chain, rulenum, NFT_TRACE_RETURN);
break; break;
case NFT_CONTINUE:
nft_trace_packet(pkt, chain, ++rulenum, NFT_TRACE_RETURN);
break;
default: default:
WARN_ON(1); WARN_ON(1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment