summaryrefslogtreecommitdiffstats
path: root/src/json.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2019-06-18 20:43:58 +0200
committerFlorian Westphal <fw@strlen.de>2019-06-19 22:52:21 +0200
commitb65ea148d8f8edc4ef5774154b1aca25d884d500 (patch)
tree35c10223e681ef2d77b43554dd07b965cb14a222 /src/json.c
parentea046380431f5cc623daf8c9d7b2c5438a90a84f (diff)
src: statement: disable reject statement type omission for bridge
add rule bridge test-bridge input reject with icmp type port-unreachable ... will be printed as 'reject', which is fine on ip family, but not on bridge -- 'with icmp type' adds an ipv4 dependency, but simple reject does not (it will use icmpx to also reject ipv6 packets with an icmpv6 error). Add a toggle to supress short-hand versions in this case. Signed-off-by: Florian Westphal <fw@strlen.de> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/json.c b/src/json.c
index a503a975..e0127c57 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1311,13 +1311,15 @@ json_t *reject_stmt_json(const struct stmt *stmt, struct output_ctx *octx)
case NFT_REJECT_ICMP_UNREACH:
switch (stmt->reject.family) {
case NFPROTO_IPV4:
- if (stmt->reject.icmp_code == ICMP_PORT_UNREACH)
+ if (!stmt->reject.verbose_print &&
+ stmt->reject.icmp_code == ICMP_PORT_UNREACH)
break;
type = "icmp";
jexpr = expr_print_json(stmt->reject.expr, octx);
break;
case NFPROTO_IPV6:
- if (stmt->reject.icmp_code == ICMP6_DST_UNREACH_NOPORT)
+ if (!stmt->reject.verbose_print &&
+ stmt->reject.icmp_code == ICMP6_DST_UNREACH_NOPORT)
break;
type = "icmpv6";
jexpr = expr_print_json(stmt->reject.expr, octx);