mptcp: Fix MPTCP FAST_CLOSE

We cannot let the Meta-socket be in close-state and continue keeping up
a timer. When the timer expires, the destruction will again call
tcp_done and mess everything up.

So, we now rather handle the retransmissions of the FAST_CLOSE in the
subflow's keepalive timer. That way we can effectively close the
meta-socket and just keep the subflow alive.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: tcp_current_mss cannot call mptcp_current_mss

mptcp_current_mss calls tcp_current_mss if no subflow is available with
the meta-sk as an argument. If then tcp_current_mss again redirects to
mptcp_current_mss, we are screwed and will loop forever...

Fixes: d1130dd78b (mptcp: Don't scheduler forward-retransmissions too often)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
New maintenance release

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Retransmitted SYN/ACK's+MP_JOIN should have the MP_JOIN

Since ba5d9b653e9, when a retransmitted SYN does not contain an
MP_CAPABLE, the SYN/ACK should also not contain an MP_CAPABLE.

Now, this is the way the RFC is specified.

However, for MP_JOIN's we also set the saw_mpc-flag in the request-sock,
but do not set it in the mopt's. Thus, in tcp_check_req upon a
retransmitted SYN+MP_JOIN, we will reply without an MP_JOIN inside the
SYN/ACK.

This patch fixes it, by setting the saw_mpc-flag in the mopt.

Fixes: ba5d9b653e9 (Fall back to TCP when receiving a packet without MP_CAPABLE.)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Fix memory leak in mptcp_fullmesh

mptcp_local is already allocated when doing the "goto exit;". So, even
when going to that label, we will have to free it.

Signed-off-by: Niels Möller <nisse@southpole.se>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Fix Issue #34: Set ECONNRESET on correct socket

sk_it is not initialized at this stage. Rather, ECONNRESET should be set
on the socket we are actually killing (sk).

Reported-by: Eduard Creciun <eduard.creciun@student.uclouvain.be>
Fixes: Bug #34 (https://github.com/multipath-tcp/mptcp/issues/34)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Fix Issue #37: Explicitly cast srtt to 64-bit

We may have an integer overflow when multiplying the srtt's. C does not
do an automatic cast of 32-bit integers to 64-bit integers. So, we have
to make it explicit to avoid the integer overflow.

Fixes: Bug #37 (https://github.com/multipath-tcp/mptcp/issues/37)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Fix bit-magic to find free index

Actually, ffs() uses integers to find for the next free index. Thus, it
fills the remaining bits of the 8-bit bitfield by zero's. So, we won't
find the correct index.

This patch adds a check, to see if we are going out-of-bounds.

Reported-by: Vinothkumar Vivekanandan <vvinoth@watchy.in>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Fix Bug #33: Correctly set seq in mptcp_skb_trim_head

new_seq is actually alread in host-byte-order. So, we do not need the
htonl here. Doing the htonl results in a wrong sequence-number of this
segment and random crashes afterwards.

Fixes: Issue #33 (https://github.com/multipath-tcp/mptcp/issues/33)
Fixes: 6f7d8e5348d5d (Use sk_data_ready-callback)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
New maintenance release

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Fix Bug #41: Handle missing entries in the fullmesh-path-manager

It may be that the address of the initial subflow is not yet part of the
fullmesh path-manager's list of addresses. May happen because the
path-manager waits 500ms before adding the address.

In general, we do not handle a missing address in the path-manager's
list not correctly. We always assume that it is there.

Change everything, so that get_local_id returns -1 if the address is not
part of the fullmesh list. In case -1 is returned on a MP_JOIN, we
simply ignore the SYN.

In case -1 is returned on a MP_CAPABLE, we disable the path-manager and
fall back to the 'default'-path-management, which basically does
nothing.

Fixes: Bug #41 (https://github.com/multipath-tcp/mptcp/issues/41)
Fixes: c31d21d039d80 (Modularize the path-manager)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Build Fix

Sorry...

Fixes: 75ec81a35c2 (mptcp: Fix Bug #41: Handle missing entries in the fullmesh-path-manager)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Merge remote-tracking branch 'upstream/mptcp_v0.88' into mptcp_v0.88_binder_pm_v6_no_fp
Fix parameter type