aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/net/mptcp/subflow.c
diff options
context:
space:
mode:
authorChristoph Paasch <cpaasch@apple.com>2020-01-21 16:56:31 -0800
committerDavid S. Miller <davem@davemloft.net>2020-01-24 13:44:08 +0100
commitcc7972ea1932335e0a0ee00ac8a24b3e8304630d (patch)
treed21fb64626a38ba789fc9ffbedd03df45dd27b1e /net/mptcp/subflow.c
parentmptcp: move from sha1 (v0) to sha256 (v1) (diff)
downloadwireguard-linux-cc7972ea1932335e0a0ee00ac8a24b3e8304630d.tar.xz
wireguard-linux-cc7972ea1932335e0a0ee00ac8a24b3e8304630d.zip
mptcp: parse and emit MP_CAPABLE option according to v1 spec
This implements MP_CAPABLE options parsing and writing according to RFC 6824 bis / RFC 8684: MPTCP v1. Local key is sent on syn/ack, and both keys are sent on 3rd ack. MP_CAPABLE messages len are updated accordingly. We need the skbuff to correctly emit the above, so we push the skbuff struct as an argument all the way from tcp code to the relevant mptcp callbacks. When processing incoming MP_CAPABLE + data, build a full blown DSS-like map info, to simplify later processing. On child socket creation, we need to record the remote key, if available. Signed-off-by: Christoph Paasch <cpaasch@apple.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mptcp/subflow.c')
-rw-r--r--net/mptcp/subflow.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 9fb3eb87a20f..8892855f4f52 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -77,7 +77,6 @@ static void subflow_init_req(struct request_sock *req,
if (err == 0)
subflow_req->mp_capable = 1;
- subflow_req->remote_key = rx_opt.mptcp.sndr_key;
subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq;
}
}
@@ -180,11 +179,22 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
bool *own_req)
{
struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk);
+ struct mptcp_subflow_request_sock *subflow_req;
+ struct tcp_options_received opt_rx;
struct sock *child;
pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn);
- /* if the sk is MP_CAPABLE, we already received the client key */
+ /* if the sk is MP_CAPABLE, we need to fetch the client key */
+ subflow_req = mptcp_subflow_rsk(req);
+ if (subflow_req->mp_capable) {
+ opt_rx.mptcp.mp_capable = 0;
+ mptcp_get_options(skb, &opt_rx);
+ if (!opt_rx.mptcp.mp_capable)
+ subflow_req->mp_capable = 0;
+ else
+ subflow_req->remote_key = opt_rx.mptcp.sndr_key;
+ }
child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst,
req_unhash, own_req);