Skip to content

Commit

Permalink
Merge pull request google#56 from dcaratti/add-addr-retry
Browse files Browse the repository at this point in the history
add coverage for ADD_ADDR retransmission
  • Loading branch information
dcaratti authored Sep 23, 2021
2 parents 40ca984 + c0c047a commit 809c23e
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
34 changes: 34 additions & 0 deletions gtests/net/mptcp/add_addr/add_addr_retry_v4.pkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// connection initiated by packetdrill
--tolerance_usecs=200000
`../common/defaults.sh`

+0 `sysctl -wq net.mptcp.add_addr_timeout=1`
+0 `../common/multi-ep.sh -e 1 -m signal`

+0 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0

+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+0 < S 0:0(0) win 32792 <mss 1460, sackOK, nop, nop, nop, wscale 7, mpcapable v1 flags[flag_h] nokey>
+0 > S. 0:0(0) ack 1 <mss 1460, nop, nop, sackOK, nop, wscale 8, mpcapable v1 flags[flag_h] key[skey]>
+0.01 < . 1:1(0) ack 1 win 257 <mpcapable v1 flags[flag_h] key[ckey=2, skey]>
+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 address_id=1 addr[saddr0] hmac=auto, dss dack4=1 ssn=1 dll=0 nocs>
// send echo with wrong address, expect a retry in 1s
+0 < . 1:1(0) ack 1 win 257 <add_address address_id=1 addr[ep=inet_addr("1.2.3.4")] addr_echo, dss dack4=1 ssn=1 dll=0 nocs>
+1.0 > . 1:1(0) ack 1 <add_address address_id=1 addr[saddr0] hmac=auto, dss dack4=1 ssn=1 dll=0 nocs>
// send echo with wrong id, expect a retry in 1s
+0 < . 1:1(0) ack 1 win 257 <add_address address_id=90 addr[saddr0] addr_echo>
+1.0 > . 1:1(0) ack 1 <add_address address_id=1 addr[saddr0] hmac=auto, dss dack4=1 ssn=1 dll=0 nocs>
// send echo with correct id, expect no retry
+0 < . 1:1(0) ack 1 win 257 <add_address address_id=1 addr[saddr0] addr_echo>
// read and ack 1 data segment
+1.1 < P. 1:1001(1000) ack 1 win 450 <nop, nop, dss dack8=1 dsn8=1 ssn=1 dll=1000 nocs>
+0 > . 1:1(0) ack 1001 <dss dack8=1001 ssn=1 dll=0 nocs>
+0.3 read(4, ..., 1000) = 1000

+0 close(4) = 0
+0 > . 1:1(0) ack 1001 <dss dack8=1001 dsn8=1 ssn=0 dll=1 nocs fin, nop, nop>
34 changes: 34 additions & 0 deletions gtests/net/mptcp/add_addr/add_addr_retry_v6.pkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// connection initiated by packetdrill
--tolerance_usecs=200000
`../common/defaults.sh`

+0 `sysctl -wq net.mptcp.add_addr_timeout=1`
+0 `../common/multi-ep.sh -e 1 -m signal`

+0 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0

+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+0 < S 0:0(0) win 32792 <mss 1460, sackOK, nop, nop, nop, wscale 7, mpcapable v1 flags[flag_h] nokey>
+0 > S. 0:0(0) ack 1 <mss 1460, nop, nop, sackOK, nop, wscale 8, mpcapable v1 flags[flag_h] key[skey]>
+0.01 < . 1:1(0) ack 1 win 257 <mpcapable v1 flags[flag_h] key[ckey=2, skey]>
+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 address_id=1 addr[saddr0] hmac=auto>
// send echo with wrong address, expect a retry in 1s
+0 < . 1:1(0) ack 1 win 257 <add_address address_id=1 addr[ep=inet6_addr("2001:db8::c1a0")] addr_echo>
+1.0 > . 1:1(0) ack 1 <add_address address_id=1 addr[saddr0] hmac=auto>
// send echo with wrong id, expect a retry in 1s
+0 < . 1:1(0) ack 1 win 257 <add_address address_id=90 addr[saddr0] addr_echo>
+1.0 > . 1:1(0) ack 1 <add_address address_id=1 addr[saddr0] hmac=auto>
// send echo with correct id, expect no retry
+0 < . 1:1(0) ack 1 win 257 <add_address address_id=1 addr[saddr0] addr_echo>
// read and ack 1 data segment
+1.1 < P. 1:1001(1000) ack 1 win 450 <nop, nop, dss dack8=1 dsn8=1 ssn=1 dll=1000 nocs>
+0 > . 1:1(0) ack 1001 <dss dack8=1001 ssn=1 dll=0 nocs>
+0.3 read(4, ..., 1000) = 1000

+0 close(4) = 0
+0 > . 1:1(0) ack 1001 <dss dack8=1001 dsn8=1 ssn=0 dll=1 nocs fin, nop, nop>

0 comments on commit 809c23e

Please sign in to comment.