IPv6 fixes

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Better handle Address ID when receiving JOINs

This allows to receive JOINs from the same address with different
Address IDs. This was a problem in a scenarios where the client
has one interface and is performing ifup/ifdown. In that case, the
server was maintaining the sockets state for each of the defunct
subflows.

Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Cleanup

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Retry establishing subflows when route is not yet available

When there is no route available then the subflows establishment can
fails. This might causes problems when only one address is available
on the client and server. In this case, MPTCP connection can end up with
no subflows available and so stall indefinitely.
Now, we handle the case where no route is yet available when
establishing new subflows. In this case we retry after 1 seconds to
re-establish them.

Note that I also renamed the mptcp_send_updatenotif(_wq) functions to
more obvious names.

Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Minor Cleanup

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Fix: Use spin_lock in mptcp_vX_reqsk_queue_hash_add.

This function is called with bh disabled. Thus, it MUST NOT be
spin_lock_bh.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Fix Bug#82: Review mptcp_vX_join_request

They are similar to tcp_vX_conn_request. Thus, we have to change them.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Fix: null srtt in mptcp_check_snd_buf

If srtt is null then it is not possible to estimate the bandwidth.

Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Tested-by: Cheng Cui <ccuicron@gmail.com>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Fix: Don't generate an ISN if it is not necessary

Commit 6188b878fd6b5846e3bc5b4a5966ae713c02fe52 alligned
mptcp_v4_join_request with tcp_v4_conn_request. One error remained,
where we always generated an isn.

This patch fixes it.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Cleanup of mptcp_ipv6.c

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Cleanup mptcp_ipv4.c

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Fix Bug#37: Handle SYN/ACK+Join retransmissions

This patch changes the handling of the meta-level keepalive timer.

Up to now, keepalives where handled at the meta-level.
From now on, keepalives are handled at the subflow-level. This allows
the meta-level to handle the SYN/ACK+Join retransmissions like a regular
TCP listener socket.

When the app sets the keep-alive option on the socket, this option is
pushed down to the subflows.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Change skb_unlink to __skb_unlink and a comment

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Fix Bug#90: Handle erros in mptcp_init and mptcp_pm_init

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Fix: call __kfree_skb in mptcp_clean_rtx_queue

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Build-Fix

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Build-Fix

Fix build, if CONFIG_SYSCTL is disabled:

WARNING: net/built-in.o(.text+0xa550f): Section mismatch in reference
from the function mptcp_pm_undo() to the variable
.init.data:mptcp_pm_proc_ops
The function mptcp_pm_undo() references
the variable __initdata mptcp_pm_proc_ops.
This is often because mptcp_pm_undo lacks a __initdata
annotation or the annotation of mptcp_pm_proc_ops is wrong.

WARNING: net/built-in.o(.text+0xa559d): Section mismatch in reference
from the function mptcp_pm_init() to the variable
.init.data:mptcp_pm_proc_ops
The function mptcp_pm_init() references
the variable __initdata mptcp_pm_proc_ops.
This is often because mptcp_pm_init lacks a __initdata
annotation or the annotation of mptcp_pm_proc_ops is wrong.

WARNING: net/built-in.o(.text+0xa55cc): Section mismatch in reference
from the function mptcp_pm_init() to the variable
.init.data:mptcp_pm_proc_ops
The function mptcp_pm_init() references
the variable __initdata mptcp_pm_proc_ops.
This is often because mptcp_pm_init lacks a __initdata
annotation or the annotation of mptcp_pm_proc_ops is wrong.

WARNING: vmlinux.o(.text+0x337723): Section mismatch in reference from
the function mptcp_pm_undo() to the variable
.init.data:mptcp_pm_proc_ops
The function mptcp_pm_undo() references
the variable __initdata mptcp_pm_proc_ops.
This is often because mptcp_pm_undo lacks a __initdata
annotation or the annotation of mptcp_pm_proc_ops is wrong.

WARNING: vmlinux.o(.text+0x3377b1): Section mismatch in reference from
the function mptcp_pm_init() to the variable
.init.data:mptcp_pm_proc_ops
The function mptcp_pm_init() references
the variable __initdata mptcp_pm_proc_ops.
This is often because mptcp_pm_init lacks a __initdata
annotation or the annotation of mptcp_pm_proc_ops is wrong.

WARNING: vmlinux.o(.text+0x3377e0): Section mismatch in reference from
the function mptcp_pm_init() to the variable
.init.data:mptcp_pm_proc_ops
The function mptcp_pm_init() references
the variable __initdata mptcp_pm_proc_ops.
This is often because mptcp_pm_init lacks a __initdata
annotation or the annotation of mptcp_pm_proc_ops is wrong.

net/built-in.o: In function `tcp_recv_urg':
/home/cpaasch/mptcp/net/ipv4/tcp.c:1187: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_sysctl_mss':
/home/cpaasch/mptcp/include/net/mptcp.h:547: undefined reference to
`sysctl_mptcp_mss'
net/built-in.o: In function `mptcp_fallback_infinite':
/home/cpaasch/mptcp/include/net/mptcp.h:979: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `tcp_current_mss':
/home/cpaasch/mptcp/net/ipv4/tcp_output.c:1308: undefined reference to
`sysctl_mptcp_mss'
net/built-in.o: In function `tcp_connect_init':
/home/cpaasch/mptcp/net/ipv4/tcp_output.c:2649: undefined reference to
`sysctl_mptcp_mss'
net/built-in.o: In function `mptcp_sysctl_mss':
/home/cpaasch/mptcp/include/net/mptcp.h:547: undefined reference to
`sysctl_mptcp_mss'
net/built-in.o: In function `tcp_write_timeout':
/home/cpaasch/mptcp/net/ipv4/tcp_timer.c:182: undefined reference to
`sysctl_mptcp_syn_retries'
net/built-in.o: In function `mptcp_doit':
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:1345: undefined reference to
`sysctl_mptcp_enabled'
net/built-in.o: In function `mptcp_select_ack_sock':
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:202: undefined reference to
`sysctl_mptcp_debug'
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:206: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_sysctl_mss':
/home/cpaasch/mptcp/include/net/mptcp.h:547: undefined reference to
`sysctl_mptcp_mss'
net/built-in.o: In function `mptcp_close':
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:1191: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_del_sock':
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:879: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_add_sock':
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:841: undefined reference to
`sysctl_mptcp_debug'
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:851: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_sock_destruct':
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:788: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_check_req_child':
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:1513: undefined reference to
`sysctl_mptcp_mss'
net/built-in.o: In function `mptcp_alloc_mpcb':
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:643: undefined reference to
`sysctl_mptcp_mss'
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:644: undefined reference to
`sysctl_mptcp_mss'
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:725: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_create_master_sk':
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:1404: undefined reference to
`sysctl_mptcp_mss'
net/built-in.o: In function `mptcp_check_req_master':
/home/cpaasch/mptcp/net/mptcp/mptcp_ctrl.c:1448: undefined reference to
`sysctl_mptcp_checksum'
net/built-in.o: In function `mptcp_v4_add_raddress':
/home/cpaasch/mptcp/net/mptcp/mptcp_ipv4.c:254: undefined reference to
`sysctl_mptcp_debug'
/home/cpaasch/mptcp/net/mptcp/mptcp_ipv4.c:268: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_pm_addr4_event_handler':
/home/cpaasch/mptcp/net/mptcp/mptcp_ipv4.c:611: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_init4_subsockets':
/home/cpaasch/mptcp/net/mptcp/mptcp_ipv4.c:485: undefined reference to
`sysctl_mptcp_debug'
/home/cpaasch/mptcp/net/mptcp/mptcp_ipv4.c:514: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o:/home/cpaasch/mptcp/net/mptcp/mptcp_ipv4.c:521: more
undefined references to `sysctl_mptcp_debug' follow
net/built-in.o: In function `mptcp_pm_addr_event_handler':
/home/cpaasch/mptcp/net/mptcp/mptcp_pm.c:918: undefined reference to
`sysctl_mptcp_ndiffports'
net/built-in.o: In function `mptcp_get_loc_addrid':
/home/cpaasch/mptcp/net/mptcp/mptcp_pm.c:223: undefined reference to
`sysctl_mptcp_debug'
/home/cpaasch/mptcp/net/mptcp/mptcp_pm.c:235: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_do_join_short':
/home/cpaasch/mptcp/net/mptcp/mptcp_pm.c:495: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_lookup_join':
/home/cpaasch/mptcp/net/mptcp/mptcp_pm.c:449: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_set_addresses':
/home/cpaasch/mptcp/net/mptcp/mptcp_pm.c:253: undefined reference to
`sysctl_mptcp_ndiffports'
/home/cpaasch/mptcp/net/mptcp/mptcp_pm.c:293: undefined reference to
`sysctl_mptcp_debug'
/home/cpaasch/mptcp/net/mptcp/mptcp_pm.c:335: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_create_subflow_worker':
/home/cpaasch/mptcp/net/mptcp/mptcp_pm.c:623: undefined reference to
`sysctl_mptcp_ndiffports'
net/built-in.o: In function `mptcp_synack_options':
/home/cpaasch/mptcp/net/mptcp/mptcp_output.c:1016: undefined reference
to `sysctl_mptcp_checksum'
net/built-in.o: In function `mptcp_send_fin':
/home/cpaasch/mptcp/net/mptcp/mptcp_output.c:1446: undefined reference
to `sysctl_mptcp_mss'
net/built-in.o: In function `mptcp_established_options':
/home/cpaasch/mptcp/net/mptcp/mptcp_output.c:1179: undefined reference
to `sysctl_mptcp_debug'
net/built-in.o: In function `mptcp_syn_options':
/home/cpaasch/mptcp/net/mptcp/mptcp_output.c:978: undefined reference to
`sysctl_mptcp_checksum'
net/built-in.o: In function `mptcp_parse_options':
/home/cpaasch/mptcp/net/mptcp/mptcp_input.c:1265: undefined reference to
`sysctl_mptcp_debug'
/home/cpaasch/mptcp/net/mptcp/mptcp_input.c:1270: undefined reference to
`sysctl_mptcp_enabled'
/home/cpaasch/mptcp/net/mptcp/mptcp_input.c:1283: undefined reference to
`sysctl_mptcp_checksum'
/home/cpaasch/mptcp/net/mptcp/mptcp_input.c:1297: undefined reference to
`sysctl_mptcp_debug'
/home/cpaasch/mptcp/net/mptcp/mptcp_input.c:1338: undefined reference to
`sysctl_mptcp_debug'
/home/cpaasch/mptcp/net/mptcp/mptcp_input.c:1390: undefined reference to
`sysctl_mptcp_debug'
/home/cpaasch/mptcp/net/mptcp/mptcp_input.c:1421: undefined reference to
`sysctl_mptcp_debug'
/home/cpaasch/mptcp/net/mptcp/mptcp_input.c:1448: undefined reference to
`sysctl_mptcp_debug'
net/built-in.o:/home/cpaasch/mptcp/net/mptcp/mptcp_input.c:1455: more
undefined references to `sysctl_mptcp_debug' follow
make[1]: *** [.tmp_vmlinux1] Error 1
make: *** [sub-make] Error 2

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Fix: Always free segments in __mptcp_reinject_data

If clone_it is not set, the segment got unlinked from the
reinject-queue. If we do not free it here, we will have a memory leak.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Fix: Don't clone third ACK+Join retransmits

If we clone it, the packet won't get freed, and we will have a memory
leak.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Fix: Set seq-number correctly for third-ack retransmits

We have to do like a window-probe, to trigger an immediate ack from the
peer. Thus, snd_una - 1.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>