diff options
| author | Pablo Neira Ayuso <pablo@netfilter.org> | 2025-08-21 11:12:57 +0200 |
|---|---|---|
| committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2025-08-27 23:50:58 +0200 |
| commit | ffc40b38d58d3f754d20c0e586981b2f442a247e (patch) | |
| tree | 9935ca117fa1c3253c4d4e6384191be4a54a45eb /src/parser_bison.y | |
| parent | 35d9c77c5745219ad6bf1c5fc7512c1c92c70457 (diff) | |
tunnel: add erspan support
This patch extends the tunnel metadata object to define erspan tunnel
specific configurations:
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
}
}
}
Joint work with Fernando.
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/parser_bison.y')
| -rw-r--r-- | src/parser_bison.y | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index 367c6b3b..557977e2 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -607,6 +607,9 @@ int nft_lex(void *, void *, void *); %token NEVER "never" %token TUNNEL "tunnel" +%token ERSPAN "erspan" +%token EGRESS "egress" +%token INGRESS "ingress" %token COUNTERS "counters" %token QUOTAS "quotas" @@ -765,7 +768,7 @@ int nft_lex(void *, void *, void *); %type <flowtable> flowtable_block_alloc flowtable_block %destructor { flowtable_free($$); } flowtable_block_alloc -%type <obj> obj_block_alloc counter_block quota_block ct_helper_block ct_timeout_block ct_expect_block limit_block secmark_block synproxy_block tunnel_block +%type <obj> obj_block_alloc counter_block quota_block ct_helper_block ct_timeout_block ct_expect_block limit_block secmark_block synproxy_block tunnel_block erspan_block erspan_block_alloc %destructor { obj_free($$); } obj_block_alloc %type <list> stmt_list stateful_stmt_list set_elem_stmt_list @@ -4958,6 +4961,43 @@ limit_obj : /* empty */ } ; +erspan_block : /* empty */ { $$ = $<obj>-1; } + | erspan_block common_block + | erspan_block stmt_separator + | erspan_block erspan_config stmt_separator + { + $$ = $1; + } + ; + +erspan_block_alloc : /* empty */ + { + $$ = $<obj>-1; + } + ; + +erspan_config : HDRVERSION NUM + { + $<obj>0->tunnel.erspan.version = $2; + } + | INDEX NUM + { + $<obj>0->tunnel.erspan.v1.index = $2; + } + | DIRECTION INGRESS + { + $<obj>0->tunnel.erspan.v2.direction = 0; + } + | DIRECTION EGRESS + { + $<obj>0->tunnel.erspan.v2.direction = 1; + } + | ID NUM + { + $<obj>0->tunnel.erspan.v2.hwid = $2; + } + ; + tunnel_config : ID NUM { $<obj>0->tunnel.id = $2; @@ -4998,6 +5038,10 @@ tunnel_config : ID NUM { $<obj>0->tunnel.tos = $2; } + | ERSPAN erspan_block_alloc '{' erspan_block '}' + { + $<obj>0->tunnel.type = TUNNEL_ERSPAN; + } ; tunnel_block : /* empty */ { $$ = $<obj>-1; } |
