]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: add tunnel statement and expression support
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 21 Aug 2025 09:12:58 +0000 (11:12 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 27 Aug 2025 21:51:03 +0000 (23:51 +0200)
commita937a5dc02db3c919431718c0030c54c2eaafd73
tree595b58bec9707f5c7c59258fbbc16a40f7bbc04d
parentffc40b38d58d3f754d20c0e586981b2f442a247e
src: add tunnel statement and expression support

This patch allows you to attach tunnel metadata through the tunnel
statement.

The following example shows how to redirect traffic to the erspan0
tunnel device which will take the tunnel configuration that is
specified by the ruleset.

     table netdev x {
            tunnel y {
                    id 10
                    ip saddr 192.168.2.10
                    ip daddr 192.168.2.11
                    sport 10
                    dport 20
                    ttl 10
                    erspan {
                            version 1
                            index 2
                    }
            }

    chain x {
    type filter hook ingress device veth0 priority 0;

    ip daddr 10.141.10.123 tunnel name y fwd to erspan0
    }
     }

This patch also allows to match on tunnel metadata via tunnel expression.

Joint work with Fernando.

Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Makefile.am
include/expression.h
include/tunnel.h [new file with mode: 0644]
src/evaluate.c
src/expression.c
src/netlink_delinearize.c
src/netlink_linearize.c
src/parser_bison.y
src/scanner.l
src/statement.c
src/tunnel.c [new file with mode: 0644]