diff options
| author | Florian Westphal <fw@strlen.de> | 2025-10-16 16:59:35 +0200 |
|---|---|---|
| committer | Florian Westphal <fw@strlen.de> | 2025-10-17 09:41:51 +0200 |
| commit | fb3e048171fe09c347c43398a779180717818466 (patch) | |
| tree | 7ee85645298890a20c283aa9e5dc07b49526a493 /src | |
| parent | 667a618083f755eb12b73a69e32fe94e128ec8b3 (diff) | |
src: parser_bison: prevent multiple ip daddr/saddr definitions
minor change to the bogon makes it assert because symbolic expression
will have wrong refcount (2) at scope teardown.
Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
Diffstat (limited to 'src')
| -rw-r--r-- | src/parser_bison.y | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index b63c7df1..4e028d31 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -5070,21 +5070,38 @@ tunnel_config : ID NUM } | IP SADDR symbol_expr close_scope_ip { + if (already_set($<obj>0->tunnel.src, &@3, state)) { + expr_free($3); + YYERROR; + } + $<obj>0->tunnel.src = $3; datatype_set($3, &ipaddr_type); } | IP DADDR symbol_expr close_scope_ip { + if (already_set($<obj>0->tunnel.dst, &@3, state)) { + expr_free($3); + YYERROR; + } $<obj>0->tunnel.dst = $3; datatype_set($3, &ipaddr_type); } | IP6 SADDR symbol_expr close_scope_ip6 { + if (already_set($<obj>0->tunnel.src, &@3, state)) { + expr_free($3); + YYERROR; + } $<obj>0->tunnel.src = $3; datatype_set($3, &ip6addr_type); } | IP6 DADDR symbol_expr close_scope_ip6 { + if (already_set($<obj>0->tunnel.dst, &@3, state)) { + expr_free($3); + YYERROR; + } $<obj>0->tunnel.dst = $3; datatype_set($3, &ip6addr_type); } |
