netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] netlink_linearize: fix range cmp instruction generation
@ 2015-06-02 10:57 Patrick McHardy
  2015-06-02 10:57 ` [PATCH 2/3] ct: add maximum helper length value Patrick McHardy
  2015-06-02 10:57 ` [PATCH 3/3] netlink_delinearize: remove obsolete fixme Patrick McHardy
  0 siblings, 2 replies; 3+ messages in thread
From: Patrick McHardy @ 2015-06-02 10:57 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

The LHS expression is generated twice and the register not properly released.
Fix by calling netlink_gen_range() before generating the LHS.

Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 src/netlink_linearize.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index 9bef67b..0a0b686 100644
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
@@ -203,6 +203,9 @@ static void netlink_gen_cmp(struct netlink_linearize_ctx *ctx,
 
 	assert(dreg == NFT_REG_VERDICT);
 
+	if (expr->right->ops->type == EXPR_RANGE)
+		return netlink_gen_range(ctx, expr, dreg);
+
 	sreg = get_register(ctx);
 	netlink_gen_expr(ctx, expr->left, sreg);
 
@@ -229,8 +232,6 @@ static void netlink_gen_cmp(struct netlink_linearize_ctx *ctx,
 		right = expr->right->prefix;
 		break;
 		}
-	case EXPR_RANGE:
-		return netlink_gen_range(ctx, expr, dreg);
 	default:
 		right = expr->right;
 	}
-- 
2.1.0


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

end of thread, other threads:[~2015-06-02 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 10:57 [PATCH 1/3] netlink_linearize: fix range cmp instruction generation Patrick McHardy
2015-06-02 10:57 ` [PATCH 2/3] ct: add maximum helper length value Patrick McHardy
2015-06-02 10:57 ` [PATCH 3/3] netlink_delinearize: remove obsolete fixme Patrick McHardy

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