]> git.ipfire.org Git - thirdparty/nftables.git/commit
nft: complete reject support
authorAlvaro Neira <alvaroneay@gmail.com>
Tue, 30 Sep 2014 15:21:40 +0000 (17:21 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 9 Oct 2014 11:53:11 +0000 (13:53 +0200)
commit5fdd0b6a0600e66f9ff6d9a1d6b749aa68a3ba99
tree282a5201207e607a0ccc94c17cab9bebb12da723
parent67094206871b3dbaabd48894bc171e67010762c4
nft: complete reject support

This patch allows to use the reject action in rules. For example:

  nft add rule filter input udp dport 22 reject

In this rule, we assume that the reason is network unreachable. Also
we can specify the reason with the option "with" and the reason. For example:

  nft add rule filter input tcp dport 22 reject with icmp type host-unreachable

In the bridge tables and inet tables, we can use this action too. For example:

  nft add rule inet filter input reject with icmp type host-unreachable

In this rule above, this generates a meta nfproto dependency to match
ipv4 traffic because we use a icmpv4 reason to reject.

If the reason is not specified, we infer it from the context.

Moreover, we have the new icmpx datatype. You can use this datatype for
the bridge and the inet tables to simplify your ruleset. For example:

  nft add rule inet filter input reject with icmpx type host-unreachable

We have four icmpx reason and the mapping is:

ICMPX reason            |       ICMPv6          |      ICMPv4
                        |                       |
admin-prohibited        | admin-prohibited      | admin-prohibited
port-unreachable        | port-unreachable      | port-unreachable
no-route                | no-route              | net-unreachable
host-unreachable        | addr-unreachable      | host-unreachable

Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 files changed:
include/datatype.h
include/linux/netfilter/nf_tables.h
include/proto.h
include/statement.h
src/datatype.c
src/evaluate.c
src/netlink_delinearize.c
src/netlink_linearize.c
src/parser.y
src/payload.c
src/scanner.l
src/statement.c