netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alvaro Neira Ayuso <alvaroneay@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: kaber@trash.net
Subject: [nftables PATCH v3] payload: Update the context only in equality relations
Date: Mon,  2 Jun 2014 16:44:11 +0200	[thread overview]
Message-ID: <1401720251-9041-1-git-send-email-alvaroneay@gmail.com> (raw)
In-Reply-To: <1401270454-11669-1-git-send-email-alvaroneay@gmail.com>

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

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);
-- 
1.7.10.4


  parent reply	other threads:[~2014-06-02 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27 15:04 [nftables PATCH] payload: moderate the expr operation checking Alvaro Neira Ayuso
2014-05-28  9:47 ` [nftables PATCH v2] payload: Relax assert in function payload_expr_pctx_update Alvaro Neira Ayuso
2014-06-01 20:12   ` Patrick McHardy
2014-06-02 14:44   ` Alvaro Neira Ayuso [this message]
2014-06-05 14:57     ` [nftables PATCH v3] payload: Update the context only in equality relations Pablo Neira Ayuso

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=1401720251-9041-1-git-send-email-alvaroneay@gmail.com \
    --to=alvaroneay@gmail.com \
    --cc=kaber@trash.net \
    --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).