Skip to content

Commit 578dd31

Browse files
Gregory Detalmcr
authored andcommitted
Multipath TCP (RFC 6824) support
This commit adds the support of Multipath TCP (MPTCP). MPTCP is a new extension to TCP standardized at the IETF. MPTCP allows to use several IP addresses at the same time by distributing data across several subflows (TCP connections) while still presenting the standard TCP socket API to the application. Its benefits are better resource utilization, better throughput and smoother reaction to failures.
1 parent a248bf0 commit 578dd31

File tree

11 files changed

+706
-2
lines changed

11 files changed

+706
-2
lines changed

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ CSRC = addrtoname.c af.c checksum.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c
8383
print-ipx.c print-isoclns.c print-juniper.c print-krb.c \
8484
print-l2tp.c print-lane.c print-ldp.c print-lldp.c print-llc.c \
8585
print-lmp.c print-lspping.c print-lwapp.c \
86-
print-lwres.c print-mobile.c print-mpcp.c print-mpls.c print-msdp.c \
86+
print-lwres.c print-mobile.c print-mpcp.c print-mpls.c print-mptcp.c print-msdp.c \
8787
print-msnlb.c print-nfs.c print-ntp.c print-null.c print-olsr.c print-ospf.c \
8888
print-pgm.c print-pim.c \
8989
print-ppi.c print-ppp.c print-pppoe.c print-pptp.c \

interface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ extern void hsrp_print(const u_char *, u_int);
321321
extern void bfd_print(const u_char *, u_int, u_int);
322322
extern void sip_print(const u_char *, u_int);
323323
extern void syslog_print(const u_char *, u_int);
324+
extern int mptcp_print(const u_char *, u_int);
324325
extern u_int bt_if_print(const struct pcap_pkthdr *, const u_char *);
325326
extern u_int usb_linux_48_byte_print(const struct pcap_pkthdr *, const u_char *);
326327
extern u_int usb_linux_64_byte_print(const struct pcap_pkthdr *, const u_char *);

mptcp.h

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
/**
2+
* Copyright (c) 2012
3+
*
4+
* Gregory Detal <gregory.detal@uclouvain.be>
5+
* Christoph Paasch <christoph.paasch@uclouvain.be>
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions
9+
* are met:
10+
*
11+
* 1. Redistributions of source code must retain the above copyright
12+
* notice, this list of conditions and the following disclaimer.
13+
*
14+
* 2. Redistributions in binary form must reproduce the above copyright
15+
* notice, this list of conditions and the following disclaimer in the
16+
* documentation and/or other materials provided with the distribution.
17+
*
18+
* 3. Neither the name of the University nor of the Laboratory may be used
19+
* to endorse or promote products derived from this software without
20+
* specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32+
* SUCH DAMAGE.
33+
*/
34+
35+
#define MPTCP_SUB_CAPABLE 0x0
36+
#define MPTCP_SUB_JOIN 0x1
37+
#define MPTCP_SUB_DSS 0x2
38+
#define MPTCP_SUB_ADD_ADDR 0x3
39+
#define MPTCP_SUB_REMOVE_ADDR 0x4
40+
#define MPTCP_SUB_PRIO 0x5
41+
#define MPTCP_SUB_FAIL 0x6
42+
#define MPTCP_SUB_FCLOSE 0x7
43+
44+
45+
struct mptcp_option {
46+
u_int8_t kind;
47+
u_int8_t len;
48+
#if !LBL_ALIGN
49+
u_int8_t ver:4,
50+
sub:4;
51+
#else
52+
u_int8_t sub:4,
53+
ver:4;
54+
#endif
55+
};
56+
57+
struct mp_capable {
58+
u_int8_t kind;
59+
u_int8_t len;
60+
#if !LBL_ALIGN
61+
u_int8_t ver:4,
62+
sub:4;
63+
u_int8_t s:1,
64+
rsv:6,
65+
c:1;
66+
#else
67+
u_int8_t sub:4,
68+
ver:4;
69+
u_int8_t c:1,
70+
rsv:6,
71+
s:1;
72+
#endif
73+
u_int64_t sender_key;
74+
u_int64_t receiver_key;
75+
} __attribute__((__packed__));
76+
77+
struct mp_join {
78+
u_int8_t kind;
79+
u_int8_t len;
80+
#if !LBL_ALIGN
81+
u_int8_t b:1,
82+
rsv:3,
83+
sub:4;
84+
#else
85+
u_int8_t sub:4,
86+
rsv:3,
87+
b:1;
88+
#endif
89+
u_int8_t addr_id;
90+
union {
91+
struct {
92+
u_int32_t token;
93+
u_int32_t nonce;
94+
} syn;
95+
struct {
96+
u_int64_t mac;
97+
u_int32_t nonce;
98+
} synack;
99+
struct {
100+
u_int8_t mac[20];
101+
} ack;
102+
} u;
103+
} __attribute__((__packed__));
104+
105+
struct mp_dss {
106+
u_int8_t kind;
107+
u_int8_t len;
108+
#if !LBL_ALIGN
109+
u_int16_t rsv1:4,
110+
sub:4,
111+
A:1,
112+
a:1,
113+
M:1,
114+
m:1,
115+
F:1,
116+
rsv2:3;
117+
#else
118+
u_int16_t sub:4,
119+
rsv1:4,
120+
rsv2:3,
121+
F:1,
122+
m:1,
123+
M:1,
124+
a:1,
125+
A:1;
126+
#endif
127+
};
128+
129+
struct mp_add_addr {
130+
u_int8_t kind;
131+
u_int8_t len;
132+
#if !LBL_ALIGN
133+
u_int8_t ipver:4,
134+
sub:4;
135+
#else
136+
u_int8_t sub:4,
137+
ipver:4;
138+
#endif
139+
u_int8_t addr_id;
140+
union {
141+
struct {
142+
struct in_addr addr;
143+
u_int16_t port;
144+
} v4;
145+
struct {
146+
struct in6_addr addr;
147+
u_int16_t port;
148+
} v6;
149+
} u;
150+
} __attribute__((__packed__));
151+
152+
struct mp_remove_addr {
153+
u_int8_t kind;
154+
u_int8_t len;
155+
#if !LBL_ALIGN
156+
u_int8_t rsv:4,
157+
sub:4;
158+
#else
159+
u_int8_t sub:4,
160+
rsv:4;
161+
#endif
162+
/* list of addr_id */
163+
u_int8_t addrs_id;
164+
};
165+
166+
struct mp_fail {
167+
u_int8_t kind;
168+
u_int8_t len;
169+
#if !LBL_ALIGN
170+
u_int16_t rsv1:4,
171+
sub:4,
172+
rsv2:8;
173+
#else
174+
u_int16_t sub:4,
175+
rsv1:4,
176+
rsv2:8;
177+
#endif
178+
u_int64_t data_seq;
179+
} __attribute__((__packed__));
180+
181+
struct mp_fclose {
182+
u_int8_t kind;
183+
u_int8_t len;
184+
#if !LBL_ALIGN
185+
u_int16_t rsv1:4,
186+
sub:4,
187+
rsv2:8;
188+
#else
189+
u_int16_t sub:4,
190+
rsv1:4,
191+
rsv2:8;
192+
#endif
193+
u_int64_t key;
194+
} __attribute__((__packed__));
195+
196+
struct mp_prio {
197+
u_int8_t kind;
198+
u_int8_t len;
199+
#if !LBL_ALIGN
200+
u_int8_t b:1,
201+
rsv:3,
202+
sub:4;
203+
#else
204+
u_int8_t sub:4,
205+
rsv:3,
206+
b:1;
207+
#endif
208+
u_int8_t addr_id;
209+
} __attribute__((__packed__));
210+

0 commit comments

Comments
 (0)