From: Alvaro Neira Ayuso <alvaroneay@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: kaber@trash.net
Subject: [nft PATCH 3/4 v2] delinearize: list the icmpx reason with the string associated
Date: Fri, 17 Oct 2014 14:24:36 +0200 [thread overview]
Message-ID: <1413548677-10287-3-git-send-email-alvaroneay@gmail.com> (raw)
In-Reply-To: <1413548677-10287-1-git-send-email-alvaroneay@gmail.com>
If you add the rule:
nft add rule inet filter input reject with icmpx type host-unreachable
nft list table inet filter
shows:
table inet filter {
chain input {
reject with icmpx type 2
}
}
We have to attach the icmpx datatype when we list the rules that use it. With
this patch if we list the ruleset, the output is:
table inet filter {
chain input {
reject with icmpx type host-unreachable
}
}
Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
---
[no changes in v2]
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 4bb4697..3e7aed4 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -928,8 +928,10 @@ static void stmt_reject_postprocess(struct rule_pp_ctx rctx, struct stmt *stmt)
stmt->reject.expr->dtype = &icmpv6_code_type;
break;
case NFPROTO_INET:
- if (stmt->reject.type == NFT_REJECT_ICMPX_UNREACH)
+ if (stmt->reject.type == NFT_REJECT_ICMPX_UNREACH) {
+ stmt->reject.expr->dtype = &icmpx_code_type;
break;
+ }
base = rctx.pctx.protocol[PROTO_BASE_LL_HDR].desc;
desc = rctx.pctx.protocol[PROTO_BASE_NETWORK_HDR].desc;
protocol = proto_find_num(base, desc);
@@ -944,8 +946,10 @@ static void stmt_reject_postprocess(struct rule_pp_ctx rctx, struct stmt *stmt)
stmt->reject.family = protocol;
break;
case NFPROTO_BRIDGE:
- if (stmt->reject.type == NFT_REJECT_ICMPX_UNREACH)
+ if (stmt->reject.type == NFT_REJECT_ICMPX_UNREACH) {
+ stmt->reject.expr->dtype = &icmpx_code_type;
break;
+ }
base = rctx.pctx.protocol[PROTO_BASE_LL_HDR].desc;
desc = rctx.pctx.protocol[PROTO_BASE_NETWORK_HDR].desc;
protocol = proto_find_num(base, desc);
--
1.7.10.4
next prev parent reply other threads:[~2014-10-17 12:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-17 12:24 [nft PATCH 1/4 v2] evaluate: fix a crash if we specify ether type or meta nfproto in reject Alvaro Neira Ayuso
2014-10-17 12:24 ` [nft PATCH 2/4 v2] evaluate: fix a crash if we check the transport protocol Alvaro Neira Ayuso
2014-10-20 8:59 ` Pablo Neira Ayuso
2014-10-20 9:40 ` Álvaro Neira Ayuso
2014-10-20 9:46 ` Pablo Neira Ayuso
2014-10-20 9:50 ` Álvaro Neira Ayuso
2014-10-17 12:24 ` Alvaro Neira Ayuso [this message]
2014-10-17 12:58 ` [nft PATCH 3/4 v2] delinearize: list the icmpx reason with the string associated Pablo Neira Ayuso
2014-10-17 12:24 ` [nft PATCH 4/4 v2] test: update and add the reject tests for ip, ip6, bridge and inet Alvaro Neira Ayuso
2014-10-17 12:55 ` [nft PATCH 1/4 v2] evaluate: fix a crash if we specify ether type or meta nfproto in reject Pablo Neira Ayuso
2014-10-17 13:02 ` Álvaro Neira Ayuso
2014-10-17 13:38 ` Pablo Neira Ayuso
2014-10-17 13:44 ` Álvaro 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=1413548677-10287-3-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).