From 03eafe098d5eead786cbbe6f79348f05819cd99e Mon Sep 17 00:00:00 2001 From: Fernando Fernandez Mancera Date: Tue, 23 Oct 2018 17:06:22 +0200 Subject: osf: add ttl option support Add support for ttl option in "osf" expression. Example: table ip foo { chain bar { type filter hook input priority filter; policy accept; osf ttl skip name "Linux" } } Signed-off-by: Fernando Fernandez Mancera Signed-off-by: Pablo Neira Ayuso --- src/parser_bison.y | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src/parser_bison.y') diff --git a/src/parser_bison.y b/src/parser_bison.y index 36a98719..dfe30683 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -15,12 +15,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -740,6 +742,7 @@ int nft_lex(void *, void *, void *); %type fib_tuple fib_result fib_flag %type osf_expr +%type osf_ttl %destructor { expr_free($$); } osf_expr %type markup_format @@ -3173,9 +3176,27 @@ fib_tuple : fib_flag DOT fib_tuple | fib_flag ; -osf_expr : OSF NAME +osf_expr : OSF osf_ttl NAME { - $$ = osf_expr_alloc(&@$); + $$ = osf_expr_alloc(&@$, $2); + } + ; + +osf_ttl : /* empty */ + { + $$ = NF_OSF_TTL_TRUE; + } + | TTL STRING + { + if (!strcmp($2, "loose")) + $$ = NF_OSF_TTL_LESS; + else if (!strcmp($2, "skip")) + $$ = NF_OSF_TTL_NOCHECK; + else { + erec_queue(error(&@2, "invalid ttl option"), + state->msgs); + YYERROR; + } } ; -- cgit v1.2.3