diff mbox

[nftables,v3] payload: Update the context only in equality relations

Message ID 1401720251-9041-1-git-send-email-alvaroneay@gmail.com
State Accepted
Headers show

Commit Message

Alvaro Neira June 2, 2014, 2:44 p.m. UTC
If we add this rule:

sudo nft add rule ip test input ip protocol != icmp

and we try to list the rules in the table test, nftables
show this error:

nft: src/payload.c:76: payload_expr_pctx_update: Assertion `expr->op
== OP_EQ' failed.

This patch change the function payload_match_postprocess for updating
only the context in equality relations case.

Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
---
[changes in v3]
*Changed the patch for updating the context only in case of equality relations
case and keep the assert without changes in the function
payload_expr_pctx_update.

 src/netlink_delinearize.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Pablo Neira Ayuso June 5, 2014, 2:57 p.m. UTC | #1
On Mon, Jun 02, 2014 at 04:44:11PM +0200, Alvaro Neira Ayuso wrote:
> If we add this rule:
> 
> sudo nft add rule ip test input ip protocol != icmp
> 
> and we try to list the rules in the table test, nftables
> show this error:
> 
> nft: src/payload.c:76: payload_expr_pctx_update: Assertion `expr->op
> == OP_EQ' failed.
> 
> This patch change the function payload_match_postprocess for updating
> only the context in equality relations case.

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index 479c643..ea33308 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -644,7 +644,8 @@  static void payload_match_postprocess(struct rule_pp_ctx *ctx,
 
 			nexpr = relational_expr_alloc(&expr->location, expr->op,
 						      left, tmp);
-			left->ops->pctx_update(&ctx->pctx, nexpr);
+			if (expr->op == OP_EQ)
+				left->ops->pctx_update(&ctx->pctx, nexpr);
 
 			nstmt = expr_stmt_alloc(&stmt->location, nexpr);
 			list_add_tail(&nstmt->list, &stmt->list);