]> The Tcpdump Group git mirrors - tcpdump/commitdiff
MPTCP: parse v1 ADD_ADDR option
authorPeter Krystad <[email protected]>
Thu, 27 Feb 2020 18:55:51 +0000 (10:55 -0800)
committerfxlb <[email protected]>
Mon, 2 Mar 2020 10:26:30 +0000 (11:26 +0100)
RFC6824bis-18 (MPTCP version 1) makes changes to the MPTCP
ADD_ADDR option format.

An HMAC field is added to the option and the IP version field is
removed and replaced with an Echo bit that provides a reliability
mechanism.

This change allows either v0 or v1 ADD_ADDR options
to be parsed and displayed correctly.

Signed-off-by: Peter Krystad <[email protected]>
print-mptcp.c
tests/TESTLIST
tests/mptcp-aa-v1.out [new file with mode: 0644]
tests/mptcp-aa-v1.pcap [new file with mode: 0644]

index 43258e5062f824b34474c0527e9605dc838a7fb9..c2d61e1590ec9f2aa38cd83f70d9a6196b622e61 100644 (file)
@@ -116,22 +116,30 @@ struct mp_dss {
 struct mp_add_addr {
         nd_uint8_t     kind;
         nd_uint8_t     len;
-        nd_uint8_t     sub_ipver;
+        nd_uint8_t     sub_echo;
         nd_uint8_t     addr_id;
         union {
                 struct {
                         nd_ipv4         addr;
                         nd_uint16_t     port;
+                        nd_uint64_t     mac;
                 } v4;
+                struct {
+                        nd_ipv4         addr;
+                        nd_uint64_t     mac;
+                } v4np;
                 struct {
                         nd_ipv6         addr;
                         nd_uint16_t     port;
+                        nd_uint64_t     mac;
                 } v6;
+                struct {
+                        nd_ipv6         addr;
+                        nd_uint64_t     mac;
+                } v6np;
         } u;
 };
 
-#define MP_ADD_ADDR_IPVER(sub_ipver)    ((GET_U_1(sub_ipver) >> 0) & 0xF)
-
 struct mp_remove_addr {
         nd_uint8_t     kind;
         nd_uint8_t     len;
@@ -341,26 +349,30 @@ add_addr_print(netdissect_options *ndo,
                const u_char *opt, u_int opt_len, u_char flags _U_)
 {
         const struct mp_add_addr *add_addr = (const struct mp_add_addr *) opt;
-        u_int ipver = MP_ADD_ADDR_IPVER(add_addr->sub_ipver);
 
-        if (!((opt_len == 8 || opt_len == 10) && ipver == 4) &&
-            !((opt_len == 20 || opt_len == 22) && ipver == 6))
+        if (!(opt_len == 8 || opt_len == 10 || opt_len == 16 || opt_len == 18 ||
+            opt_len == 20 || opt_len == 22 || opt_len == 28 || opt_len == 30))
                 return 0;
 
         ND_PRINT(" id %u", GET_U_1(add_addr->addr_id));
-        switch (ipver) {
-        case 4:
+        if (opt_len == 8 || opt_len == 10 || opt_len == 16 || opt_len == 18) {
                 ND_PRINT(" %s", GET_IPADDR_STRING(add_addr->u.v4.addr));
-                if (opt_len == 10)
+                if (opt_len == 10 || opt_len == 18)
                         ND_PRINT(":%u", GET_BE_U_2(add_addr->u.v4.port));
-                break;
-        case 6:
+                if (opt_len == 16)
+                        ND_PRINT(" hmac 0x%" PRIx64, GET_BE_U_8(add_addr->u.v4np.mac));
+                if (opt_len == 18)
+                        ND_PRINT(" hmac 0x%" PRIx64, GET_BE_U_8(add_addr->u.v4.mac));
+        }
+
+        if (opt_len == 20 || opt_len == 22 || opt_len == 28 || opt_len == 30) {
                 ND_PRINT(" %s", GET_IP6ADDR_STRING(add_addr->u.v6.addr));
-                if (opt_len == 22)
+                if (opt_len == 22 || opt_len == 30)
                         ND_PRINT(":%u", GET_BE_U_2(add_addr->u.v6.port));
-                break;
-        default:
-                return 0;
+                if (opt_len == 28)
+                        ND_PRINT(" hmac 0x%" PRIx64, GET_BE_U_8(add_addr->u.v6np.mac));
+                if (opt_len == 30)
+                        ND_PRINT(" hmac 0x%" PRIx64, GET_BE_U_8(add_addr->u.v6.mac));
         }
 
         return 1;
index efb35a5f515e51229760eafe22db977999edcb0e..b39b376d82c3ee169be97abe670f4a5d614dd677 100644 (file)
@@ -222,6 +222,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
+
 # TFO tests
 tfo            tfo-5c1fa7f9ae91.pcap   tfo.out
 # SCPS
diff --git a/tests/mptcp-aa-v1.out b/tests/mptcp-aa-v1.out
new file mode 100644 (file)
index 0000000..3fe5bf1
--- /dev/null
@@ -0,0 +1,24 @@
+    1  18:44:15.949492 IP 192.168.125.165.43428 > 192.168.125.1.53: 61359+ A? proxy-chain.intel.com.network2. (48)
+    2  18:44:15.949675 IP 192.168.125.165.43428 > 192.168.125.1.53: 30665+ AAAA? proxy-chain.intel.com.network2. (48)
+    3  18:44:24.039044 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [S], seq 653223703, win 64240, options [mss 1460,sackOK,TS val 2070300959 ecr 0,nop,wscale 7,mptcp capable v1], length 0
+    4  18:44:24.039622 IP 192.168.125.165.55555 > 192.168.125.212.52278: Flags [S.], seq 3797229782, ack 653223704, win 65160, options [mss 1460,sackOK,TS val 938670159 ecr 2070300959,nop,wscale 7,mptcp capable v1 {0x73bb150358a0aecb}], length 0
+    5  18:44:24.039910 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [.], ack 1, win 502, options [nop,nop,TS val 2070300960 ecr 938670159,mptcp capable v1 {0x8f0c7c64a6a32ac1,0x73bb150358a0aecb}], length 0
+    6  18:44:24.042337 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [P.], seq 1:17, ack 1, win 502, options [nop,nop,TS val 2070300963 ecr 938670159,mptcp capable v1 {0x8f0c7c64a6a32ac1,0x73bb150358a0aecb},nop,nop], length 16
+    7  18:44:24.042622 IP 192.168.125.165.55555 > 192.168.125.212.52278: Flags [.], ack 17, win 509, options [nop,nop,TS val 938670162 ecr 2070300963,mptcp dss ack 17186763219675866565], length 0
+    8  18:44:24.043277 IP 192.168.125.165.55555 > 192.168.125.212.52278: Flags [P.], seq 1:17, ack 17, win 509, options [nop,nop,TS val 938670163 ecr 2070300963,mptcp dss ack 17186763219675866581 seq 12148165319181844526 subseq 1 len 16,nop,nop], length 16
+    9  18:44:24.043512 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [.], ack 17, win 502, options [nop,nop,TS val 2070300964 ecr 938670163,mptcp dss ack 12148165319181844526], length 0
+   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
+   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
+   17  18:44:25.256361 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [.], ack 65, win 502, options [nop,nop,TS val 2070302177 ecr 938671376,mptcp dss ack 12148165319181844558], length 0
+   18  18:44:26.048795 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [P.], seq 33:49, ack 65, win 502, options [nop,nop,TS val 2070302969 ecr 938671376,mptcp dss ack 12148165319181844558 seq 17186763219675866597 subseq 33 len 16,nop,nop], length 16
+   19  18:44:26.049014 IP 192.168.125.165.55555 > 192.168.125.212.52278: Flags [.], ack 49, win 509, options [nop,nop,TS val 938672169 ecr 2070302969,mptcp dss ack 17186763219675866597], length 0
+   20  18:44:26.049644 IP 192.168.125.165.55555 > 192.168.125.212.52278: Flags [P.], seq 65:81, ack 49, win 509, options [nop,nop,TS val 938672169 ecr 2070302969,mptcp dss ack 17186763219675866613 seq 12148165319181844558 subseq 65 len 16,nop,nop], length 16
+   21  18:44:26.049972 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [.], ack 81, win 502, options [nop,nop,TS val 2070302970 ecr 938672169,mptcp dss ack 12148165319181844558], length 0
+   22  18:44:26.049982 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [F.], seq 49, ack 81, win 502, options [nop,nop,TS val 2070302970 ecr 938672169,mptcp dss fin ack 12148165319181844574 seq 17186763219675866613 subseq 0 len 1,nop,nop], length 0
+   23  18:44:26.050692 IP 192.168.125.165.55555 > 192.168.125.212.52278: Flags [F.], seq 81, ack 50, win 509, options [nop,nop,TS val 938672171 ecr 2070302970,mptcp dss fin ack 17186763219675866613 seq 12148165319181844574 subseq 0 len 1,nop,nop], length 0
+   24  18:44:26.050757 IP 192.168.125.212.52278 > 192.168.125.165.55555: Flags [.], ack 82, win 502, options [nop,nop,TS val 2070302971 ecr 938672171,mptcp dss ack 12148165319181844574], length 0
diff --git a/tests/mptcp-aa-v1.pcap b/tests/mptcp-aa-v1.pcap
new file mode 100644 (file)
index 0000000..658887c
Binary files /dev/null and b/tests/mptcp-aa-v1.pcap differ