Skip to content

Commit

Permalink
Add initial coverage for RM_ADDR
Browse files Browse the repository at this point in the history
Link: multipath-tcp/mptcp_net-next#167
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
  • Loading branch information
dcaratti committed Mar 25, 2021
1 parent 652f730 commit 94e7247
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
37 changes: 37 additions & 0 deletions gtests/net/mptcp/remove_addr/remove_addr_client.pkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// connection initiated by the kernel
--tolerance_usecs=100000
`../common/defaults.sh`

+0 `../common/client.sh`

+0.0 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 3
+0.0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR)
+0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0

+0.0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress)
+0.0 > S 0:0(0) <mss 1460, sackOK, TS val 100 ecr 0, nop, wscale 8, mpcapable v1 flags[flag_h] nokey>
+0.0 < S. 0:0(0) ack 1 win 65535 <mss 1460, sackOK, TS val 700 ecr 100, nop, wscale 8, mpcapable v1 flags[flag_h] key[skey=2]>
+0.0 > . 1:1(0) ack 1 <nop, nop, TS val 100 ecr 700, mpcapable v1 flags[flag_h] key[ckey, skey]>

+0.200 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+0.205 fcntl(3, F_SETFL, O_RDWR) = 0 // set back to blocking

+0.01 write(3, ..., 100) = 100
+0.0 > P. 1:101(100) ack 1 <nop, nop, TS val 305 ecr 700, mpcapable v1 flags[flag_h] key[ckey, skey] mpcdatalen 100, nop, nop>


// explicit ACK then ADD_ADDR: on some slow env, injecting ADD_ADDR can take
// time, causing the host to retransmit its last data packet. Here we ensure
// this previous packet is acked then we can send the ADD_ADDR
+0.0 < . 1:1(0) ack 101 win 256 <nop, nop, TS val 705 ecr 305, dss dack8=101 dll=0 nocs>
+0.0 < . 1:1(0) ack 101 win 256 <nop, nop, TS val 705 ecr 305, add_address addr[saddr] hmac=auto>

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

// remove address
+0.0 < . 1:1(0) ack 101 win 256 <nop, nop, TS val 705 ecr 305, remove_address address_id=[1], dss dack8=101 dll=0 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>
28 changes: 28 additions & 0 deletions gtests/net/mptcp/remove_addr/remove_addr_server_v4.pkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// connection initiated by packetdrill
--tolerance_usecs=100000
`../common/defaults.sh`

+0 `ip mptcp endpoint flush`
+0 `ip mptcp endpoint add 198.51.100.2 id 10 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=10 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=10 addr[ep=inet_addr("198.51.100.2")] addr_echo, dss dack4=1 ssn=1 dll=0 nocs>

// remove address from the server
+0 `ip mptcp endpoint delete id 10`
+0 > . 1:1(0) ack 1 <remove_address address_id=[10], dss dack4=1 nocs>


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

+0 `ip mptcp endpoint flush`
+0 `ip mptcp endpoint add 2001:db8:1::1 id 10 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=10 addr[ep=inet6_addr("2001:db8:1::1")] hmac=auto>
+0 < . 1:1(0) ack 1 win 257 <add_address address_id=10 addr[ep=inet6_addr("2001:db8:1::1")] addr_echo>

// remove address from the server
+0 `ip mptcp endpoint delete id 10`
+0 > . 1:1(0) ack 1 <remove_address address_id=[10], dss dack4=1 nocs>


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

0 comments on commit 94e7247

Please sign in to comment.