path: root/src/netlink_linearize.c
diff options
authorÁlvaro Neira Ayuso <>2014-06-11 18:51:03 +0200
committerPablo Neira Ayuso <>2014-06-16 11:53:19 +0200
commit34040b1e345c8fa31b1c468713ff7c3815e4a8a1 (patch)
treeba8d928aa811b5de919c94592f3f8f966503662d /src/netlink_linearize.c
parent11b2bb2fc0652dce73c78e7b0cee5c32c5af80e8 (diff)
reject: add ICMP code parameter for indicating the type of error
This patch allows to indicate the ICMP code field in case that we use to reject. Before, we have always sent network unreachable error as ICMP code, now we can explicitly indicate the ICMP code that we want to use. Examples: nft add rule filter input tcp dport 22 reject with host-unreach nft add rule filter input udp dport 22 reject with host-unreach In this case, it will use the host unreachable code to reject traffic. The default code field still is network unreachable and we can also use the rules without the with like that: nft add rule filter input udp dport 22 reject Signed-off-by: Alvaro Neira Ayuso <> Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'src/netlink_linearize.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index 8db333cc..b0ca2419 100644
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
@@ -609,7 +609,7 @@ static void netlink_gen_reject_stmt(struct netlink_linearize_ctx *ctx,
nle = alloc_nft_expr("reject");
nft_rule_expr_set_u32(nle, NFT_EXPR_REJECT_TYPE, stmt->reject.type);
- nft_rule_expr_set_u8(nle, NFT_EXPR_REJECT_CODE, 0);
+ nft_rule_expr_set_u8(nle, NFT_EXPR_REJECT_CODE, stmt->reject.icmp_code);
nft_rule_add_expr(ctx->nlr, nle);