netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: mirq-boogs@rere.qmqm.pl, ffmancera@riseup.net, arturo@debian.org
Subject: [PATCH nft 2/2] evaluate: improve error reporting in tproxy with inet family
Date: Thu,  4 Apr 2019 13:39:42 +0200	[thread overview]
Message-ID: <20190404113942.26263-2-pablo@netfilter.org> (raw)
In-Reply-To: <20190404113942.26263-1-pablo@netfilter.org>

 # nft add rule inet filter divert ip daddr 0.0.0.0/0 meta l4proto tcp tproxy to :2000
 Error: conflicting protocols specified: ip vs. unknown. You must specify ip or ip6 family in tproxy statement
 add rule inet filter divert ip daddr 0.0.0.0/0 meta l4proto tcp tproxy to :2000
                             ~~~~~~~~                            ^^^^^^^^^^^^^^^

instead of:

 # nft add rule inet filter divert ip daddr 0.0.0.0/0 meta l4proto tcp tproxy to :2000
 Error: Conflicting network layer protocols.
 add rule inet filter divert ip daddr 0.0.0.0/0 meta l4proto tcp tproxy to :2000
                                                                 ^^^^^^^^^^^^^^^

Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1310
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/evaluate.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index 94377da99335..3a3f2468c826 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -2606,8 +2606,11 @@ static int stmt_evaluate_tproxy(struct eval_ctx *ctx, struct stmt *stmt)
 		/* this prevents us from rules like
 		 * ip protocol tcp tproxy ip6 to [dead::beef]
 		 */
-		return stmt_error(ctx, stmt,
-				  "Conflicting network layer protocols.");
+		return stmt_binary_error(ctx, stmt,
+					 &ctx->pctx.protocol[PROTO_BASE_NETWORK_HDR],
+					 "conflicting protocols specified: %s vs. %s. You must specify ip or ip6 family in tproxy statement",
+					 ctx->pctx.protocol[PROTO_BASE_NETWORK_HDR].desc->name,
+					 family2str(stmt->tproxy.family));
 
 	if (stmt->tproxy.addr != NULL) {
 		if (stmt->tproxy.addr->etype == EXPR_RANGE)
-- 
2.11.0


      reply	other threads:[~2019-04-04 11:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04 11:39 [PATCH nft 1/2,v2] parser_bison: missing tproxy syntax with port only for inet family Pablo Neira Ayuso
2019-04-04 11:39 ` Pablo Neira Ayuso [this message]

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=20190404113942.26263-2-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=arturo@debian.org \
    --cc=ffmancera@riseup.net \
    --cc=mirq-boogs@rere.qmqm.pl \
    --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).