FIX: Check for the existence of data_ack.

This is only temporary, because data_ack may well be equal to 0, due to
wrapped sequence numbers.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Checking if the mtcp_alloc_mpcb memory allocation worked.

Signed-off-by: Fabien Duchêne <fabien.duchene@uclouvan.be>
FIX: now sending a RST when a SYN with an unknown token is received.

Signed-off-by: Fabien Duchêne <fabien.duchene@uclouvan.be>
FIX: Only set tp->mpc when the SYN/ACK is valid.

- It may be that the syn/ack is unvalid (wrong seq-numbers). Then,
  tp->mpc should of course not be set.
- Removed the checks for the existence of the mpcb, as the BUG() checks
  this already before.
- Do not set meta_tp->max_window if we receive a SYN/ACK. This is
  handled by the call to tcp_ack inside tcp_rcv_synsent_state_process.
  (cfr. regular tcp implementation)
- Do not set meta_tp->snd_wnd while setting tp->mpc. Later,
  meta_tp->snd_wnd is set to ntohs(th->window).
- Directly access the mpcb instead of using tp->mpcb

- Minor cleanup in include/linux/tcp_options.h

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Cleanup: mtcp_init_subsockets

- Restructure the code.
- Removed useless memcpy(...)
- Use mtcp_for_each_tp to iterate

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Cleanup: af_inet*.c

In 2.6.36, .sendmsg of inet_stream_ops calls inet_sendmsg, which will
then call the protocol-specific sendmsg-function (TCP,...).

Thus, mtcp_sendmsg should be there, and not in inet_stream_ops. (this is
a "residue" from 2.6.28)

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
IF-up/down event handler (experimental)

Reacts on interface up/down events - scans all existing
connections and flags/de-flags unavailable paths, so that
they are not considered for packet scheduling.
This will save us a couple of RTOs and helps to migrate
traffic faster.

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

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Cleanup: Remove old shim6-related netlink's

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
FIX: Allow unrecognized new subflows on the server.

If the client is configured with mptcp_ndiffPorts, but the server not,
the server will crash. This is due to the fact that he wants to find a
path in the path_array with the corresponding IP addresses. However, if
mptcp_ndiffPorts is enabled on the client, the IP addresses will be
those of the master-socket. Thus, find_path_mapping4 will not find the
related path, and we will BUG_ON(!p).

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
FIX: IFUP/IFDOWN - Don't act on non-mp-capable mpcb's

The check assures, that we only act on the mpcb's that belong to a
master-socket which is mp-capable.
Otherwise, there is a bug, when shutting down the machine, because we
enter mtcp_init_subsockets on a non-mpc mpcb, because list_rcvd has been
set to 1 in mtcp_pm_inetaddr_event.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
FIX: now checking if the token attached to a MP_JOIN SYN/ACK is valid or not.

The token sent in the SYN/ACK must be the client's token, otherwise the connection
is RSTed by the client.

mtcp_lookup_join should be called only on a SYN, not a SYN/ACK.

Signed-off-by: Fabien Duchêne <fabien.duchene@uclouvain.be>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
bug fix: added flag-based check for presence of data_ack option.

This is slightly less efficient, given it consumes 8 bytes more of the
TCP_SKB_CB. (in fact 1 byte only, but we are required to align on 8 bytes).
Previously the data_ack presence was verified through a zero-value check,
which is incorrect given 0 is a legal value for a data-ack.

Signed-off-by: Sébastien Barré <sebastien.barre@uclouvain.be>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
cleanup: removed unused structure

Signed-off-by: Sébastien Barré <sebastien.barre@uclouvain.be>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
bug fix: init of mtcp_pm

if there is an error when creating the proc file, proc_net_remove()
was erroneously called.
We also replace mtcp_pm with mptcp_pm

Signed-off-by: Sébastien Barré <sebastien.barre@uclouvain.be>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
The token is not part of MPTCP Path Management

The token is part of MPTCP. It has nothing to do with the path
management.

Together with this patch is the usual cleanup.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Support draft v03 for MPTCP-CAPABLE option

This commit supports the option-format as defined by mptcp-draft version
03.

However, we still not support the key-management as defined in the
draft. Current security is still based on draft 01.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Support draft v03 for MPTCP-JOIN option

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Support draft v03 for MPTCP-DSS option

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Support draft v03 for MPTCP-ADD_ADDR option

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