netfilter: nft_reject_inet: allow to use reject from inet ingress
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH 1/1 netfilter: nft_reject_inet: allow to use reject from inet ingress
Enhance validation to support for reject from inet ingress chains.
Note that, reject from inet ingress and netdev ingress differ.
Reject packets from inet ingress are sent through ip_local_out() since inet reject emulates the IP layer receive path. So the reject packet follows to classic IP output and postrouting paths.
The reject action from netdev ingress assumes the packet not yet entered the IP layer, so the reject packet is sent through dev_queue_xmit(). Therefore, reject packets from netdev ingress do not follow the classic IP output and postrouting paths.
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- net/netfilter/nft_reject_inet.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
net/netfilter/nft_reject_inet.c +13 -1
@@ -58,6 +58,18 @@ static void nft_reject_inet_eval(const struct nft_expr *expr, regs->verdict.code =NF_DROP ; } +static int nft_reject_inet_validate (const struct nft_ctx *ctx, +const struct nft_expr *expr, +const struct nft_data **data) +{ +return nft_chain_validate_hooks (ctx->chain, + (1 <<NF_INET_LOCAL_IN ) | + (1 <<NF_INET_FORWARD ) | + (1 <<NF_INET_LOCAL_OUT ) | + (1 <<NF_INET_PRE_ROUTING ) | + (1 <<NF_INET_INGRESS )); +} +static struct nft_expr_type nft_reject_inet_type;static const struct nft_expr_ops nft_reject_inet_ops = { .type = &nft_reject_inet_type,
@@ -65,7 +77,7 @@ static const struct nft_expr_ops nft_reject_inet_ops = { .eval = nft_reject_inet_eval, .init = nft_reject_init, .dump = nft_reject_dump, - .validate = nft_reject_validate, + .validate = nft_reject_inet_validate, };static struct nft_expr_type nft_reject_inet_type__read_mostly = {
Signature · 1 line
2.20.1