mptcp: add support for ADD_ADDR "echo bit"

print "v1-echo" if the echo bit is set in the ADD_ADDR suboption (see
RFC8684 §3.4.1). While at it, dissect the 4 bits after the MPTCP option
subtype when the value is "ADD_ADDR" (0x3), according to protocol v0 and
v1. Add a selftest with a capture taken from a recent Linux kernel
implementation, and fix printout of add-addr in the existing selftests.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
This commit is contained in:
Davide Caratti 2020-09-28 21:39:43 +02:00 committed by Denis Ovsienko
parent 44a89a1d70
commit 19b771391a
6 changed files with 16 additions and 3 deletions

View File

@ -113,6 +113,13 @@ struct mp_dss {
#define MP_DSS_a 0x02
#define MP_DSS_A 0x01
static const struct tok mptcp_addr_subecho_bits[] = {
{ 0x6, "v0-ip6" },
{ 0x4, "v0-ip4" },
{ 0x1, "v1-echo" },
{ 0x0, "v1" }
};
struct mp_add_addr {
nd_uint8_t kind;
nd_uint8_t len;
@ -354,6 +361,9 @@ add_addr_print(netdissect_options *ndo,
opt_len == 20 || opt_len == 22 || opt_len == 28 || opt_len == 30))
return 0;
ND_PRINT(" %s",
tok2str(mptcp_addr_subecho_bits, "[bad version/echo]",
GET_U_1(add_addr->sub_echo) & 0xF));
ND_PRINT(" id %u", GET_U_1(add_addr->addr_id));
if (opt_len == 8 || opt_len == 10 || opt_len == 16 || opt_len == 18) {
ND_PRINT(" %s", GET_IPADDR_STRING(add_addr->u.v4.addr));

View File

@ -229,7 +229,8 @@ msnlb2 msnlb2.pcapng msnlb2.out
mptcp-v0 mptcp-v0.pcap mptcp-v0.out
mptcp-v1 mptcp-v1.pcap mptcp-v1.out
mptcp-fclose mptcp-fclose.pcap mptcp-fclose.out
mptcp-aa-v1 mptcp-aa-v1.pcap mptcp-aa-v1.out
mptcp-aa-v1 mptcp-aa-v1.pcap mptcp-aa-v1.out
mptcp-aa-echo mptcp-aa-echo.pcap mptcp-aa-echo.out
# TFO tests
tfo tfo-5c1fa7f9ae91.pcap tfo.out

2
tests/mptcp-aa-echo.out Normal file
View File

@ -0,0 +1,2 @@
1 11:02:20.402400 IP 10.0.1.1.10000 > 10.0.3.2.54737: Flags [.], ack 2863732622, win 510, options [nop,nop,TS val 2041598247 ecr 805948318,mptcp add-addr v1 id 1 10.0.2.1 hmac 0xf8295862f645df19,mptcp dss ack 3502078703], length 0
2 11:02:20.602589 IP 10.0.1.2.35924 > 10.0.1.1.10000: Flags [.], ack 2394667731, win 501, options [nop,nop,TS val 373322532 ecr 4275366718,mptcp add-addr v1-echo id 1 10.0.2.1,mptcp dss ack 17984156407873109865], length 0

BIN
tests/mptcp-aa-echo.pcap Normal file

Binary file not shown.

View File

@ -10,7 +10,7 @@
10 18:44:24.247920 IP 192.168.125.165.55555 > 192.168.125.212.52278: Flags [P.], seq 17:33, ack 17, win 509, options [nop,nop,TS val 938670368 ecr 2070300964,mptcp dss ack 17186763219675866581 seq 12148165319181844526 subseq 17 len 16,nop,nop], length 16
11 18:44:24.248383 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [.], ack 33, win 502, options [nop,nop,TS val 2070301169 ecr 938670368,mptcp dss ack 12148165319181844542], length 0
12 18:44:25.046480 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [P.], seq 17:33, ack 33, win 502, options [nop,nop,TS val 2070301967 ecr 938670368,mptcp dss ack 12148165319181844542 seq 17186763219675866581 subseq 17 len 16,nop,nop], length 16
13 18:44:25.046726 IP 192.168.125.165.55555 > 192.168.125.212.52278: Flags [.], ack 33, win 509, options [nop,nop,TS val 938671166 ecr 2070301967,mptcp add-addr id 1 192.168.136.225 hmac 0x669928744366716c,mptcp dss ack 17186763219675866581], length 0
13 18:44:25.046726 IP 192.168.125.165.55555 > 192.168.125.212.52278: Flags [.], ack 33, win 509, options [nop,nop,TS val 938671166 ecr 2070301967,mptcp add-addr v1 id 1 192.168.136.225 hmac 0x669928744366716c,mptcp dss ack 17186763219675866581], length 0
14 18:44:25.048465 IP 192.168.125.165.55555 > 192.168.125.212.52278: Flags [P.], seq 33:49, ack 33, win 509, options [nop,nop,TS val 938671168 ecr 2070301967,mptcp dss ack 17186763219675866597 seq 12148165319181844542 subseq 33 len 16,nop,nop], length 16
15 18:44:25.048568 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [.], ack 49, win 502, options [nop,nop,TS val 2070301969 ecr 938671168,mptcp dss ack 12148165319181844542], length 0
16 18:44:25.256088 IP 192.168.125.165.55555 > 192.168.125.212.52278: Flags [P.], seq 49:65, ack 33, win 509, options [nop,nop,TS val 938671376 ecr 2070301969,mptcp dss ack 17186763219675866597 seq 12148165319181844542 subseq 49 len 16,nop,nop], length 16

View File

@ -1,7 +1,7 @@
1 12:56:35.701161 IP 10.2.1.2.35961 > 10.1.1.2.22: Flags [S], seq 2912457561, win 14600, options [mss 1460,sackOK,TS val 4294943152 ecr 0,nop,wscale 6,mptcp capable v0 csum {0x9c9eabd1e46a33b2}], length 0
2 12:56:35.701661 IP 10.1.1.2.22 > 10.2.1.2.35961: Flags [S.], seq 125971326, ack 2912457562, win 14280, options [mss 1460,sackOK,TS val 4294943467 ecr 4294943152,nop,wscale 5,mptcp capable v0 csum {0x967d2770b6960552}], length 0
3 12:56:35.702022 IP 10.2.1.2.35961 > 10.1.1.2.22: Flags [.], ack 1, win 229, options [nop,nop,TS val 4294943152 ecr 4294943467,mptcp capable v0 csum {0x9c9eabd1e46a33b2,0x967d2770b6960552}], length 0
4 12:56:35.786074 IP 10.1.1.2.22 > 10.2.1.2.35961: Flags [P.], seq 1:42, ack 1, win 447, options [nop,nop,TS val 4294943474 ecr 4294943152,mptcp add-addr id 1 10.1.2.2,mptcp dss ack 3576348362 seq 3518592144 subseq 1 len 41 csum 0x82f], length 41: SSH: SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze1
4 12:56:35.786074 IP 10.1.1.2.22 > 10.2.1.2.35961: Flags [P.], seq 1:42, ack 1, win 447, options [nop,nop,TS val 4294943474 ecr 4294943152,mptcp add-addr v0-ip4 id 1 10.1.2.2,mptcp dss ack 3576348362 seq 3518592144 subseq 1 len 41 csum 0x82f], length 41: SSH: SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze1
5 12:56:35.786240 IP 10.2.1.2.35961 > 10.1.1.2.22: Flags [.], ack 42, win 229, options [nop,nop,TS val 4294943168 ecr 4294943474,mptcp dss ack 3518592185], length 0
6 12:56:35.787634 IP 10.2.1.2.35961 > 10.1.1.2.22: Flags [P.], seq 1:42, ack 42, win 229, options [nop,nop,TS val 4294943168 ecr 4294943474,mptcp dss ack 3518592185 seq 3576348362 subseq 1 len 41 csum 0x45c9], length 41: SSH: SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze2
7 12:56:35.787786 IP 10.1.1.2.22 > 10.2.1.2.35961: Flags [.], ack 42, win 447, options [nop,nop,TS val 4294943474 ecr 4294943168,mptcp dss ack 3576348403], length 0