Fix: Don't send Fin after receiving an error (e.g., RST)

Otherwise, mptcp_sub_close will still trigger the FIN even if we
received a RST. This is undesirable behavior.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: Don't send FIN when resetting upon Remove-Addr

It's needless, as we already sent a Remove-Addr. Thus, we set sk_err to
ECONNRESET, which prevents sending a FIN in mptcp_sub_close.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: Enqueue in meta-sk backlog queue from tcp_child_process

This is necessary, because of two scenarios:
1. on the master-sk, IF the application has accepted the socket after
tcp_check_req and before tcp_child_process, it will hold the lock of the
meta-sk and thus we need to queue it there.

2. on a subflow, the application is anyways holding the lock on the
meta-sk. Thus, we anyways have to queue it there.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: Update snd_wnd of subflows and some cleanup

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: Always reinject data - even if no subflow is available

Because, anyway when a new subflow becomes available we will reinject
the data.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Cleanup: Move tcp_probe changes to a new branch

To prepare separating MPTCP into smaller patches. The tcp_probe changes
are definetly something to not include in an MPTCP patch.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Use new IS_ENABLED

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Cleanup: No changes required to sk_wake_async

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Random cleanup

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: Temporarily disable defer-accept for MPTCP

Otherwise we will lose the MPTCP-options in the fourth ack, following a
third ack. E.g., MP_PRIO,...

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Disallow IPv6-module if MPTCP is enabled

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: tcp_push_pending_frames has to be MPTCP-aware

Otherwise we might miss reinjecting a segment when possible.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: Reinject DATA_FIN also

As empty data-fins are not enqueued in the subflow-send-queue we have to
reinject them.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: Set path_mask to 0, before pushing to subflow

Since 6435ad76c54eb9, the path-mask is a union with inet_skb_param. As
the subskb is a clone of the meta's skb, the path_mask may be != 0 and
thus inet_skb_param is no more initialized to 0 as it should.

We fix this, by resetting the path-mask to 0 just before pushing the
segment on the subflow in mptcp_write_xmit.

Special attention must be paid to reinjected segments.
They are coming from the subflow (thus path_mask == 0), however we don't
want them to be reinjected twice on the same subflow. Thus, before
continuing with reinjection in mptcp_write_xmit, we get the path_mask
out of the meta-write-queue and set it on the reinject-segment.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Cc: Octavian Purdila <octavian.purdila@intel.com>
Reviewed-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: reduced request_sock to its original size

Created a new mptcp_request_sock and mptcp_request_sock_ops with the
extra fields.
Replaced request_sock allocation and usage as needed.

Signed-off-by: Mihai P. Andrei <mihai.p.andrei@intel.com>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Build Fix

Fix building the tree with CONFIG_MPTCP disabled.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Remove changes from tcp_v4(6)_reqsk_destructor

As we now have our own mptcp_request_sock_ops, we can change the
callback to our custom mptcp_v4(6)_reqsk_destructor and thus reduce our
impact on the regular TCP stack.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Reviewed-by: Octavian Purdila <octavian.purdila@intel.com>
Group exports in tcp.h

That way it's easier to see what has been modified in the tcp-stack
exclusively for MPTCP.

Additionally, I simplify tcp_push, by making the same trick as in
473232bfc050f. tcp_push is always called from the meta-sk if it is MPTCP
- thus, no worries here.

This patch largely reduces the modifications to the regular TCP stack.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Reviewed-by: Octavian Purdila <octavian.purdila@intel.com>
Always call tcp_should_expand_sndbuf with the meta-sk

If it's TCP-only, it will still be the tcp-socket.
If it's MPTCP we don't really need the subsk.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Reviewed-by: Octavian Purdila <octavian.purdila@intel.com>
Minor cleanup in the tcp-push code

tcp_push_pending_frames will always be called with the meta-sk if we are
doing MPTCP. Thus, no need to call mptcp_meta_sk.

mptcp_push_frames is no more used. We can remove it.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Reviewed-by: Octavian Purdila <octavian.purdila@intel.com>