netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nftables PATCh 0/3] Fix jump operation
       [not found] <DUB109-W87FE1E5161E5C42ED6593AE1F80@phx.gbl>
@ 2013-11-17 23:54 ` Eric Leblond
  2013-11-17 23:54   ` [nftables PATCH 1/3] expression: fix indent Eric Leblond
                     ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eric Leblond @ 2013-11-17 23:54 UTC (permalink / raw)
  To: netfilter-devel, pablo, Alex Chapman; +Cc: eric


Hello,

The jump operation was not correctly working in nftables. This
small patchset fixes the issue.

BR,
--
Eric

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [nftables PATCH 1/3] expression: fix indent
  2013-11-17 23:54 ` [nftables PATCh 0/3] Fix jump operation Eric Leblond
@ 2013-11-17 23:54   ` Eric Leblond
  2013-11-17 23:54   ` [nftables PATCH 2/3] jump: fix logic in netlink linearize Eric Leblond
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Leblond @ 2013-11-17 23:54 UTC (permalink / raw)
  To: netfilter-devel, pablo, Alex Chapman; +Cc: eric

Signed-off-by: Eric Leblond <eric@regit.org>
---
 src/expression.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/expression.c b/src/expression.c
index 8cf3f62..71154cc 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -156,7 +156,7 @@ static void verdict_expr_clone(struct expr *new, const struct expr *expr)
 
 static void verdict_expr_destroy(struct expr *expr)
 {
-        xfree(expr->chain);
+	xfree(expr->chain);
 }
 
 static const struct expr_ops verdict_expr_ops = {
-- 
1.8.4.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [nftables PATCH 2/3] jump: fix logic in netlink linearize.
  2013-11-17 23:54 ` [nftables PATCh 0/3] Fix jump operation Eric Leblond
  2013-11-17 23:54   ` [nftables PATCH 1/3] expression: fix indent Eric Leblond
@ 2013-11-17 23:54   ` Eric Leblond
  2013-11-17 23:54   ` [nftables PATCH 3/3] verdict: fix delinearize in case of jump Eric Leblond
  2013-11-19 20:13   ` [nftables PATCh 0/3] Fix jump operation Pablo Neira Ayuso
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Leblond @ 2013-11-17 23:54 UTC (permalink / raw)
  To: netfilter-devel, pablo, Alex Chapman; +Cc: eric

Logic in the test was inverted. The result was the jump string
not to be set.

Reported-by: Alex Chapman <ajchapman88@hotmail.co.uk>
Signed-off-by: Eric Leblond <eric@regit.org>
---
 src/netlink_linearize.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index da8be20..e64e92a 100644
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
@@ -440,7 +440,8 @@ static void netlink_gen_immediate(struct netlink_linearize_ctx *ctx,
 		nft_rule_expr_set(nle, NFT_EXPR_IMM_DATA, nld.value, nld.len);
 		break;
 	case EXPR_VERDICT:
-		if (nft_rule_expr_is_set(nle, NFT_EXPR_IMM_CHAIN)) {
+		if ((expr->chain != NULL) &&
+		    !nft_rule_expr_is_set(nle, NFT_EXPR_IMM_CHAIN)) {
 			nft_rule_expr_set_str(nle, NFT_EXPR_IMM_CHAIN,
 					      nld.chain);
 		}
-- 
1.8.4.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [nftables PATCH 3/3] verdict: fix delinearize in case of jump
  2013-11-17 23:54 ` [nftables PATCh 0/3] Fix jump operation Eric Leblond
  2013-11-17 23:54   ` [nftables PATCH 1/3] expression: fix indent Eric Leblond
  2013-11-17 23:54   ` [nftables PATCH 2/3] jump: fix logic in netlink linearize Eric Leblond
@ 2013-11-17 23:54   ` Eric Leblond
  2013-11-19 20:13   ` [nftables PATCh 0/3] Fix jump operation Pablo Neira Ayuso
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Leblond @ 2013-11-17 23:54 UTC (permalink / raw)
  To: netfilter-devel, pablo, Alex Chapman; +Cc: eric

The name of the chain was not handled in case of a jump or a goto.
This patch adds parsing of the chain.

Reported-by: Alex Chapman <ajchapman88@hotmail.co.uk>
Signed-off-by: Eric Leblond <eric@regit.org>
---
 src/netlink_delinearize.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index 3bb143b..7e4e38c 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -81,9 +81,13 @@ static void netlink_parse_immediate(struct netlink_parse_ctx *ctx,
 	struct stmt *stmt;
 	struct expr *expr;
 
-	if (nft_rule_expr_is_set(nle, NFT_EXPR_IMM_VERDICT))
+	if (nft_rule_expr_is_set(nle, NFT_EXPR_IMM_VERDICT)) {
 		nld.verdict = nft_rule_expr_get_u32(nle, NFT_EXPR_IMM_VERDICT); 
-	else if (nft_rule_expr_is_set(nle, NFT_EXPR_IMM_DATA)) {
+		if  (nft_rule_expr_is_set(nle, NFT_EXPR_IMM_CHAIN)) {
+			nld.chain = nft_rule_expr_get(nle, NFT_EXPR_IMM_CHAIN,
+						      &nld.len);
+		}
+	} else if (nft_rule_expr_is_set(nle, NFT_EXPR_IMM_DATA)) {
 		nld.value = nft_rule_expr_get(nle, NFT_EXPR_IMM_DATA, &nld.len);
 	}
 
-- 
1.8.4.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [nftables PATCh 0/3] Fix jump operation
  2013-11-17 23:54 ` [nftables PATCh 0/3] Fix jump operation Eric Leblond
                     ` (2 preceding siblings ...)
  2013-11-17 23:54   ` [nftables PATCH 3/3] verdict: fix delinearize in case of jump Eric Leblond
@ 2013-11-19 20:13   ` Pablo Neira Ayuso
  3 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2013-11-19 20:13 UTC (permalink / raw)
  To: Eric Leblond; +Cc: netfilter-devel, Alex Chapman

On Mon, Nov 18, 2013 at 12:54:42AM +0100, Eric Leblond wrote:
> 
> Hello,
> 
> The jump operation was not correctly working in nftables. This
> small patchset fixes the issue.

Seried applied, thanks a lot Eric!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-19 20:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <DUB109-W87FE1E5161E5C42ED6593AE1F80@phx.gbl>
2013-11-17 23:54 ` [nftables PATCh 0/3] Fix jump operation Eric Leblond
2013-11-17 23:54   ` [nftables PATCH 1/3] expression: fix indent Eric Leblond
2013-11-17 23:54   ` [nftables PATCH 2/3] jump: fix logic in netlink linearize Eric Leblond
2013-11-17 23:54   ` [nftables PATCH 3/3] verdict: fix delinearize in case of jump Eric Leblond
2013-11-19 20:13   ` [nftables PATCh 0/3] Fix jump operation Pablo Neira Ayuso

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).