Skip to content

Commit

Permalink
update tests to add outbound echoed ADD_ADDR
Browse files Browse the repository at this point in the history
while at it, change parser to use a keyword to specify the echo bit
set in ADD_ADDR messages.

Link: multipath-tcp/mptcp_net-next#54
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
  • Loading branch information
dcaratti committed Feb 25, 2021
1 parent 2ac4fe3 commit 95cc57b
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 38 deletions.
2 changes: 1 addition & 1 deletion gtests/net/mptcp/add_addr/add_addr_client.pkt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
+0.0 < . 1:1(0) ack 101 win 256 <nop, nop, TS val 705 ecr 305, add_address addr[saddr] hmac=auto, dss dack8=101 dll=0 nocs>

// ADD_ADDR echo (without hmac)
+0.0 > . 101:101(0) ack 1 <nop, nop, TS val 494 ecr 700, add_address addr[saddr] , dss dack4=1 dll=1 nocs>
+0.0 > . 101:101(0) ack 1 <nop, nop, TS val 494 ecr 700, add_address addr[saddr] addr_echo, dss dack4=1 dll=1 nocs>

+0.0 close(3) = 0
+0.0 > . 101:101(0) ack 1 <nop, nop, TS val 494 ecr 700, dss dack4=1 dsn8=101 ssn=0 dll=1 nocs fin, nop, nop>
7 changes: 3 additions & 4 deletions gtests/net/mptcp/add_addr/add_addr_server.pkt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// TODO(malsbat):
+0 `ip mptcp endpoint flush`
+0 `ip mptcp endpoint add 192.168.122.83 signal`
+0 `ip mptcp endpoint add 198.51.100.2 signal`

+0 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
Expand All @@ -17,9 +17,8 @@
+0 accept(3, ..., ...) = 4

// ADD_ADDR is sent directly (>= 5.12), not after first data (< 5.12)
+0 > . 1:1(0) ack 1 <add_address addr[saddr] hmac=auto, dss dack4=1 ssn=1 dll=0 nocs>
// TODO: support injecting ADD_ADDR echo
//+0 < . 1:1(0) ack 1 win 257 <add_address addr[saddr], dss dack8=1 ssn=1 dll=0 nocs>
+0 > . 1:1(0) ack 1 <add_address address_id=1 addr[ep=inet_addr("198.51.100.2")] hmac=auto, dss dack4=1 ssn=1 dll=0 nocs>
+0 < . 1:1(0) ack 1 win 257 <add_address address_id=1 addr[ep=inet_addr("198.51.100.2")] addr_echo, dss dack8=1 ssn=1 dll=0 nocs>

// read and ack 1 data segment
+1.0 < P. 1:1001(1000) ack 1 win 450 <nop, nop, dss dack8=1 dsn8=1 ssn=1 dll=1000 nocs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
+0 accept(3, ..., ...) = 4

// add_addr
+0.0 > . 1:1(0) ack 1 <add_address addr[saddr1] hmac=auto, dss dack4=1 dll=0 nocs>
// TODO: send echo bit
// +0.0 < . 1:1(0) ack 1 win 256 <add_address addr[saddr1], dss dack8=1 dll=0 nocs>
+0.0 > . 1:1(0) ack 1 <add_address address_id=1 addr[saddr1] hmac=auto, dss dack4=1 dll=0 nocs>
+0.0 < . 1:1(0) ack 1 win 256 <add_address address_id=1 addr[saddr1] addr_echo, dss dack8=1 dll=0 nocs>

+0.2 < P. 1:1001(1000) ack 1 win 450 <nop, nop, dss dack8=1 dsn8=1 ssn=1 dll=1000 nocs>
+0.0 > . 1:1(0) ack 1001 <dss dack8=1001 nocs>
Expand All @@ -27,8 +26,8 @@


// add another subflow.
+0.5 < addr[caddr1] > addr[saddr1] S 0:0(0) win 65535 <mss 1460, nop, wscale 7, mp_join_syn address_id=2 token=sha256_32(skey)>
+0.0 > S. 0:0(0) ack 1 <mss 1460, nop, wscale 8, mp_join_syn_ack address_id=0 sender_hmac=auto>
+0.5 < addr[caddr1] > addr[saddr1] S 0:0(0) win 65535 <mss 1460, nop, wscale 7, mp_join_syn address_id=1 token=sha256_32(skey)>
+0.0 > S. 0:0(0) ack 1 <mss 1460, nop, wscale 8, mp_join_syn_ack address_id=1 sender_hmac=auto>
+0.0 < . 1:1(0) ack 1 win 256 <mp_join_ack sender_hmac=auto>
+0.0 > . 1:1(0) ack 1 <dss dack8=1001 nocs>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

// add_addr
+0.0 > . 1:1(0) ack 1 <add_address addr[saddr1] hmac=auto, dss dack4=1 dll=0 nocs>
// TODO: send echo bit
// +0.0 < . 1:1(0) ack 1 win 256 <add_address addr[saddr1], dss dack8=1 dll=0 nocs>
+0.0 < . 1:1(0) ack 1 win 256 <add_address addr[saddr1] addr_echo, dss dack8=1 dll=0 nocs>

+0.2 < P. 1:1001(1000) ack 1 win 450 <nop, nop, dss dack8=1 dsn8=1 ssn=1 dll=1000 nocs>
+0.0 > . 1:1(0) ack 1001 <dss dack8=1001 nocs>
Expand Down
3 changes: 1 addition & 2 deletions gtests/net/mptcp/fastclose/receive_fastclose_with_rst_v4.pkt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
+0.0 < . 1:1(0) ack 1 win 256 <mp_join_ack sender_hmac=auto>

+0.0 > . 1:1(0) ack 1 <add_address addr[saddr1] hmac=auto, dss dack8=1001 nocs>
// TODO: send echo bit
// +0.0 < . 1:1(0) ack 1 win 256 <add_address addr[saddr1], dss dack8=1 nocs>
+0.0 < . 1:1(0) ack 1 win 256 <add_address addr[saddr1] addr_echo, dss dack8=1 nocs>

// more data, resend. should work now.
+0.0 < P. 1:1001(1000) ack 1 win 450 <nop, nop, dss dack8=1 dsn8=1001 ssn=1 dll=1000 nocs>
Expand Down
2 changes: 1 addition & 1 deletion gtests/net/mptcp/mp_join/mp_join_client_v4.pkt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


+0.0 > > addr[saddr1] S 0:0(0) <mss 1460, sackOK, TS val 448955294 ecr 0, nop, wscale 8, mp_join_syn address_id=0 token=sha256_32(skey)>
+0.0 > > addr[saddr0] . 3:3(0) ack 1 <nop, nop, TS val 448955294 ecr 448955294, add_address addr[saddr1], dss dack4=1 nocs>
+0.0 > > addr[saddr0] . 3:3(0) ack 1 <nop, nop, TS val 448955294 ecr 448955294, add_address addr[saddr1] addr_echo, dss dack4=1 nocs>
+0.0 < S. 0:0(0) ack 1 win 65535 <mss 1460, sackOK, TS val 448955294 ecr 448955294, nop, wscale 8, mp_join_syn_ack address_id=1 sender_hmac=auto>
+0.0 > . 1:1(0) ack 1 <nop, nop, TS val 448955294 ecr 448955294, mp_join_ack sender_hmac=auto>

Expand Down
25 changes: 11 additions & 14 deletions gtests/net/mptcp/mp_join/mp_join_server_v4.pkt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
`../common/defaults.sh`

+0 `../common/server.sh`
+0 `nstat -r -n`

+0.0 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 3
+0.0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
Expand All @@ -17,22 +18,18 @@
+0 accept(3, ..., ...) = 4

// add_addr
+0.0 > . 1:1(0) ack 1 <nop, nop, TS val 4074418293 ecr 4074418292, add_address addr[saddr1] hmac=auto, dss dack4=1 dll=0 nocs>
// TODO: send echo bit
// +0.0 < . 1:1(0) ack 1 <nop, nop, TS val 4074418293 ecr 4074418292, add_address addr[saddr1], dss dack8=1 dll=0 nocs>


+0.2 < P. 1:3(2) ack 1 win 256 <nop, nop, TS val 4074418292 ecr 4074410674, mpcapable v1 flags[flag_h] key[skey, ckey] mpcdatalen 2, nop, nop>
// MP_CAPABLE carrying data are acked with 64-bit, safer not knowing if the
// sender will use a DSN on 64-bit or 32-bit. Later we can use the lower 32 bits
+0.0 > . 1:1(0) ack 3 <nop, nop, TS val 4074418293 ecr 4074418292, dss dack8=3 dll=0 nocs>
+0.0 > . 1:1(0) ack 1 <nop, nop, TS val 4074418293 ecr 4074418292, add_address address_id=1 addr[saddr1] hmac=auto, dss dack4=1 dll=0 nocs>
+0.0 < . 1:1(0) ack 1 win 256 < add_address address_id=1 addr[saddr1] addr_echo, dss dack8=1 dll=0 nocs>

// create subflow
+0.0 < addr[caddr1] > addr[saddr1] S 0:0(0) win 65535 <mss 1460, sackOK, TS val 448955294 ecr 0, nop, wscale 8, mp_join_syn backup=1 address_id=2 token=sha256_32(skey)>
+0.0 > S. 0:0(0) ack 1 <mss 1460, sackOK, TS val 448955294 ecr 448955294, nop, wscale 8, mp_join_syn_ack backup=1 address_id=0 sender_hmac=auto>
+0.0 < addr[caddr1] > addr[saddr1] S 0:0(0) win 65535 <mss 1460, sackOK, TS val 448955294 ecr 0, nop, wscale 8, mp_join_syn backup=1 address_id=1 token=sha256_32(skey)>
+0.0 > S. 0:0(0) ack 1 <mss 1460, sackOK, TS val 448955294 ecr 448955294, nop, wscale 8, mp_join_syn_ack backup=1 address_id=1 sender_hmac=auto>
+0.0 < . 1:1(0) ack 1 win 256 <nop, nop, TS val 448955294 ecr 448955294, mp_join_ack sender_hmac=auto>
+0.0 > . 1:1(0) ack 1 <nop, nop, TS val 448955294 ecr 448955294, dss dack8=3 nocs>

+0.0 > . 1:1(0) ack 1 <nop, nop, TS val 448955294 ecr 448955294, dss dack4=1 nocs>



// close connection
+0.0 < addr[caddr0] > addr[saddr0] F. 3:3(0) ack 1 win 256 <nop, nop, TS val 4074418292 ecr 4074418293, dss dack4=1 dsn8=3 ssn=0 dll=1 nocs fin, nop, nop>
+0.0 < > addr[saddr1] F. 1:1(0) ack 1 win 256 <nop, nop, TS val 448955294 ecr 448955294>
+0.0 < addr[caddr0] > addr[saddr0] F. 1:1(0) ack 1 win 256 <nop, nop, TS val 4074418292 ecr 4074418293, dss dack4=1 dsn8=1 ssn=0 dll=1 nocs fin, nop, nop>
+0.0 < > addr[saddr1] F. 1:1(0) ack 1 win 256
7 changes: 3 additions & 4 deletions gtests/net/mptcp/mp_prio/mp_prio_server_v4.pkt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
+0 accept(3, ..., ...) = 4

// add_addr
+0.0 > . 1:1(0) ack 1 <nop, nop, TS val 4074418293 ecr 4074418292, add_address addr[saddr1] hmac=auto, dss dack4=1 dll=0 nocs>
// TODO: send echo bit
// +0.0 < . 1:1(0) ack 1 <nop, nop, TS val 4074418293 ecr 4074418292, add_address addr[saddr1], dss dack8=1 dll=0 nocs>
+0.0 > . 1:1(0) ack 1 <nop, nop, TS val 4074418293 ecr 4074418292, add_address address_id=1 addr[saddr1] hmac=auto, dss dack4=1 dll=0 nocs>
+0.0 < . 1:1(0) ack 1 win 256 < add_address address_id=1 addr[saddr1] addr_echo, dss dack8=1 dll=0 nocs>

+0.2 < P. 1:3(2) ack 1 win 256 <nop, nop, TS val 4074418292 ecr 4074410674, mpcapable v1 flags[flag_h] key[skey, ckey] mpcdatalen 2, nop, nop>
// MP_CAPABLE carrying data are acked with 64-bit, safer not knowing if the
Expand All @@ -33,7 +32,7 @@
+0.0 read(4, ..., 2) = 2

// create subflow
+0.0 < addr[caddr1] > addr[saddr1] S 0:0(0) win 65535 <mss 1460, sackOK, TS val 448955294 ecr 0, nop, wscale 8, mp_join_syn backup=1 address_id=2 token=sha256_32(skey)>
+0.0 < addr[caddr1] > addr[saddr1] S 0:0(0) win 65535 <mss 1460, sackOK, TS val 448955294 ecr 0, nop, wscale 8, mp_join_syn backup=1 address_id=1 token=sha256_32(skey)>
+0.0 > S. 0:0(0) ack 1 <mss 1460, sackOK, TS val 448955294 ecr 448955294, nop, wscale 8, mp_join_syn_ack backup=1 address_id=0 sender_hmac=auto>
+0.0 < . 1:1(0) ack 1 win 256 <nop, nop, TS val 448955294 ecr 448955294, mp_join_ack sender_hmac=auto>
+0.0 > . 1:1(0) ack 1 <nop, nop, TS val 448955294 ecr 448955294, dss dack4=5 nocs>
Expand Down
2 changes: 1 addition & 1 deletion gtests/net/mptcp/mp_reset/mp_reset_multi_v4.pkt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

// add_addr
+0.0 > . 1:1(0) ack 1 <add_address addr[saddr1] hmac=auto, dss dack4=1 dll=0 nocs>
// +0.0 < . 1:1(0) ack 1 win 256 <add_address addr[saddr1], dss dack8=1 dll=0 nocs>
+0.0 < . 1:1(0) ack 1 win 256 <add_address addr[saddr1] addr_echo, dss dack8=1 dll=0 nocs>

+0.2 < P. 1:1001(1000) ack 1 win 450 <nop, nop, dss dack8=1 dsn8=1 ssn=1 dll=1000 nocs>
+0.0 > . 1:1(0) ack 1001 <dss dack8=1001 nocs>
Expand Down
3 changes: 1 addition & 2 deletions gtests/net/mptcp/syscalls/accept_v4.pkt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

// add_addr
+0.0 > . 1:1(0) ack 1 <nop, nop, TS val 4074418293 ecr 4074418292, add_address addr[saddr1] hmac=auto, dss dack4=1 dll=0 nocs>
// TODO: send echo bit
// +0.0 < . 1:1(0) ack 1 <nop, nop, TS val 4074418293 ecr 4074418292, add_address addr[saddr1], dss dack8=1 dll=0 nocs>
+0.0 < . 1:1(0) ack 1 <nop, nop, TS val 4074418293 ecr 4074418292, add_address addr[saddr1] addr_echo, dss dack8=1 dll=0 nocs>

+0.2 < P. 1:3(2) ack 1 win 256 <nop, nop, TS val 4074418292 ecr 4074410674, mpcapable v1 flags[flag_h] key[skey, ckey] mpcdatalen 2, nop, nop>
// MP_CAPABLE carrying data are acked with 64-bit, safer not knowing if the
Expand Down
1 change: 1 addition & 0 deletions gtests/net/packetdrill/lexer.l
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ backup return BACKUP;
mp_join_syn_ack return MP_JOIN_SYN_ACK;
mp_join_ack return MP_JOIN_ACK;
add_address return ADD_ADDRESS;
addr_echo return ADDR_ECHO;
port return PORT;
add_addr_ipv4 return ADD_ADDR_IPV4;
add_addr_ipv6 return ADD_ADDR_IPV6;
Expand Down
5 changes: 3 additions & 2 deletions gtests/net/packetdrill/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ struct tcp_option *dss_do_dsn_dack( int dack_type, int dack_val,
%token <reserved> DSS DACK4 DSN4 DACK8 DSN8 FIN SSN DLL NOCS CKSUM ADDR ADDRESS_ID BACKUP TOKEN AUTO RAND
%token <reserved> TRUNC_R64_HMAC TRUNC_R64_HMAC_SHA1 TRUNC_R64_HMAC_SHA256
%token <reserved> SENDER_HMAC TRUNC_L64_HMAC FULL_160_HMAC SHA1_32 SHA256_32 ADD_ADDR_HMAC
%token <reserved> ADD_ADDRESS ADD_ADDR_IPV4 ADD_ADDR_IPV6 PORT MP_FAIL
%token <reserved> ADD_ADDRESS ADD_ADDR_IPV4 ADD_ADDR_IPV6 PORT MP_FAIL ADDR_ECHO
%token <reserved> REMOVE_ADDRESS ADDRESSES_ID LIST_ID
%token <reserved> MP_PRIO
%token <reserved> MP_TCPRST
Expand Down Expand Up @@ -1953,7 +1953,8 @@ SENDER_HMAC '=' TRUNC_L64_HMAC '(' INTEGER ')' {
;

add_addr_hmac
: {
:
ADDR_ECHO {
$$.auto_conf = false;
$$.hash = UNDEFINED;
}
Expand Down

0 comments on commit 95cc57b

Please sign in to comment.