From 4a81a04294b3a0eaa033eb85c4660df037baee39 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Sun, 21 Nov 2021 23:33:16 +0100 Subject: mptcp: add subtype matching MPTCP multiplexes the various mptcp signalling data using the first 4 bits of the mptcp option. This allows to match on the mptcp subtype via: tcp option mptcp subtype 1 This misses delinearization support. mptcp subtype is the first tcp option field that has a length of less than one byte. Serialization processing will add a binop for this, but netlink delinearization can't remove them, yet. Also misses a new datatype/symbol table to allow to use mnemonics like 'mp_join' instead of raw numbers. For this reason, no tests are added yet. Signed-off-by: Florian Westphal --- src/parser_bison.y | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/parser_bison.y') diff --git a/src/parser_bison.y b/src/parser_bison.y index a6a591b7..355758e1 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -424,6 +424,7 @@ int nft_lex(void *, void *, void *); %token RIGHT "right" %token TSVAL "tsval" %token TSECR "tsecr" +%token SUBTYPE "subtype" %token DCCP "dccp" @@ -882,7 +883,7 @@ int nft_lex(void *, void *, void *); %type tcp_hdr_field %type tcp_hdr_option_type %type tcp_hdr_option_sack -%type tcpopt_field_maxseg tcpopt_field_sack tcpopt_field_tsopt tcpopt_field_window +%type tcpopt_field_maxseg tcpopt_field_mptcp tcpopt_field_sack tcpopt_field_tsopt tcpopt_field_window %type tcp_hdr_option_kind_and_field %type boolean_expr @@ -5540,6 +5541,11 @@ tcp_hdr_option_kind_and_field : MSS tcpopt_field_maxseg struct tcp_kind_field kind_field = { .kind = $1, .field = TCPOPT_COMMON_LENGTH }; $$ = kind_field; } + | MPTCP tcpopt_field_mptcp + { + struct tcp_kind_field kind_field = { .kind = TCPOPT_KIND_MPTCP, .field = $2 }; + $$ = kind_field; + } ; tcp_hdr_option_sack : SACK { $$ = TCPOPT_KIND_SACK; } @@ -5583,6 +5589,9 @@ tcpopt_field_tsopt : TSVAL { $$ = TCPOPT_TS_TSVAL; } tcpopt_field_maxseg : SIZE { $$ = TCPOPT_MAXSEG_SIZE; } ; +tcpopt_field_mptcp : SUBTYPE { $$ = TCPOPT_MPTCP_SUBTYPE; } + ; + dccp_hdr_expr : DCCP dccp_hdr_field { $$ = payload_expr_alloc(&@$, &proto_dccp, $2); -- cgit v1.2.3