From ccd0f8344f655dfc247b68df5004c4a78ce97759 Mon Sep 17 00:00:00 2001
From: hoelscher <jens.hoelscher@fh-muenster.de>
Date: Fri, 27 Nov 2015 09:19:28 +0100
Subject: [PATCH] add last test for unimplemented socketoptions

---
 .../api_tests/getsockopt/sctp_auth_chunk.pkt    | 15 +++++++++++++++
 .../getsockopt/sctp_auth_deactivate_key.pkt     | 15 +++++++++++++++
 .../getsockopt/sctp_auth_delete_key.pkt         | 15 +++++++++++++++
 .../sctp/api_tests/getsockopt/sctp_auth_key.pkt | 15 +++++++++++++++
 .../getsockopt/sctp_get_assoc_id_list.pkt       | 15 +++++++++++++++
 .../getsockopt/sctp_get_assoc_number.pkt        | 15 +++++++++++++++
 .../getsockopt/sctp_local_auth_chunks.pkt       | 17 +++++++++++++++++
 .../getsockopt/sctp_peer_auth_chunks.pkt        | 16 ++++++++++++++++
 .../getsockopt/sctp_set_peer_primary_addr.pkt   | 15 +++++++++++++++
 9 files changed, 138 insertions(+)
 create mode 100644 gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_chunk.pkt
 create mode 100644 gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_deactivate_key.pkt
 create mode 100644 gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_delete_key.pkt
 create mode 100644 gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_key.pkt
 create mode 100644 gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_get_assoc_id_list.pkt
 create mode 100644 gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_get_assoc_number.pkt
 create mode 100644 gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_local_auth_chunks.pkt
 create mode 100644 gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_peer_auth_chunks.pkt
 create mode 100644 gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_set_peer_primary_addr.pkt

diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_chunk.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_chunk.pkt
new file mode 100644
index 00000000..d31aba1d
--- /dev/null
+++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_chunk.pkt
@@ -0,0 +1,15 @@
+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 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+
++0 setsockopt(3, IPPROTO_SCTP, SCTP_AUTH_CHUNK, {sauth_chunk=0}, 1) = 0
+
++0 close(3) = 0
diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_deactivate_key.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_deactivate_key.pkt
new file mode 100644
index 00000000..8c024610
--- /dev/null
+++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_deactivate_key.pkt
@@ -0,0 +1,15 @@
+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 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+
++0 setsockopt(3, IPPROTO_SCTP, SCTP_AUTH_DEACTIVATE_KEY, {scact_assoc_id=..., scact_keynumber=0}, 6) = 0
+
++0 close(3) = 0
diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_delete_key.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_delete_key.pkt
new file mode 100644
index 00000000..94bb2774
--- /dev/null
+++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_delete_key.pkt
@@ -0,0 +1,15 @@
+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 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+
++0 setsockopt(3, IPPROTO_SCTP, SCTP_AUTH_DELETE_KEY, {scact_assoc_id=..., scact_keynumber=0}, 8) = 0
+
++0 close(3) = 0
diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_key.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_key.pkt
new file mode 100644
index 00000000..4f4fd4d6
--- /dev/null
+++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_auth_key.pkt
@@ -0,0 +1,15 @@
+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 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+
++0 setsockopt(3, IPPROTO_SCTP, SCTP_AUTH_KEY, {sca_assoc_id=..., sca_keynumber=123, sca_keylength=2, sca_key=[0x00, 0x00]}, 10) = 0
+
++0 close(3) = 0
diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_get_assoc_id_list.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_get_assoc_id_list.pkt
new file mode 100644
index 00000000..8d6b9cd8
--- /dev/null
+++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_get_assoc_id_list.pkt
@@ -0,0 +1,15 @@
+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 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+
++0 getsockopt(3, IPPROTO_SCTP, SCTP_GET_ASSOC_ID_LIST, {gaids_number_of_ids=0, gaids_assoc_id=[...]}, [0]) = -1
+
++0 close(3) = 0
diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_get_assoc_number.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_get_assoc_number.pkt
new file mode 100644
index 00000000..333a24f6
--- /dev/null
+++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_get_assoc_number.pkt
@@ -0,0 +1,15 @@
+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 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+
++0 getsockopt(3, IPPROTO_SCTP, SCTP_GET_ASSOC_NUMBER, [0], [4]) = -1
+
++0 close(3) = 0
diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_local_auth_chunks.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_local_auth_chunks.pkt
new file mode 100644
index 00000000..a7bc7b01
--- /dev/null
+++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_local_auth_chunks.pkt
@@ -0,0 +1,17 @@
+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 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+
++0 getsockopt(3, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, {gauth_assoc_id=0,
+							gauth_number_of_chunks=...,
+							gauth_chunks=[...]}, [10]) = 0
+
++0 close(3) = 0
diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_peer_auth_chunks.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_peer_auth_chunks.pkt
new file mode 100644
index 00000000..2316c7fc
--- /dev/null
+++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_peer_auth_chunks.pkt
@@ -0,0 +1,16 @@
+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 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+
+//only dummy values, unimplemented in packetdrill
++0 getsockopt(3, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, {gauth_assoc_id=..., gauth_number_of_chunks=2, gauth_chunks=[0x00, 0x01]}, [10]) = 0
+
++0 close(3) = 0
diff --git a/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_set_peer_primary_addr.pkt b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_set_peer_primary_addr.pkt
new file mode 100644
index 00000000..42f74386
--- /dev/null
+++ b/gtests/net/packetdrill/tests/bsd/sctp/api_tests/getsockopt/sctp_set_peer_primary_addr.pkt
@@ -0,0 +1,15 @@
+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 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+
++0 setsockopt(3, IPPROTO_SCTP, SCTP_SET_PEER_PRIMARY_ADDR, {sspp_assoc_id=..., sspp={sa_family=AF_INET, sin_port=htons(8080), sin_addr=inet_addr("192.0.2.1")},}, 20) = 0
+
++0 close(3) = 0
-- 
GitLab