netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 05/12] netfilter: nf_tables: consolidate tracing invocations
Date: Mon,  9 Mar 2015 18:14:28 +0100	[thread overview]
Message-ID: <1425921275-9171-6-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1425921275-9171-1-git-send-email-pablo@netfilter.org>

From: Patrick McHardy <kaber@trash.net>

* 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: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_core.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/net/netfilter/nf_tables_core.c b/net/netfilter/nf_tables_core.c
index 074067d..77165bf 100644
--- a/net/netfilter/nf_tables_core.c
+++ b/net/netfilter/nf_tables_core.c
@@ -170,26 +170,23 @@ next_rule:
 
 	switch (data[NFT_REG_VERDICT].verdict) {
 	case NFT_JUMP:
-		nft_trace_packet(pkt, chain, rulenum, NFT_TRACE_RULE);
-
 		BUG_ON(stackptr >= NFT_JUMP_STACK_SIZE);
 		jumpstack[stackptr].chain = chain;
 		jumpstack[stackptr].rule  = rule;
 		jumpstack[stackptr].rulenum = rulenum;
 		stackptr++;
-		chain = data[NFT_REG_VERDICT].chain;
-		goto do_chain;
+		/* fall through */
 	case NFT_GOTO:
 		nft_trace_packet(pkt, chain, rulenum, NFT_TRACE_RULE);
 
 		chain = data[NFT_REG_VERDICT].chain;
 		goto do_chain;
+	case NFT_CONTINUE:
+		rulenum++;
+		/* fall through */
 	case NFT_RETURN:
 		nft_trace_packet(pkt, chain, rulenum, NFT_TRACE_RETURN);
 		break;
-	case NFT_CONTINUE:
-		nft_trace_packet(pkt, chain, ++rulenum, NFT_TRACE_RETURN);
-		break;
 	default:
 		WARN_ON(1);
 	}
-- 
1.7.10.4


  parent reply	other threads:[~2015-03-09 17:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-09 17:14 [PATCH 00/12] Netfilter updates for net-next Pablo Neira Ayuso
2015-03-09 17:14 ` [PATCH 01/12] netfilter: reject: don't send icmp error if csum is invalid Pablo Neira Ayuso
2015-03-09 17:14 ` [PATCH 02/12] netfilter: bridge: rework reject handling Pablo Neira Ayuso
2015-03-09 17:14 ` [PATCH 03/12] netfilter: ipt_CLUSTERIP: deprecate it in favour of xt_cluster Pablo Neira Ayuso
2015-03-09 17:14 ` [PATCH 04/12] netfilter: nf_tables: minor tracing cleanups Pablo Neira Ayuso
2015-03-09 17:14 ` Pablo Neira Ayuso [this message]
2015-03-09 17:14 ` [PATCH 06/12] netfilter: nf_tables: cleanup nf_tables.h Pablo Neira Ayuso
2015-03-09 17:14 ` [PATCH 07/12] netfilter: nf_tables: consolidate Kconfig options Pablo Neira Ayuso
2015-03-09 17:14 ` [PATCH 08/12] netfilter: nf_tables: limit maximum table name length to 32 bytes Pablo Neira Ayuso
2015-03-09 17:14 ` [PATCH 09/12] bridge: move mac header copying into br_netfilter Pablo Neira Ayuso
2015-03-09 17:14 ` [PATCH 10/12] netfilter: bridge: move nf_bridge_update_protocol to where its used Pablo Neira Ayuso
2015-03-09 17:14 ` [PATCH 11/12] netfilter: bridge: refactor conditional in br_nf_dev_queue_xmit Pablo Neira Ayuso
2015-03-09 17:14 ` [PATCH 12/12] netfilter: bridge: move DNAT helper to br_netfilter Pablo Neira Ayuso
2015-03-10  5:28   ` Simon Horman
2015-03-10  9:41     ` Pablo Neira Ayuso
2015-03-09 19:59 ` [PATCH 00/12] Netfilter updates for net-next David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425921275-9171-6-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).