diff --git a/gtests/net/packetdrill/lexer.l b/gtests/net/packetdrill/lexer.l index 95cb894ce1fd22bbf9a4d5e5d8afccc97bc9b866..6a355a98e00dcd82d6f4fcf6b7ec6dba29e943cb 100644 --- a/gtests/net/packetdrill/lexer.l +++ b/gtests/net/packetdrill/lexer.l @@ -236,6 +236,7 @@ COOKIE_ACK return COOKIE_ACK; ECNE return ECNE; CWR return CWR; SHUTDOWN_COMPLETE return SHUTDOWN_COMPLETE; +I-DATA return I_DATA; PAD return PAD; type return TYPE; flgs return FLAGS; @@ -247,7 +248,9 @@ os return OS; tsn return TSN; sid return SID; ssn return SSN; +mid return MID; ppid return PPID; +fsn return FSN; cum_tsn return CUM_TSN; gaps return GAPS; dups return DUPS; diff --git a/gtests/net/packetdrill/parser.y b/gtests/net/packetdrill/parser.y index a8aa42363c5ab2ca6a32c6a55ecf3b73a1d177e7..d75f64c4546f866ac260980f1321d54174c12ede 100644 --- a/gtests/net/packetdrill/parser.y +++ b/gtests/net/packetdrill/parser.y @@ -512,9 +512,9 @@ static struct tcp_option *new_tcp_fast_open_option(const char *cookie_string, %token <reserved> SSTAT_PRIMARY; %token <reserved> CHUNK DATA INIT INIT_ACK HEARTBEAT HEARTBEAT_ACK ABORT %token <reserved> SHUTDOWN SHUTDOWN_ACK ERROR COOKIE_ECHO COOKIE_ACK ECNE CWR -%token <reserved> SHUTDOWN_COMPLETE PAD +%token <reserved> SHUTDOWN_COMPLETE I_DATA PAD %token <reserved> TYPE FLAGS LEN -%token <reserved> TAG A_RWND OS IS TSN SID SSN PPID CUM_TSN GAPS DUPS +%token <reserved> TAG A_RWND OS IS TSN SID SSN MID PPID FSN CUM_TSN GAPS DUPS %token <reserved> PARAMETER HEARTBEAT_INFORMATION IPV4_ADDRESS IPV6_ADDRESS %token <reserved> STATE_COOKIE UNRECOGNIZED_PARAMETER COOKIE_PRESERVATIVE %token <reserved> HOSTNAME_ADDRESS SUPPORTED_ADDRESS_TYPES ECN_CAPABLE @@ -582,6 +582,7 @@ static struct tcp_option *new_tcp_fast_open_option(const char *cookie_string, %type <chunk_list_item> sctp_cookie_echo_chunk_spec sctp_cookie_ack_chunk_spec %type <chunk_list_item> sctp_ecne_chunk_spec sctp_cwr_chunk_spec %type <chunk_list_item> sctp_shutdown_complete_chunk_spec +%type <chunk_list_item> sctp_i_data_chunk_spec %type <chunk_list_item> sctp_pad_chunk_spec %type <parameter_list> opt_parameter_list_spec sctp_parameter_list_spec %type <parameter_list_item> sctp_parameter_spec @@ -614,8 +615,9 @@ static struct tcp_option *new_tcp_fast_open_option(const char *cookie_string, %type <cause_list_item> sctp_protocol_violation_cause_spec %type <integer> opt_chunk_type opt_parameter_type opt_cause_code %type <integer> opt_flags opt_data_flags opt_abort_flags -%type <integer> opt_shutdown_complete_flags opt_len +%type <integer> opt_shutdown_complete_flags opt_i_data_flags opt_len %type <integer> opt_tag opt_a_rwnd opt_os opt_is opt_tsn opt_sid opt_ssn +%type <integer> opt_mid opt_fsn %type <integer> opt_cum_tsn opt_ppid %type <byte_list> opt_val opt_info byte_list %type <byte_list_item> byte @@ -832,6 +834,7 @@ sctp_chunk_spec | sctp_ecne_chunk_spec { $$ = $1; } | sctp_cwr_chunk_spec { $$ = $1; } | sctp_shutdown_complete_chunk_spec { $$ = $1; } +| sctp_i_data_chunk_spec { $$ = $1; } | sctp_pad_chunk_spec { $$ = $1; } ; @@ -1044,6 +1047,64 @@ opt_shutdown_complete_flags } ; +opt_i_data_flags +: FLAGS '=' ELLIPSIS { $$ = -1; } +| FLAGS '=' HEX_INTEGER { + if (!is_valid_u8($3)) { + semantic_error("flags value out of range"); + } + $$ = $3; +} +| FLAGS '=' INTEGER { + if (!is_valid_u8($3)) { + semantic_error("flags value out of range"); + } + $$ = $3; +} +| FLAGS '=' WORD { + u64 flags; + char *c; + + flags = 0; + for (c = $3; *c != '\0'; c++) { + switch (*c) { + case 'I': + if (flags & SCTP_I_DATA_CHUNK_I_BIT) { + semantic_error("I-bit specified multiple times"); + } else { + flags |= SCTP_I_DATA_CHUNK_I_BIT; + } + break; + case 'U': + if (flags & SCTP_I_DATA_CHUNK_U_BIT) { + semantic_error("U-bit specified multiple times"); + } else { + flags |= SCTP_I_DATA_CHUNK_U_BIT; + } + break; + case 'B': + if (flags & SCTP_I_DATA_CHUNK_B_BIT) { + semantic_error("B-bit specified multiple times"); + } else { + flags |= SCTP_I_DATA_CHUNK_B_BIT; + } + break; + case 'E': + if (flags & SCTP_I_DATA_CHUNK_E_BIT) { + semantic_error("E-bit specified multiple times"); + } else { + flags |= SCTP_I_DATA_CHUNK_E_BIT; + } + break; + default: + semantic_error("Only expecting IUBE as flags"); + break; + } + } + $$ = flags; +} +; + opt_tag : TAG '=' ELLIPSIS { $$ = -1; } | TAG '=' INTEGER { @@ -1114,6 +1175,16 @@ opt_ssn } ; +opt_mid +: MID '=' ELLIPSIS { $$ = -1; } +| MID '=' INTEGER { + if (!is_valid_u32($3)) { + semantic_error("mid value out of range"); + } + $$ = $3; +} +; + opt_ppid : PPID '=' ELLIPSIS { $$ = -1; } | PPID '=' INTEGER { @@ -1124,6 +1195,16 @@ opt_ppid } ; +opt_fsn +: FSN '=' ELLIPSIS { $$ = -1; } +| FSN '=' INTEGER { + if (!is_valid_u32($3)) { + semantic_error("fsn value out of range"); + } + $$ = $3; +} +; + opt_cum_tsn : CUM_TSN '=' ELLIPSIS { $$ = -1; } | CUM_TSN '=' INTEGER { @@ -1289,6 +1370,22 @@ sctp_shutdown_complete_chunk_spec $$ = sctp_shutdown_complete_chunk_new($3); } +sctp_i_data_chunk_spec +: I_DATA '[' opt_i_data_flags ',' opt_len ',' opt_tsn ',' opt_sid ',' opt_mid ',' opt_ppid ']' { + if (($5 != -1) && + (!is_valid_u16($5) || ($5 < sizeof(struct sctp_i_data_chunk)))) { + semantic_error("length value out of range"); + } + $$ = sctp_i_data_chunk_new($3, $5, $7, $9, 0, $11, $13, -1); +} +| I_DATA '[' opt_i_data_flags ',' opt_len ',' opt_tsn ',' opt_sid ',' opt_mid ',' opt_fsn ']' { + if (($5 != -1) && + (!is_valid_u16($5) || ($5 < sizeof(struct sctp_i_data_chunk)))) { + semantic_error("length value out of range"); + } + $$ = sctp_i_data_chunk_new($3, $5, $7, $9, 0, $11, -1, $13); +} + sctp_pad_chunk_spec : PAD '[' opt_flags ',' opt_len ',' VAL '=' ELLIPSIS ']' { if (($5 != -1) &&