diff --git a/gtests/net/packetdrill/parser.y b/gtests/net/packetdrill/parser.y index 3ee8ff41e39d472238bc4ca10b9f8522c0449120..7f763ec7fa7fdb2c3e1b930aa51a8fdc50d6ad38 100644 --- a/gtests/net/packetdrill/parser.y +++ b/gtests/net/packetdrill/parser.y @@ -3362,6 +3362,12 @@ sctp_setprim $$->value.sctp_setprim->ssp_assoc_id = $4; $$->value.sctp_setprim->ssp_addr = $8; } +| '{' SSP_ASSOC_ID '=' sctp_assoc_id ',' SSP_ADDR '=' ELLIPSIS'}' { + $$ = new_expression(EXPR_SCTP_SETPRIM); + $$->value.sctp_setprim = calloc(1, sizeof(struct sctp_setprim_expr)); + $$->value.sctp_setprim->ssp_assoc_id = $4; + $$->value.sctp_setprim->ssp_addr = new_expression(EXPR_ELLIPSIS); +} ; sctp_setadaptation @@ -3373,6 +3379,11 @@ sctp_setadaptation } $$->value.sctp_setadaptation->ssb_adaptation_ind = new_integer_expression($4, "%u"); } +| '{' SSB_ADAPTATION_IND '=' ELLIPSIS '}' { + $$ = new_expression(EXPR_SCTP_SETADAPTATION); + $$->value.sctp_setadaptation = calloc(1, sizeof(struct sctp_setadaptation_expr)); + $$->value.sctp_setadaptation->ssb_adaptation_ind = new_expression(EXPR_ELLIPSIS); +} ; sinfo_stream diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_adaptation_event.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_adaptation_event.pkt new file mode 100644 index 0000000000000000000000000000000000000000..6a3a663b916a0543f451d1dd829aa62698a5b6de --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_adaptation_event.pkt @@ -0,0 +1,27 @@ ++0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +// Check the handshake with an empty(!) cookie ++0.0 bind(3, ..., ...) = 0 ++0.0 listen(3, 1) = 0 + +// Enable Event notification ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_ADAPTATION_INDICATION, se_on=1}, 8) = 0 ++0.0 getsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_ADAPTATION_INDICATION, se_on=1}, [8]) = 0 + +// Send Adaptation Indication with Init chunk ++0.0 < sctp: INIT[flgs=0, tag=1, a_rwnd=1500, os=1, is=1, tsn=0, + ECN_CAPABLE[], + ADAPTATION_INDICATION[adaptation_code_point=3], + COOKIE_PRESERVATIVE[incr=12345], + SUPPORTED_ADDRESS_TYPES[types=[IPv4]]] + +* > sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=..., os=..., is=..., tsn=10, ...] ++0.0 < sctp: COOKIE_ECHO[flgs=0, len=..., val=...] +* > sctp: COOKIE_ACK[flgs=0] + ++0.0 accept(3, ..., ...) = 4 + +//TODO: Packetdrill does not support Path reconfiguration, after that update this test ++0.0 sctp_recvv(4, [{iov_base={sai_type=SCTP_ADAPTATION_INDICATION, sai_flags=0, sai_length=16, sai_adaptation_ind=3, sai_assoc_id=...}, +iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO],[MSG_NOTIFICATION|MSG_EOR]) = 16 diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_assoc_change_event.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_assoc_change_event.pkt new file mode 100644 index 0000000000000000000000000000000000000000..f110cab2989614c5b5b299738950d857e10833d6 --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_assoc_change_event.pkt @@ -0,0 +1,22 @@ ++0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +// Check the handshake with an empty(!) cookie ++0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_ASSOC_CHANGE, se_on=1}, 8) = 0 ++0.0 getsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_ASSOC_CHANGE, se_on=1}, [8]) = 0 ++0.0 > sctp: INIT[flgs=0, tag=1, a_rwnd=..., os=..., is=..., tsn=1, ...] ++0.1 < sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=1500, os=1, is=1, tsn=1, STATE_COOKIE[len=4, val=...]] ++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=..., sac_info=[SCTP_ASSOC_SUPPORTS_MULTIBUF]}, 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=..., sac_info=[]}, iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION|MSG_EOR]) = 20 + diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_authentication_event.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_authentication_event.pkt new file mode 100644 index 0000000000000000000000000000000000000000..4b216e9877183a0104c96f4216955d6829fce983 --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_authentication_event.pkt @@ -0,0 +1,20 @@ ++0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +// Check the handshake with an empty(!) cookie ++0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_AUTHENTICATION_EVENT, se_on=1}, 8) = 0 ++0.0 getsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_AUTHENTICATION_EVENT, se_on=1}, [8]) = 0 ++0.0 > sctp: INIT[flgs=0, tag=1, a_rwnd=..., os=..., is=..., tsn=1, ...] ++0.1 < sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=1500, os=1, is=1, tsn=1, STATE_COOKIE[len=4, val=...]] ++0.0 > sctp: COOKIE_ECHO[flgs=0, len=4, val=...] ++0.1 < sctp: COOKIE_ACK[flgs=0] + ++0.0 sctp_recvv(3, [{iov_base={auth_type=SCTP_AUTHENTICATION_EVENT, auth_flags=0, auth_length=20, auth_keynumber=0, auth_indication=SCTP_AUTH_NO_AUTH, +auth_assoc_id=3}, iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION|MSG_EOR]) = 20 + ++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] + diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_notifications_stopped_event.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_notifications_stopped_event.pkt new file mode 100644 index 0000000000000000000000000000000000000000..65a7771b77639237c0e5b8b27846dccc007f1bd3 --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_notifications_stopped_event.pkt @@ -0,0 +1,17 @@ ++0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +// Check the handshake with an empty(!) cookie ++0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_ADAPTATION_INDICATION, se_on=1}, 8) = 0 ++0.0 getsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_ADAPTATION_INDICATION, se_on=1}, [8]) = 0 ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_NOTIFICATIONS_STOPPED_EVENT, se_on=1}, 8) = 0 + ++0.0 > sctp: INIT[flgs=0, tag=1, a_rwnd=..., os=..., is=..., tsn=1, ...] ++0.1 < sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=1500, os=1, is=1, tsn=1, STATE_COOKIE[len=4, val=...]] ++0.0 > sctp: COOKIE_ECHO[flgs=0, len=4, val=...] ++0.1 < sctp: COOKIE_ACK[flgs=0] +// No implementation provides this messages, so it can't be tested +// as discribed in rfc, create an notification storm so that the implementation disable notifications ++0.0 sctp_recvv(3, [{iov_base={sn_type=SCTP_NOTIFICATIONS_STOPPED_EVENT, sn_flags=0, sn_length=8}, iov_len=1000}], 1, +..., 20, NULL, [0], [SCTP_RECVV_NOINFO],[MSG_NOTIFICATION|MSG_EOR]) = 21 diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_partial_delivery_event.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_partial_delivery_event.pkt new file mode 100644 index 0000000000000000000000000000000000000000..68ffb5bba20a025be8a21d819098957a32e38dda --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_partial_delivery_event.pkt @@ -0,0 +1,26 @@ ++0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +// Check the handshake with an empty(!) cookie ++0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0.0 > sctp: INIT[flgs=0, tag=1, a_rwnd=..., os=..., is=..., tsn=1, ...] ++0.1 < sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=1500, os=1, is=1, tsn=1, STATE_COOKIE[len=4, val=...]] ++0.0 > sctp: COOKIE_ECHO[flgs=0, len=4, val=...] ++0.1 < sctp: COOKIE_ACK[flgs=0] +//Enable Partial delivery event ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_PARTIAL_DELIVERY_EVENT, se_on=1}, 8) = 0 ++0.0 getsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_PARTIAL_DELIVERY_EVENT, se_on=1}, [8]) = 0 + ++0.0 < sctp: DATA[flgs=B, len=300, tsn=1, sid=0, ssn=0, ppid=0] ++0.0 > sctp: SACK[flgs=0, cum_tsn=1, a_rwnd=..., gaps=[], dups=[]] ++0.0 < sctp: DATA[flgs=0, len=300, tsn=2, sid=0, ssn=0, ppid=0] +* > sctp: SACK[flgs=0, cum_tsn=2, a_rwnd=..., gaps=[], dups=[]] ++0.0 < sctp: ABORT[flgs=0] ++1.5 sctp_recvv(3, [{iov_base=..., iov_len=1000}, + {iov_base={pdapi_type=SCTP_PARTIAL_DELIVERY_EVENT, + pdapi_flags=0, + pdapi_length=24, + pdapi_indication=SCTP_PARTIAL_DELIVERY_ABORTED, + pdapi_stream=0, + pdapi_seq=0, + pdapi_assoc_id=3 }, iov_len=1000}], 2, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION|MSG_EOR]) = 21 diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_peer_addr_change.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_peer_addr_change.pkt new file mode 100644 index 0000000000000000000000000000000000000000..1737976033c57d139d21064ab8c4a451ee58f8e3 --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_peer_addr_change.pkt @@ -0,0 +1,47 @@ ++0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +// Check the handshake with an empty(!) cookie ++0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) + ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_PEER_ADDR_CHANGE, se_on=1}, 8) = 0 ++0.0 getsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_PEER_ADDR_CHANGE, se_on=1}, [8]) = 0 + ++0.0 > sctp: INIT[flgs=0, tag=1, a_rwnd=..., os=..., is=..., tsn=1, ...] ++0.1 < sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=1500, os=1, is=1, tsn=1, STATE_COOKIE[len=4, val=...]] ++0.0 > sctp: COOKIE_ECHO[flgs=0, len=4, val=...] ++0.1 < sctp: COOKIE_ACK[flgs=0] ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, {spp_assoc_id=..., + spp_address=..., + spp_hbinterval=1, + spp_pathmaxrxt=3, + spp_pathmtu=1468, + spp_flags=SPP_HB_ENABLE, + spp_ipv6_flowlabel=0, + spp_dscp=0}, 152) = 0 + +* > sctp: HEARTBEAT[flgs=0, HEARTBEAT_INFORMATION[len=..., val=...]] +* > sctp: HEARTBEAT[flgs=0, HEARTBEAT_INFORMATION[len=..., val=...]] +* > sctp: HEARTBEAT[flgs=0, HEARTBEAT_INFORMATION[len=..., val=...]] +* > sctp: HEARTBEAT[flgs=0, HEARTBEAT_INFORMATION[len=..., val=...]] +* > sctp: HEARTBEAT[flgs=0, HEARTBEAT_INFORMATION[len=..., val=...]] + ++0.5 sctp_recvv(3, [{iov_base={spc_type=SCTP_PEER_ADDR_CHANGE, + spc_flags=0, + spc_length=152, + spc_aaddr=..., + spc_state=SCTP_ADDR_UNREACHABLE, + spc_error=0, + spc_assoc_id=...}, + iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION|MSG_EOR]) = 152 + ++0.0 < sctp: HEARTBEAT_ACK[flgs=0, HEARTBEAT_INFORMATION[len=..., val=...]] + ++0.5 sctp_recvv(3, [{iov_base={spc_type=SCTP_PEER_ADDR_CHANGE, + spc_flags=0, + spc_length=152, + spc_aaddr=..., + spc_state=SCTP_ADDR_AVAILABLE, + spc_error=0, + spc_assoc_id=...}, + iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION|MSG_EOR]) = 152 diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_remote_error.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_remote_error.pkt new file mode 100644 index 0000000000000000000000000000000000000000..7479fdc1554e6a87cb508fad6418678d8b26e856 --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_remote_error.pkt @@ -0,0 +1,19 @@ ++0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +// Check the handshake with an empty(!) cookie ++0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_REMOTE_ERROR, se_on=1}, 8) = 0 ++0.0 getsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_REMOTE_ERROR, se_on=1}, [8]) = 0 ++0.0 > sctp: INIT[flgs=0, tag=1, a_rwnd=..., os=..., is=..., tsn=1, ...] ++0.1 < sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=1500, os=1, is=1, tsn=1, STATE_COOKIE[len=4, val=...]] ++0.0 > sctp: COOKIE_ECHO[flgs=0, len=4, val=...] ++0.1 < sctp: COOKIE_ACK[flgs=0] + ++0.0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 + ++0.0 < sctp: ERROR[flgs=0, INVALID_STREAM_IDENTIFIER[sid=1]] + ++0.0 sctp_recvv(3, [{iov_base={sre_type=SCTP_REMOTE_ERROR, sre_flags=0, sre_length=32, sre_error=1, +sre_assoc_id=..., sre_data=[0x09, 0x00, 0x00 , 0x0C, 0x00, 0x01, 0x00 , 0x08, 0x00, 0x01, 0x00 , 0x00]}, iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], +[MSG_NOTIFICATION|MSG_EOR]) = 32 diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_send_failed.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_send_failed.pkt new file mode 100644 index 0000000000000000000000000000000000000000..3a7570d6e6a3549f21074173ce26b5b775c9474c --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_send_failed.pkt @@ -0,0 +1,53 @@ ++0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +// Check the handshake with an empty(!) cookie ++0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0.0 > sctp: INIT[flgs=0, tag=1, a_rwnd=..., os=..., is=..., tsn=1, ...] ++0.1 < sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=1500, os=1, is=1, tsn=1, STATE_COOKIE[len=4, val=...]] ++0.0 > sctp: COOKIE_ECHO[flgs=0, len=4, val=...] ++0.1 < sctp: COOKIE_ACK[flgs=0] ++0.0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 + ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, {spp_assoc_id=..., + spp_address=..., + spp_hbinterval=0, + spp_pathmaxrxt=100, + spp_pathmtu=1468, + spp_flags=SPP_HB_DISABLE, + spp_ipv6_flowlabel=0, + spp_dscp=0}, 152) = 0 + +//test for SEND_FAILED_EVENT ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_SEND_FAILED, se_on=1}, 8) = 0 ++0.0 getsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_SEND_FAILED, se_on=1}, [8]) = 0 + ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_RTOINFO, {srto_assoc_id=0, + srto_initial=100, + srto_max=150, + srto_min=50}, 16) = 0 + ++0.0 write(3, ..., 1000) = 1000 ++0.0 > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] ++1.0 sctp_recvv(3, [{iov_base={ssf_type=SCTP_SEND_FAILED, + ssf_flags=SCTP_DATA_SENT, + ssf_length=1144, + ssf_error=0, + ssf_info={sinfo_stream=0, + sinfo_ssn=0, + sinfo_flags=3, + sinfo_ppid=htonl(0), + sinfo_context=0, + sinfo_timetolive=0, + sinfo_tsn=0, + sinfo_cumtsn=0, + sinfo_assoc_id=3}, + ssf_assoc_id=3, + ssf_data=...}, iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION]) = 1000 diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_send_failed_event.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_send_failed_event.pkt new file mode 100644 index 0000000000000000000000000000000000000000..3febfbd9c61efa0aa4c736063585dca7504f570e --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_send_failed_event.pkt @@ -0,0 +1,50 @@ ++0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +// Check the handshake with an empty(!) cookie ++0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0.0 > sctp: INIT[flgs=0, tag=1, a_rwnd=..., os=..., is=..., tsn=1, ...] ++0.1 < sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=1500, os=1, is=1, tsn=1, STATE_COOKIE[len=4, val=...]] ++0.0 > sctp: COOKIE_ECHO[flgs=0, len=4, val=...] ++0.1 < sctp: COOKIE_ACK[flgs=0] + ++0.0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 ++0 setsockopt(3, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, {spp_assoc_id=..., + spp_address=..., + spp_hbinterval=0, + spp_pathmaxrxt=100, + spp_pathmtu=1468, + spp_flags=SPP_HB_DISABLE, + spp_ipv6_flowlabel=0, + spp_dscp=0}, 152) = 0 + +//test for SEND_FAILED_EVENT ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, + se_type=SCTP_SEND_FAILED_EVENT, + se_on=1}, 8) = 0 + ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_RTOINFO, {srto_assoc_id=0, + srto_initial=100, + srto_max=150, + srto_min=50}, 16) = 0 + ++0.0 write(3, ..., 1000) = 1000 ++0.0 > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] +* > sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=0, ppid=0] ++1.0 sctp_recvv(3, [{iov_base={ssfe_type=SCTP_SEND_FAILED_EVENT, + ssfe_flags=SCTP_DATA_SENT, + ssfe_length=1032, + ssfe_error=0, + ssfe_info={snd_sid=0, + snd_flags=3, + snd_ppid=htonl(0), + snd_context=0, + snd_assoc_id=3}, + ssfe_assoc_id=3, + ssfe_data=...}, iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION]) = 1000 diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_sender_dry_event.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_sender_dry_event.pkt new file mode 100644 index 0000000000000000000000000000000000000000..f060cbee7b38827f4911d3e33fc8726c2c70a954 --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_sender_dry_event.pkt @@ -0,0 +1,34 @@ ++0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +// Check the handshake with an empty(!) cookie ++0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0.0 > sctp: INIT[flgs=0, tag=1, a_rwnd=..., os=..., is=..., tsn=1, ...] ++0.1 < sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=1500, os=1, is=1, tsn=1, STATE_COOKIE[len=4, val=...]] ++0.0 > sctp: COOKIE_ECHO[flgs=0, len=4, val=...] ++0.1 < sctp: COOKIE_ACK[flgs=0] ++0.0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 + +//test for enable socketoptions with SCTP_EVENT and SCTP_EVENTS ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENTS, {sctp_data_io_event=1, + sctp_association_event=1, + sctp_address_event=0, + sctp_send_failure_event=1, + sctp_peer_error_event=0, + sctp_shutdown_event=1, + sctp_partial_delivery_event=0, + sctp_adaptation_layer_event=0, + sctp_authentication_event=0, + sctp_sender_dry_event=0}, 11) = 0 + ++0.0 getsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_SHUTDOWN_EVENT, se_on=1}, [8]) = 0 + +//test for SENDER_DRY_EVENT ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_SENDER_DRY_EVENT, se_on=1}, 8) = 0 ++0.0 sctp_recvv(3, [{iov_base={sender_dry_type=SCTP_SENDER_DRY_EVENT, + sender_dry_flags=0, + sender_dry_length=12, + sender_dry_assoc_id=3}, iov_len=1000}], 1, ..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION|MSG_EOR]) = 12 + ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_SENDER_DRY_EVENT, se_on=0}, 8) = 0 + diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_shutdown_event.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_shutdown_event.pkt new file mode 100644 index 0000000000000000000000000000000000000000..9671000ddce4f8021868cd7a2e38d9caa8a01be6 --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/notifications/sctp_shutdown_event.pkt @@ -0,0 +1,28 @@ ++0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +// Check the handshake with an empty(!) cookie ++0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0.0 > sctp: INIT[flgs=0, tag=1, a_rwnd=..., os=..., is=..., tsn=1, ...] ++0.1 < sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=1500, os=1, is=1, tsn=1, STATE_COOKIE[len=4, val=...]] ++0.0 > sctp: COOKIE_ECHO[flgs=0, len=4, val=...] ++0.1 < sctp: COOKIE_ACK[flgs=0] ++0.0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 + +//test for enable socketoptions with SCTP_EVENT and SCTP_EVENTS ++0.0 setsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_SHUTDOWN_EVENT, se_on=1}, 8) = 0 ++0.0 getsockopt(3, IPPROTO_SCTP, SCTP_EVENT, {se_assoc_id=0, se_type=SCTP_SHUTDOWN_EVENT, se_on=1}, [8]) = 0 + +// Tear down the association ++0.0 < sctp: SHUTDOWN[flgs=0, cum_tsn=0] +* > sctp: SHUTDOWN_ACK[flgs=0] ++0.0 < sctp: SHUTDOWN_COMPLETE[flgs=0] ++0.0 recvmsg(3, {msg_name(...)=..., + msg_iov(1)=[{iov_base={sse_type=SCTP_SHUTDOWN_EVENT, + sse_flags=0, + sse_length=12, + sse_assoc_id=3}, iov_len=1000}], + msg_control(0)=[], + msg_flags=MSG_NOTIFICATION|MSG_EOR}, 0) = 12 +//+0.0 sctp_recvv(3, [{iov_base={sse_type=SCTP_SHUTDOWN_EVENT, sse_flags=1, sse_length=12}, iov_len=1000}], 1, +//..., 20, NULL, [0], [SCTP_RECVV_NOINFO], [MSG_NOTIFICATION|MSG_EOR]) = 12 diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/run-all-tests b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/run-all-tests index fc7e73489d7d2ba4aac0766d655d44fcdda3f929..19404d0579fbf74e266b89660efcc28d20028905 100755 --- a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/run-all-tests +++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/run-all-tests @@ -63,6 +63,17 @@ set testcases = (setsockopt/sctp_rtoinfo_1 \ getsockopt/sctp_default_prinfo \ getsockopt/sctp_status \ getsockopt/sctp_get_peer_addr_info \ + notifications/sctp_adaptation_event \ + notifications/sctp_notifications_stopped_event \ + notifications/sctp_remote_error \ + notifications/sctp_sender_dry_event \ + notifications/sctp_assoc_change_event \ + notifications/sctp_partial_delivery_event \ + notifications/sctp_send_failed \ + notifications/sctp_shutdown_event \ + notifications/sctp_authentication_event \ + notifications/sctp_peer_addr_change \ + notifications/sctp_send_failed_event \ sctp_send/sctp_send_1 \ sctp_send/sctp_send_2 \ sctp_sendx/sctp_sendx_1 )