xref: /xnu-10002.81.5/bsd/netinet/mptcp.h (revision 5e3eaea39dcf651e66cb99ba7d70e32cc4a99587)
1*5e3eaea3SApple OSS Distributions /*
2*5e3eaea3SApple OSS Distributions  * Copyright (c) 2012-2017 Apple Inc. All rights reserved.
3*5e3eaea3SApple OSS Distributions  *
4*5e3eaea3SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*5e3eaea3SApple OSS Distributions  *
6*5e3eaea3SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*5e3eaea3SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*5e3eaea3SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*5e3eaea3SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*5e3eaea3SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*5e3eaea3SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*5e3eaea3SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*5e3eaea3SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*5e3eaea3SApple OSS Distributions  *
15*5e3eaea3SApple OSS Distributions  * Please obtain a copy of the License at
16*5e3eaea3SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*5e3eaea3SApple OSS Distributions  *
18*5e3eaea3SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*5e3eaea3SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*5e3eaea3SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*5e3eaea3SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*5e3eaea3SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*5e3eaea3SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*5e3eaea3SApple OSS Distributions  * limitations under the License.
25*5e3eaea3SApple OSS Distributions  *
26*5e3eaea3SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*5e3eaea3SApple OSS Distributions  */
28*5e3eaea3SApple OSS Distributions 
29*5e3eaea3SApple OSS Distributions #ifndef _NETINET_MPTCP_H_
30*5e3eaea3SApple OSS Distributions #define _NETINET_MPTCP_H_
31*5e3eaea3SApple OSS Distributions 
32*5e3eaea3SApple OSS Distributions #ifdef BSD_KERNEL_PRIVATE
33*5e3eaea3SApple OSS Distributions 
34*5e3eaea3SApple OSS Distributions #include <machine/endian.h>
35*5e3eaea3SApple OSS Distributions 
36*5e3eaea3SApple OSS Distributions #include <libkern/crypto/sha1.h>
37*5e3eaea3SApple OSS Distributions 
38*5e3eaea3SApple OSS Distributions #if BYTE_ORDER == BIG_ENDIAN
39*5e3eaea3SApple OSS Distributions #define mptcp_hton64(x)  (x)
40*5e3eaea3SApple OSS Distributions #define mptcp_ntoh64(x)  (x)
41*5e3eaea3SApple OSS Distributions #else /* LITTLE_ENDIAN */
42*5e3eaea3SApple OSS Distributions #define mptcp_hton64(x)  __DARWIN_OSSwapInt64(x)
43*5e3eaea3SApple OSS Distributions #define mptcp_ntoh64(x)  __DARWIN_OSSwapInt64(x)
44*5e3eaea3SApple OSS Distributions #endif
45*5e3eaea3SApple OSS Distributions #include <netinet/mptcp_var.h>
46*5e3eaea3SApple OSS Distributions 
47*5e3eaea3SApple OSS Distributions /* Preferred MPTCP version to use when version discovery info is incomplete */
48*5e3eaea3SApple OSS Distributions extern int mptcp_preferred_version;
49*5e3eaea3SApple OSS Distributions 
50*5e3eaea3SApple OSS Distributions /*
51*5e3eaea3SApple OSS Distributions  * MPTCP Option Subtype Field values
52*5e3eaea3SApple OSS Distributions  */
53*5e3eaea3SApple OSS Distributions #define MPO_CAPABLE     0x0
54*5e3eaea3SApple OSS Distributions #define MPO_JOIN        0x1
55*5e3eaea3SApple OSS Distributions #define MPO_DSS         0x2
56*5e3eaea3SApple OSS Distributions #define MPO_ADD_ADDR    0x3
57*5e3eaea3SApple OSS Distributions #define MPO_REMOVE_ADDR 0x4
58*5e3eaea3SApple OSS Distributions #define MPO_PRIO        0x5
59*5e3eaea3SApple OSS Distributions #define MPO_FAIL        0x6
60*5e3eaea3SApple OSS Distributions #define MPO_FASTCLOSE   0x7
61*5e3eaea3SApple OSS Distributions 
62*5e3eaea3SApple OSS Distributions /* MPTCP Protocol version */
63*5e3eaea3SApple OSS Distributions #define MPTCP_VERSION_0     0x0
64*5e3eaea3SApple OSS Distributions #define MPTCP_VERSION_1     0x1
65*5e3eaea3SApple OSS Distributions 
66*5e3eaea3SApple OSS Distributions /*
67*5e3eaea3SApple OSS Distributions  * MPTCP MP_CAPABLE TCP Option definitions
68*5e3eaea3SApple OSS Distributions  *
69*5e3eaea3SApple OSS Distributions  * Used to establish an MPTCP connection and first subflow.
70*5e3eaea3SApple OSS Distributions  */
71*5e3eaea3SApple OSS Distributions struct mptcp_mpcapable_opt_common {
72*5e3eaea3SApple OSS Distributions 	uint8_t        mmco_kind;
73*5e3eaea3SApple OSS Distributions 	uint8_t        mmco_len;
74*5e3eaea3SApple OSS Distributions #if BYTE_ORDER == LITTLE_ENDIAN
75*5e3eaea3SApple OSS Distributions 	uint8_t        mmco_version:4,
76*5e3eaea3SApple OSS Distributions 	    mmco_subtype:4;
77*5e3eaea3SApple OSS Distributions #else /* BIG_ENDIAN */
78*5e3eaea3SApple OSS Distributions 	uint8_t        mmco_subtype:4,
79*5e3eaea3SApple OSS Distributions 	    mmco_version:4;
80*5e3eaea3SApple OSS Distributions #endif
81*5e3eaea3SApple OSS Distributions #define MPCAP_PROPOSAL_SBIT     0x01    /* SHA1 (v0) or SHA256 (v1) Algorithm */
82*5e3eaea3SApple OSS Distributions #define MPCAP_GBIT              0x02    /* must be 0 */
83*5e3eaea3SApple OSS Distributions #define MPCAP_FBIT              0x04    /* must be 0 */
84*5e3eaea3SApple OSS Distributions #define MPCAP_EBIT              0x08    /* must be 0 */
85*5e3eaea3SApple OSS Distributions #define MPCAP_DBIT              0x10    /* must be 0 */
86*5e3eaea3SApple OSS Distributions #define MPCAP_UNICAST_IPBIT     0x20    /* Should MPTCP only use ADD_ADDR IPs for new subflows */
87*5e3eaea3SApple OSS Distributions #define MPCAP_BBIT              0x40    /* Extensibility bit, must be 0 */
88*5e3eaea3SApple OSS Distributions #define MPCAP_CHECKSUM_CBIT     0x80    /* DSS Checksum bit */
89*5e3eaea3SApple OSS Distributions 	uint8_t        mmco_flags;
90*5e3eaea3SApple OSS Distributions } __attribute__((__packed__));
91*5e3eaea3SApple OSS Distributions 
92*5e3eaea3SApple OSS Distributions struct mptcp_mpcapable_opt_rsp {
93*5e3eaea3SApple OSS Distributions 	struct mptcp_mpcapable_opt_common mmc_common;
94*5e3eaea3SApple OSS Distributions 	mptcp_key_t mmc_localkey;
95*5e3eaea3SApple OSS Distributions } __attribute__((__packed__));
96*5e3eaea3SApple OSS Distributions 
97*5e3eaea3SApple OSS Distributions struct mptcp_mpcapable_opt_rsp1 {
98*5e3eaea3SApple OSS Distributions 	struct mptcp_mpcapable_opt_common mmc_common;
99*5e3eaea3SApple OSS Distributions 	mptcp_key_t mmc_localkey;
100*5e3eaea3SApple OSS Distributions 	mptcp_key_t mmc_remotekey;
101*5e3eaea3SApple OSS Distributions } __attribute__((__packed__));
102*5e3eaea3SApple OSS Distributions 
103*5e3eaea3SApple OSS Distributions struct mptcp_mpcapable_opt_rsp2 {
104*5e3eaea3SApple OSS Distributions 	struct mptcp_mpcapable_opt_rsp1 mmc_rsp1;
105*5e3eaea3SApple OSS Distributions 	uint16_t data_len;
106*5e3eaea3SApple OSS Distributions 	uint16_t csum;
107*5e3eaea3SApple OSS Distributions } __attribute__((__packed__));
108*5e3eaea3SApple OSS Distributions 
109*5e3eaea3SApple OSS Distributions /*
110*5e3eaea3SApple OSS Distributions  * MPTCP MP_JOIN TCP Option definitions
111*5e3eaea3SApple OSS Distributions  *
112*5e3eaea3SApple OSS Distributions  * Used to add subflows to an existing MP_CAPABLE connection.
113*5e3eaea3SApple OSS Distributions  */
114*5e3eaea3SApple OSS Distributions 
115*5e3eaea3SApple OSS Distributions /* MP_JOIN Option for SYN */
116*5e3eaea3SApple OSS Distributions struct mptcp_mpjoin_opt_req {
117*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_kind;
118*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_len;
119*5e3eaea3SApple OSS Distributions #define MPTCP_BACKUP    0x1
120*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_subtype_bkp;
121*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_addr_id;
122*5e3eaea3SApple OSS Distributions 	uint32_t       mmjo_peer_token;
123*5e3eaea3SApple OSS Distributions 	uint32_t       mmjo_rand;
124*5e3eaea3SApple OSS Distributions } __attribute__((__packed__));
125*5e3eaea3SApple OSS Distributions 
126*5e3eaea3SApple OSS Distributions /* MP_JOIN Option for SYN/ACK */
127*5e3eaea3SApple OSS Distributions struct mptcp_mpjoin_opt_rsp {
128*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_kind;
129*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_len;
130*5e3eaea3SApple OSS Distributions #define MPTCP_BACKUP    0x1
131*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_subtype_bkp;
132*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_addr_id;
133*5e3eaea3SApple OSS Distributions 	uint64_t       mmjo_mac; /* Truncated message auth code */
134*5e3eaea3SApple OSS Distributions 	uint32_t       mmjo_rand;
135*5e3eaea3SApple OSS Distributions } __attribute__((__packed__));
136*5e3eaea3SApple OSS Distributions 
137*5e3eaea3SApple OSS Distributions /* MP_Join Option for ACK */
138*5e3eaea3SApple OSS Distributions struct mptcp_mpjoin_opt_rsp2 {
139*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_kind;
140*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_len;
141*5e3eaea3SApple OSS Distributions #if BYTE_ORDER == LITTLE_ENDIAN
142*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_reserved1:4,
143*5e3eaea3SApple OSS Distributions 	    mmjo_subtype:4;
144*5e3eaea3SApple OSS Distributions #else /* BIG_ENDIAN */
145*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_subtype:4,
146*5e3eaea3SApple OSS Distributions 	    mmjo_reserved1:4;
147*5e3eaea3SApple OSS Distributions #endif
148*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_reserved2;
149*5e3eaea3SApple OSS Distributions 	uint8_t        mmjo_mac[HMAC_TRUNCATED_ACK]; /* This is 160 bits HMAC per RFC */
150*5e3eaea3SApple OSS Distributions } __attribute__((__packed__));
151*5e3eaea3SApple OSS Distributions 
152*5e3eaea3SApple OSS Distributions /* Remove Address Option */
153*5e3eaea3SApple OSS Distributions struct mptcp_remaddr_opt {
154*5e3eaea3SApple OSS Distributions 	uint8_t        mr_kind;
155*5e3eaea3SApple OSS Distributions 	uint8_t        mr_len;
156*5e3eaea3SApple OSS Distributions #if BYTE_ORDER == LITTLE_ENDIAN
157*5e3eaea3SApple OSS Distributions 	uint8_t        mr_rest:4,
158*5e3eaea3SApple OSS Distributions 	    mr_subtype:4;
159*5e3eaea3SApple OSS Distributions #else /* BIG_ENDIAN */
160*5e3eaea3SApple OSS Distributions 	uint8_t        mr_subtype:4,
161*5e3eaea3SApple OSS Distributions 	    mr_rest:4;
162*5e3eaea3SApple OSS Distributions #endif
163*5e3eaea3SApple OSS Distributions 	uint8_t        mr_addr_id;
164*5e3eaea3SApple OSS Distributions } __attribute__((__packed__));
165*5e3eaea3SApple OSS Distributions 
166*5e3eaea3SApple OSS Distributions /*
167*5e3eaea3SApple OSS Distributions  * MPTCP Data Sequence Signal (DSS) TCP Options
168*5e3eaea3SApple OSS Distributions  *
169*5e3eaea3SApple OSS Distributions  * Used to map subflow sequence space to MPTCP data sequence space.
170*5e3eaea3SApple OSS Distributions  * Used to send Data ACKs
171*5e3eaea3SApple OSS Distributions  */
172*5e3eaea3SApple OSS Distributions 
173*5e3eaea3SApple OSS Distributions /*
174*5e3eaea3SApple OSS Distributions  * DSS Option variants coded as flags in the DSS option flags field
175*5e3eaea3SApple OSS Distributions  */
176*5e3eaea3SApple OSS Distributions #define MDSS_A 0x01     /* Data ACK present if set */
177*5e3eaea3SApple OSS Distributions #define MDSS_a 0x02     /* 64-bit Data ACK present if set */
178*5e3eaea3SApple OSS Distributions #define MDSS_M 0x04     /* Data Sequence Number present if set */
179*5e3eaea3SApple OSS Distributions #define MDSS_m 0x08     /* 64-bit Data Sequence Number present if set */
180*5e3eaea3SApple OSS Distributions #define MDSS_F 0x10     /* Data FIN present */
181*5e3eaea3SApple OSS Distributions 
182*5e3eaea3SApple OSS Distributions /* DSS fields common to all DSS option variants */
183*5e3eaea3SApple OSS Distributions struct mptcp_dss_copt {
184*5e3eaea3SApple OSS Distributions 	uint8_t        mdss_kind;
185*5e3eaea3SApple OSS Distributions 	uint8_t        mdss_len;
186*5e3eaea3SApple OSS Distributions #if BYTE_ORDER == LITTLE_ENDIAN
187*5e3eaea3SApple OSS Distributions 	uint8_t        mdss_reserved1:4,
188*5e3eaea3SApple OSS Distributions 	    mdss_subtype:4;
189*5e3eaea3SApple OSS Distributions #else /* BIG_ENDIAN */
190*5e3eaea3SApple OSS Distributions 	uint8_t        mdss_subtype:4,
191*5e3eaea3SApple OSS Distributions 	    mdss_reserved1:4;
192*5e3eaea3SApple OSS Distributions #endif
193*5e3eaea3SApple OSS Distributions 	uint8_t        mdss_flags;
194*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
195*5e3eaea3SApple OSS Distributions 
196*5e3eaea3SApple OSS Distributions /* 32-bit DSS option */
197*5e3eaea3SApple OSS Distributions struct mptcp_dsn_opt {
198*5e3eaea3SApple OSS Distributions 	struct mptcp_dss_copt   mdss_copt;
199*5e3eaea3SApple OSS Distributions 	uint32_t       mdss_dsn;               /* Data Sequence Number */
200*5e3eaea3SApple OSS Distributions 	uint32_t       mdss_subflow_seqn;      /* Relative Subflow Seq Num */
201*5e3eaea3SApple OSS Distributions 	uint16_t       mdss_data_len;          /* Data Length */
202*5e3eaea3SApple OSS Distributions 	/* uint16_t	mdss_xsum; */		/* Data checksum - optional */
203*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
204*5e3eaea3SApple OSS Distributions 
205*5e3eaea3SApple OSS Distributions /* 64-bit DSS option */
206*5e3eaea3SApple OSS Distributions struct mptcp_dsn64_opt {
207*5e3eaea3SApple OSS Distributions 	struct mptcp_dss_copt   mdss_copt;
208*5e3eaea3SApple OSS Distributions 	uint64_t       mdss_dsn;               /* Data Sequence Number */
209*5e3eaea3SApple OSS Distributions 	uint32_t       mdss_subflow_seqn;      /* Relative Subflow Seq Num */
210*5e3eaea3SApple OSS Distributions 	uint16_t       mdss_data_len;          /* Data Length */
211*5e3eaea3SApple OSS Distributions 	/* uint16_t	mdss_xsum; */		/* Data checksum - optional */
212*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
213*5e3eaea3SApple OSS Distributions 
214*5e3eaea3SApple OSS Distributions /* 32-bit DSS Data ACK option */
215*5e3eaea3SApple OSS Distributions struct mptcp_data_ack_opt {
216*5e3eaea3SApple OSS Distributions 	struct mptcp_dss_copt   mdss_copt;
217*5e3eaea3SApple OSS Distributions 	uint32_t               mdss_ack;
218*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
219*5e3eaea3SApple OSS Distributions 
220*5e3eaea3SApple OSS Distributions /* 64-bit DSS Data ACK option */
221*5e3eaea3SApple OSS Distributions struct mptcp_data_ack64_opt {
222*5e3eaea3SApple OSS Distributions 	struct mptcp_dss_copt   mdss_copt;
223*5e3eaea3SApple OSS Distributions 	uint64_t               mdss_ack;
224*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
225*5e3eaea3SApple OSS Distributions 
226*5e3eaea3SApple OSS Distributions /* 32-bit DSS+Data ACK option */
227*5e3eaea3SApple OSS Distributions struct mptcp_dss_ack_opt {
228*5e3eaea3SApple OSS Distributions 	struct mptcp_dss_copt   mdss_copt;
229*5e3eaea3SApple OSS Distributions 	uint32_t       mdss_ack;               /* Data ACK */
230*5e3eaea3SApple OSS Distributions 	uint32_t       mdss_dsn;               /* Data Sequence Number */
231*5e3eaea3SApple OSS Distributions 	uint32_t       mdss_subflow_seqn;      /* Relative Subflow Seq Num */
232*5e3eaea3SApple OSS Distributions 	uint16_t       mdss_data_len;          /* Data Length */
233*5e3eaea3SApple OSS Distributions 	/* uint16_t mdss_xsum; */		/* Data checksum - optional */
234*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
235*5e3eaea3SApple OSS Distributions 
236*5e3eaea3SApple OSS Distributions /* 64-bit DSS+Data ACK option */
237*5e3eaea3SApple OSS Distributions struct mptcp_dss64_ack64_opt {
238*5e3eaea3SApple OSS Distributions 	struct mptcp_dss_copt   mdss_copt;
239*5e3eaea3SApple OSS Distributions 	uint64_t       mdss_ack;               /* Data ACK */
240*5e3eaea3SApple OSS Distributions 	uint64_t       mdss_dsn;               /* Data Sequence Number */
241*5e3eaea3SApple OSS Distributions 	uint32_t       mdss_subflow_seqn;      /* Relative Subflow Seq Num */
242*5e3eaea3SApple OSS Distributions 	uint16_t       mdss_data_len;          /* Data Length */
243*5e3eaea3SApple OSS Distributions 	/* uint16_t mdss_xsum; */		/* Data checksum - optional */
244*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
245*5e3eaea3SApple OSS Distributions 
246*5e3eaea3SApple OSS Distributions /* DSS+Data ACK mixed option variants */
247*5e3eaea3SApple OSS Distributions struct mptcp_dss32_ack64_opt {
248*5e3eaea3SApple OSS Distributions 	struct mptcp_dss_copt   mdss_copt;
249*5e3eaea3SApple OSS Distributions 	uint64_t       mdss_ack;               /* Data ACK */
250*5e3eaea3SApple OSS Distributions 	uint32_t       mdss_dsn;               /* Data Sequence Number */
251*5e3eaea3SApple OSS Distributions 	uint32_t       mdss_subflow_seqn;      /* Relative Subflow Seq Num */
252*5e3eaea3SApple OSS Distributions 	uint16_t       mdss_data_len;          /* Data Length */
253*5e3eaea3SApple OSS Distributions 	/* uint16_t mdss_xsum; */		/* Data checksum - optional */
254*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
255*5e3eaea3SApple OSS Distributions 
256*5e3eaea3SApple OSS Distributions struct mptcp_dss64_ack32_opt {
257*5e3eaea3SApple OSS Distributions 	struct mptcp_dss_copt   mdss_copt;
258*5e3eaea3SApple OSS Distributions 	uint32_t       mdss_ack;               /* Data ACK */
259*5e3eaea3SApple OSS Distributions 	uint64_t       mdss_dsn;               /* Data Sequence Number */
260*5e3eaea3SApple OSS Distributions 	uint32_t       mdss_subflow_seqn;      /* Relative Subflow Seq Num */
261*5e3eaea3SApple OSS Distributions 	uint16_t       mdss_data_len;          /* Data Length */
262*5e3eaea3SApple OSS Distributions 	/* uint16_t mdss_xsum; */		/* Data checksum - optional */
263*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
264*5e3eaea3SApple OSS Distributions 
265*5e3eaea3SApple OSS Distributions 
266*5e3eaea3SApple OSS Distributions /*
267*5e3eaea3SApple OSS Distributions  * MPTCP Fast Close Option
268*5e3eaea3SApple OSS Distributions  *
269*5e3eaea3SApple OSS Distributions  * MPTCP connection is aborted if the FastClose option is received.
270*5e3eaea3SApple OSS Distributions  * In future, we may send this option if a MPTCP socket level abort
271*5e3eaea3SApple OSS Distributions  * API is supported.
272*5e3eaea3SApple OSS Distributions  */
273*5e3eaea3SApple OSS Distributions struct mptcp_fastclose_opt {
274*5e3eaea3SApple OSS Distributions 	uint8_t        mfast_kind;
275*5e3eaea3SApple OSS Distributions 	uint8_t        mfast_len;
276*5e3eaea3SApple OSS Distributions #if BYTE_ORDER == LITTLE_ENDIAN
277*5e3eaea3SApple OSS Distributions 	uint8_t        mfast_reserved:4,
278*5e3eaea3SApple OSS Distributions 	    mfast_subtype:4;
279*5e3eaea3SApple OSS Distributions #else /* BIG_ENDIAN */
280*5e3eaea3SApple OSS Distributions 	uint8_t        mfast_subtype:4,
281*5e3eaea3SApple OSS Distributions 	    mfast_reserved:4;
282*5e3eaea3SApple OSS Distributions #endif
283*5e3eaea3SApple OSS Distributions 	uint8_t        mfast_reserved1;
284*5e3eaea3SApple OSS Distributions 	uint64_t       mfast_key;              /* Option receiver's key */
285*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
286*5e3eaea3SApple OSS Distributions 
287*5e3eaea3SApple OSS Distributions /*
288*5e3eaea3SApple OSS Distributions  * MPTCP MP_FAIL Option
289*5e3eaea3SApple OSS Distributions  *
290*5e3eaea3SApple OSS Distributions  * When DSS checksum is ON, and checksum fails, remote peer may send
291*5e3eaea3SApple OSS Distributions  * this option to indicate the failure. Likewise, we may send this
292*5e3eaea3SApple OSS Distributions  * option.
293*5e3eaea3SApple OSS Distributions  */
294*5e3eaea3SApple OSS Distributions struct mptcp_mpfail_opt {
295*5e3eaea3SApple OSS Distributions 	uint8_t        mfail_kind;
296*5e3eaea3SApple OSS Distributions 	uint8_t        mfail_len;
297*5e3eaea3SApple OSS Distributions #if BYTE_ORDER == LITTLE_ENDIAN
298*5e3eaea3SApple OSS Distributions 	uint8_t        mfail_reserved:4,
299*5e3eaea3SApple OSS Distributions 	    mfail_subtype:4;
300*5e3eaea3SApple OSS Distributions #else /* BIG_ENDIAN */
301*5e3eaea3SApple OSS Distributions 	uint8_t        mfail_subtype:4,
302*5e3eaea3SApple OSS Distributions 	    mfail_reserved:4;
303*5e3eaea3SApple OSS Distributions #endif
304*5e3eaea3SApple OSS Distributions 	uint8_t        mfail_reserved1:8;
305*5e3eaea3SApple OSS Distributions 	uint64_t       mfail_dsn;
306*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
307*5e3eaea3SApple OSS Distributions 
308*5e3eaea3SApple OSS Distributions struct mptcp_add_addr_opt {
309*5e3eaea3SApple OSS Distributions 	uint8_t         maddr_kind;
310*5e3eaea3SApple OSS Distributions 	uint8_t         maddr_len;
311*5e3eaea3SApple OSS Distributions #if BYTE_ORDER == LITTLE_ENDIAN
312*5e3eaea3SApple OSS Distributions 	uint8_t         maddr_flags:4,
313*5e3eaea3SApple OSS Distributions 	    maddr_subtype:4;
314*5e3eaea3SApple OSS Distributions #else /* BIG_ENDIAN */
315*5e3eaea3SApple OSS Distributions 	uint8_t         maddr_subtype:4,
316*5e3eaea3SApple OSS Distributions 	    maddr_flags:4;
317*5e3eaea3SApple OSS Distributions #endif
318*5e3eaea3SApple OSS Distributions 	uint8_t         maddr_addrid;
319*5e3eaea3SApple OSS Distributions 	union {
320*5e3eaea3SApple OSS Distributions 		struct {
321*5e3eaea3SApple OSS Distributions 			struct in_addr maddr_addrv4;
322*5e3eaea3SApple OSS Distributions 			uint32_t maddr_pad[3];
323*5e3eaea3SApple OSS Distributions 		};
324*5e3eaea3SApple OSS Distributions 
325*5e3eaea3SApple OSS Distributions 		struct {
326*5e3eaea3SApple OSS Distributions 			struct in6_addr maddr_addrv6;
327*5e3eaea3SApple OSS Distributions 		};
328*5e3eaea3SApple OSS Distributions 	} maddr_u;
329*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
330*5e3eaea3SApple OSS Distributions 
331*5e3eaea3SApple OSS Distributions struct mptcp_add_addr_hmac_msg_v4 {
332*5e3eaea3SApple OSS Distributions 	uint8_t         maddr_addrid;
333*5e3eaea3SApple OSS Distributions 	struct in_addr maddr_addr;
334*5e3eaea3SApple OSS Distributions 	uint16_t maddr_port;
335*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
336*5e3eaea3SApple OSS Distributions 
337*5e3eaea3SApple OSS Distributions struct mptcp_add_addr_hmac_msg_v6 {
338*5e3eaea3SApple OSS Distributions 	uint8_t         maddr_addrid;
339*5e3eaea3SApple OSS Distributions 	struct in6_addr maddr_addr;
340*5e3eaea3SApple OSS Distributions 	uint16_t maddr_port;
341*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
342*5e3eaea3SApple OSS Distributions 
343*5e3eaea3SApple OSS Distributions 
344*5e3eaea3SApple OSS Distributions #define MPTCP_V0_ADD_ADDR_IPV4          4
345*5e3eaea3SApple OSS Distributions #define MPTCP_V0_ADD_ADDR_IPV6          6
346*5e3eaea3SApple OSS Distributions #define MPTCP_V1_ADD_ADDR_ECHO          0x1
347*5e3eaea3SApple OSS Distributions 
348*5e3eaea3SApple OSS Distributions #define MPTCP_V0_ADD_ADDR_OPT_LEN_V4       8
349*5e3eaea3SApple OSS Distributions #define MPTCP_V0_ADD_ADDR_OPT_LEN_V6       20
350*5e3eaea3SApple OSS Distributions #define MPTCP_V1_ADD_ADDR_OPT_LEN_V4       16
351*5e3eaea3SApple OSS Distributions #define MPTCP_V1_ADD_ADDR_OPT_LEN_V6       28
352*5e3eaea3SApple OSS Distributions #define MPTCP_V1_ADD_ADDR_ECHO_OPT_LEN_V4       8
353*5e3eaea3SApple OSS Distributions #define MPTCP_V1_ADD_ADDR_ECHO_OPT_LEN_V6       20
354*5e3eaea3SApple OSS Distributions /*
355*5e3eaea3SApple OSS Distributions  * MPTCP MP_PRIO Option
356*5e3eaea3SApple OSS Distributions  *
357*5e3eaea3SApple OSS Distributions  * When a subflow becomes unusable (due to bad radio coverage) or
358*5e3eaea3SApple OSS Distributions  * it is the costlier path or it is not the preferred path, the receiver may
359*5e3eaea3SApple OSS Distributions  * use this option to let the sender know of its path preference.
360*5e3eaea3SApple OSS Distributions  */
361*5e3eaea3SApple OSS Distributions 
362*5e3eaea3SApple OSS Distributions /* Option to change priority of some other subflow(s) using addr_id */
363*5e3eaea3SApple OSS Distributions struct mptcp_mpprio_addr_opt {
364*5e3eaea3SApple OSS Distributions 	uint8_t        mpprio_kind;
365*5e3eaea3SApple OSS Distributions 	uint8_t        mpprio_len;
366*5e3eaea3SApple OSS Distributions #define MPTCP_MPPRIO_BKP        0x1
367*5e3eaea3SApple OSS Distributions #if BYTE_ORDER == LITTLE_ENDIAN
368*5e3eaea3SApple OSS Distributions 	uint8_t        mpprio_flags:4,
369*5e3eaea3SApple OSS Distributions 	    mpprio_subtype:4;
370*5e3eaea3SApple OSS Distributions #else /* BIG_ENDIAN */
371*5e3eaea3SApple OSS Distributions 	uint8_t        mpprio_subtype:4,
372*5e3eaea3SApple OSS Distributions 	    mpprio_flags:4;
373*5e3eaea3SApple OSS Distributions #endif
374*5e3eaea3SApple OSS Distributions 	uint8_t        mpprio_addrid;
375*5e3eaea3SApple OSS Distributions }__attribute__((__packed__));
376*5e3eaea3SApple OSS Distributions 
377*5e3eaea3SApple OSS Distributions #endif /* BSD_KERNEL_PRIVATE */
378*5e3eaea3SApple OSS Distributions 
379*5e3eaea3SApple OSS Distributions #endif /* _NETINET_MPTCP_H_ */
380