diff options
author | Florian Westphal <fw@strlen.de> | 2020-11-02 14:53:26 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2020-11-09 12:19:24 +0100 |
commit | 41158e0388ac56380fc0ee301f0d43f95ec43fab (patch) | |
tree | aa970b7dcf43bc7c1c150cc166701944602beb95 /src/parser_bison.y | |
parent | 2a9aea6f2dfb6ee61528809af98860e06b38762b (diff) |
tcpopts: clean up parser -> tcpopt.c plumbing
tcpopt template mapping is asymmetric:
one mapping is to match dumped netlink exthdr expression to the original
tcp option template.
This struct is indexed by the raw, on-write kind/type number.
The other mapping maps parsed options to the tcp option template.
Remove the latter. The parser is changed to translate the textual
option name, e.g. "maxseg" to the on-wire number.
This avoids the second mapping, it will also allow to more easily
support raw option matching in a followup patch.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r-- | src/parser_bison.y | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index 8d6e28c9..fcbfb40d 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -399,7 +399,7 @@ int nft_lex(void *, void *, void *); %token OPTION "option" %token ECHO "echo" %token EOL "eol" -%token NOOP "noop" +%token NOP "nop" %token SACK "sack" %token SACK0 "sack0" %token SACK1 "sack1" @@ -5212,18 +5212,18 @@ tcp_hdr_field : SPORT { $$ = TCPHDR_SPORT; } | URGPTR { $$ = TCPHDR_URGPTR; } ; -tcp_hdr_option_type : EOL { $$ = TCPOPTHDR_EOL; } - | NOOP { $$ = TCPOPTHDR_NOOP; } - | MSS { $$ = TCPOPTHDR_MAXSEG; } - | WINDOW { $$ = TCPOPTHDR_WINDOW; } - | SACK_PERM { $$ = TCPOPTHDR_SACK_PERMITTED; } - | SACK { $$ = TCPOPTHDR_SACK0; } - | SACK0 { $$ = TCPOPTHDR_SACK0; } - | SACK1 { $$ = TCPOPTHDR_SACK1; } - | SACK2 { $$ = TCPOPTHDR_SACK2; } - | SACK3 { $$ = TCPOPTHDR_SACK3; } - | ECHO { $$ = TCPOPTHDR_ECHO; } - | TIMESTAMP { $$ = TCPOPTHDR_TIMESTAMP; } +tcp_hdr_option_type : EOL { $$ = TCPOPT_KIND_EOL; } + | NOP { $$ = TCPOPT_KIND_NOP; } + | MSS { $$ = TCPOPT_KIND_MAXSEG; } + | WINDOW { $$ = TCPOPT_KIND_WINDOW; } + | SACK_PERM { $$ = TCPOPT_KIND_SACK_PERMITTED; } + | SACK { $$ = TCPOPT_KIND_SACK; } + | SACK0 { $$ = TCPOPT_KIND_SACK; } + | SACK1 { $$ = TCPOPT_KIND_SACK1; } + | SACK2 { $$ = TCPOPT_KIND_SACK2; } + | SACK3 { $$ = TCPOPT_KIND_SACK3; } + | ECHO { $$ = TCPOPT_KIND_ECHO; } + | TIMESTAMP { $$ = TCPOPT_KIND_TIMESTAMP; } ; tcp_hdr_option_field : KIND { $$ = TCPOPTHDR_FIELD_KIND; } |