Apart from header fields, this isolates TCP option types and fields, too. Signed-off-by: Phil Sutter <phil@xxxxxx> --- src/parser_bison.y | 2 +- src/scanner.l | 60 +++++++++++++++++++++++++++------------------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/src/parser_bison.y b/src/parser_bison.y index 6340bda6cc585..55f3b2bc35bec 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -942,13 +942,13 @@ close_scope_list : { scanner_pop_start_cond(nft->scanner, PARSER_SC_CMD_LIST); } close_scope_limit : { scanner_pop_start_cond(nft->scanner, PARSER_SC_LIMIT); }; close_scope_numgen : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_NUMGEN); }; close_scope_quota : { scanner_pop_start_cond(nft->scanner, PARSER_SC_QUOTA); }; -close_scope_tcp : { scanner_pop_start_cond(nft->scanner, PARSER_SC_TCP); } close_scope_queue : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_QUEUE); }; close_scope_rt : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_RT); }; close_scope_sctp : { scanner_pop_start_cond(nft->scanner, PARSER_SC_SCTP); }; close_scope_sctp_chunk : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_SCTP_CHUNK); }; close_scope_secmark : { scanner_pop_start_cond(nft->scanner, PARSER_SC_SECMARK); }; close_scope_socket : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_SOCKET); } +close_scope_tcp : { scanner_pop_start_cond(nft->scanner, PARSER_SC_TCP); }; close_scope_log : { scanner_pop_start_cond(nft->scanner, PARSER_SC_STMT_LOG); } diff --git a/src/scanner.l b/src/scanner.l index a584b5fba39b4..95dcd0330bd3e 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -468,30 +468,46 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "ptr" { return PTR; } "value" { return VALUE; } + + "option" { return OPTION; } + "options" { return OPTIONS; } } <SCANSTATE_TCP>{ -"echo" { return ECHO; } -"eol" { return EOL; } -"fastopen" { return FASTOPEN; } -"mptcp" { return MPTCP; } -"md5sig" { return MD5SIG; } -"subtype" { return SUBTYPE; } -"nop" { return NOP; } -"noop" { return NOP; } -"sack" { return SACK; } -"sack0" { return SACK0; } -"sack1" { return SACK1; } -"sack2" { return SACK2; } -"sack3" { return SACK3; } -"time" { return TIME; } + /* tcp header fields */ + "ackseq" { return ACKSEQ; } + "doff" { return DOFF; } + "window" { return WINDOW; } + "urgptr" { return URGPTR; } + + /* tcp option types */ + "echo" { return ECHO; } + "eol" { return EOL; } + "maxseg" { return MSS; } + "mss" { return MSS; } + "nop" { return NOP; } + "noop" { return NOP; } + "sack" { return SACK; } + "sack0" { return SACK0; } + "sack1" { return SACK1; } + "sack2" { return SACK2; } + "sack3" { return SACK3; } + "fastopen" { return FASTOPEN; } + "mptcp" { return MPTCP; } + "md5sig" { return MD5SIG; } + + /* tcp option fields */ + "left" { return LEFT; } + "right" { return RIGHT; } + "count" { return COUNT; } + "tsval" { return TSVAL; } + "tsecr" { return TSECR; } + "subtype" { return SUBTYPE; } -"count" { return COUNT; } -"left" { return LEFT; } -"right" { return RIGHT; } -"tsval" { return TSVAL; } -"tsecr" { return TSECR; } + "options" { return OPTIONS; } + "option" { return OPTION; } } +"time" { return TIME; } "maxseg" { return MSS; } "mss" { return MSS; } "sack-permitted" { return SACK_PERM; } @@ -540,11 +556,6 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "port" { return PORT; } "tcp" { scanner_push_start_cond(yyscanner, SCANSTATE_TCP); return TCP; } -"ackseq" { return ACKSEQ; } -"doff" { return DOFF; } -"window" { return WINDOW; } -"urgptr" { return URGPTR; } -"option" { return OPTION; } "dccp" { return DCCP; } @@ -688,7 +699,6 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "notrack" { return NOTRACK; } -"options" { return OPTIONS; } "all" { return ALL; } "xml" { return XML; } -- 2.34.1