Skip to content
Snippets Groups Projects
Commit 24d6fd4b authored by hoelscher's avatar hoelscher
Browse files

check of sac_info in sctp_assoc_change

parent 5e2ebe52
No related branches found
No related tags found
No related merge requests found
......@@ -549,7 +549,7 @@ static struct tcp_option *new_tcp_fast_open_option(const char *cookie_string,
%token <reserved> RECVV_RCVINFO RECVV_NXTINFO
%token <reserved> SSE_TYPE SSE_FLAGS SSE_LENGTH
%token <reserved> SENDER_DRY_TYPE SENDER_DRY_FLAGS SENDER_DRY_LENGTH SENDER_DRY_ASSOC_ID
%token <rexerved> _SCTP_DATA_IO_EVENT_ _SCTP_ASSOCIATION_EVENT_ _SCTP_ADDRESS_EVENT_
%token <reserved> _SCTP_DATA_IO_EVENT_ _SCTP_ASSOCIATION_EVENT_ _SCTP_ADDRESS_EVENT_
%token <reserved> _SCTP_SEND_FAILURE_EVENT_ _SCTP_PEER_ERROR_EVENT_ _SCTP_SHUTDOWN_EVENT_
%token <reserved> _SCTP_PARTIAL_DELIVERY_EVENT_ _SCTP_ADAPTATION_LAYER_EVENT_
%token <reserved> _SCTP_AUTHENTICATION_EVENT_ _SCTP_SENDER_DRY_EVENT_
......@@ -615,7 +615,7 @@ static struct tcp_option *new_tcp_fast_open_option(const char *cookie_string,
%type <expression> sctp_sender_dry_event sender_dry_type sender_dry_flags sender_dry_length sender_dry_assoc_id
%type <expression> sctp_event_subscribe
%type <expression> sctp_assoc_change sac_type sac_flags sac_length sac_state sac_error sac_outbound_streams
%type <expression> sac_inbound_streams sac_assoc_id
%type <expression> sac_inbound_streams sac_assoc_id sac_info
%type <expression> sctp_send_failed_event ssfe_type ssfe_flags ssfe_length ssfe_error ssfe_assoc_id
%type <errno_info> opt_errno
%type <chunk_list> sctp_chunk_list_spec
......@@ -3793,9 +3793,14 @@ sac_assoc_id
| SAC_ASSOC_ID '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
;
sac_info
: SAC_INFO '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
| SAC_INFO '=' array { $$ = $3; }
;
sctp_assoc_change
: '{' sac_type ',' sac_flags ',' sac_length ',' sac_state ',' sac_error ',' sac_outbound_streams ','
sac_inbound_streams ',' sac_assoc_id ',' SAC_INFO '=' ELLIPSIS '}' {
sac_inbound_streams ',' sac_assoc_id ',' sac_info '}' {
$$ = new_expression(EXPR_SCTP_ASSOC_CHANGE);
$$->value.sctp_assoc_change = calloc(1, sizeof(struct sctp_assoc_change_expr));
$$->value.sctp_assoc_change->sac_type = $2;
......@@ -3806,7 +3811,7 @@ sac_inbound_streams ',' sac_assoc_id ',' SAC_INFO '=' ELLIPSIS '}' {
$$->value.sctp_assoc_change->sac_outbound_streams = $12;
$$->value.sctp_assoc_change->sac_inbound_streams = $14;
$$->value.sctp_assoc_change->sac_assoc_id = $16;
$$->value.sctp_assoc_change->sac_info = new_expression(EXPR_ELLIPSIS);
$$->value.sctp_assoc_change->sac_info = $18;
}
;
......
......@@ -3367,7 +3367,54 @@ static int check_sctp_assoc_change(struct sctp_assoc_change_expr *expr,
if (check_u32_expr(expr->sac_assoc_id, sctp_event->sac_assoc_id,
"sctp_assoc_change.sac_assoc_id", error))
return STATUS_ERR;
if ( expr->sac_info->type != EXPR_ELLIPSIS) {
size_t infolen = 0;
struct expression *info_expr = NULL;
int i;
infolen = sizeof(sctp_event->sac_type);
infolen += sizeof(sctp_event->sac_flags);
infolen += sizeof(sctp_event->sac_length);
infolen += sizeof(sctp_event->sac_state);
infolen += sizeof(sctp_event->sac_error);
infolen += sizeof(sctp_event->sac_outbound_streams);
infolen += sizeof(sctp_event->sac_inbound_streams);
infolen += sizeof(sctp_event->sac_assoc_id);
infolen = sctp_event->sac_length - infolen + 1;
switch(expr->sac_info->type) {
case EXPR_LIST:
if (infolen != expression_list_length(expr->sac_info->value.list)) {
asprintf(error, "sctp_assoc_change. sac_list length unequal to sac_lenth expected: %u actual %u",
expression_list_length(expr->sac_info->value.list), infolen);
return STATUS_ERR;
}
for (i = 0; i < infolen; i++) {
info_expr = get_arg(expr->sac_info->value.list, i, error);
if (info_expr->type != EXPR_ELLIPSIS) {
u8 script_val;
if (get_u8(info_expr, &script_val, error)) {
return STATUS_ERR;
}
if (script_val != sctp_event->sac_info[i]) {
asprintf(error, "sctp_assoc_change.sac_info. byte %d: expected: %hhu actual: %hhu",
i, script_val, sctp_event->sac_info[i]);
return STATUS_ERR;
}
}
/*if (info_expr->type != EXPR_ELLIPSIS) {
if (check_u8_expr(info_expr, sctp_event->sac_info[i],
"sctp_assoc_change.sac_info", error))
return STATUS_ERR;
}
*/ }
break;
default: asprintf(error, "Bad expressiontype for sac_info");
return STATUS_ERR;
break;
}
}
return STATUS_OK;
}
#endif
......
......@@ -211,7 +211,11 @@ struct int_symbol platform_symbols_table[] = {
{ SCTP_COMM_LOST, "SCTP_COMM_LOST" },
{ SCTP_RESTART, "SCTP_RESTART" },
{ SCTP_SHUTDOWN_COMP, "SCTP_SHUTDOWN_COMP" },
{ SCTP_CANT_STR_ASSOC, "SCTP_CANT_STR_ASSOC" },
{ SCTP_ASSOC_SUPPORTS_PR, "SCTP_ASSOC_SUPPORTS_PR" },
{ SCTP_ASSOC_SUPPORTS_AUTH, "SCTP_ASSOC_SUPPORTS_AUTH" },
{ SCTP_ASSOC_SUPPORTS_ASCONF, "SCTP_ASSOC_SUPPORTS_ASCONF" },
{ SCTP_ASSOC_SUPPORTS_MULTIBUF, "SCTP_ASSOC_SUPPORTS_MULTIBUF" },
/* /usr/include/netinet/tcp.h */
{ TCP_NODELAY, "TCP_NODELAY" },
{ TCP_MAXSEG, "TCP_MAXSEG" },
......
......@@ -10,12 +10,14 @@
+0.0 > sctp: COOKIE_ECHO[flgs=0, len=4, val=...]
+0.1 < sctp: COOKIE_ACK[flgs=0]
+0.0 sctp_recvv(3, [{iov_base={sac_type=SCTP_ASSOC_CHANGE, sac_flags=0, sac_length=21, sac_state=SCTP_COMM_UP, sac_error=0, sac_outbound_streams=1,
sac_inbound_streams=1, sac_assoc_id=3, sac_info=...}, iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION|MSG_EOR]) = 21
sac_inbound_streams=1, sac_assoc_id=3, sac_info=[SCTP_ASSOC_SUPPORTS_MULTIBUF, 0x01]}, iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO],
[MSG_NOTIFICATION|MSG_EOR])
= 21
+0.0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+0.0 < sctp: SHUTDOWN[flgs=0, cum_tsn=0]
* > sctp: SHUTDOWN_ACK[flgs=0]
+0.0 < sctp: SHUTDOWN_COMPLETE[flgs=0]
+0.0 sctp_recvv(3, [{iov_base={sac_type=SCTP_ASSOC_CHANGE, sac_flags=0, sac_length=20, sac_state=SCTP_SHUTDOWN_COMP, sac_error=0, sac_outbound_streams=1,
sac_inbound_streams=1, sac_assoc_id=3, sac_info=...}, iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION|MSG_EOR]) = 20
sac_inbound_streams=1, sac_assoc_id=3, sac_info=[0]}, iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION|MSG_EOR]) = 20
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment