This patch adds support for the new 'netdev' table. So far, this table allows
you to create filter chains from ingress.
The following example shows a very simple base configuration with one table that
is bound to device 'eth0' with a single ingress chain:
# nft list table netdev eth0
table netdev eth0 {
device eth0;
chain ingress {
type filter hook ingress priority 0; policy accept;
}
}
The selected table name is 'eth0' but you could have selected any name.
You can test that this works by adding a simple rule with counters:
# nft add rule netdev eth0 ingress counter
or a bit more elaborated test like:
http://people.netfilter.org/pablo/nft-ingress.ruleset
More information will be available at the nftables documentation site [1].
[1] http://wiki.nftables.org/
Signed-off-by: Pablo Neira Ayuso pa...@netfilter.org
---
doc/nft.xml | 41 +
include/linux/netfilter.h |8
include/rule.h|2 ++
src/evaluate.c|4
src/netlink.c | 11 +--
src/parser_bison.y|7 +++
src/payload.c |1 +
src/proto.c |1 +
src/rule.c| 23 +++
src/scanner.l |2 ++
10 files changed, 98 insertions(+), 2 deletions(-)
diff --git a/doc/nft.xml b/doc/nft.xml
index 8d79016..1172c43 100644
--- a/doc/nft.xml
+++ b/doc/nft.xml
@@ -267,6 +267,14 @@ filter input iif $int_ifs accept
/para
/listitem
/varlistentry
+ varlistentry
+ termoptionnetdev/option/term
+ listitem
+ para
+ Netdev address family,
handling packets from ingress.
+ /para
+ /listitem
+ /varlistentry
/variablelist
/para
para
@@ -373,6 +381,38 @@ filter input iif $int_ifs accept
The bridge address family handles ethernet
packets traversing bridge devices.
/para
/refsect2
+ refsect2
+ titleNetdev address family/title
+ para
+ The Netdev address family handles packets from
ingress.
+ /para
+ para
+ table frame=all
+ titleNetdev address family
hooks/title
+ tgroup cols='2' align='left'
colsep='1' rowsep='1' pgwide=1
+ colspec colname='c1'
colwidth=1*/
+ colspec colname='c2'
colwidth=5*/
+ thead
+ row
+
entryHook/entry
+
entryDescription/entry
+ /row
+ /thead
+ tbody
+ row
+
entryingress/entry
+ entry
+ All
packets entering the system are processed by this hook. It is invoked
+ before
layer 3 protocol handlers and it can be used for early filtering and
+
policing.
+ /entry
+ /row
+ /tbody
+ /tgroup
+ /table
+ /para
+ /refsect2
+
/refsect1
refsect1
@@ -401,6 +441,7 @@ filter input iif $int_ifs accept
memberliteralinet/literal/member
memberliteralarp/literal/member
memberliteralbridge/literal/member
+ memberliteralnetdev/literal/member
/simplelist.
The literalinet/literal address family is a dummy
family which is used to