Build-Fix: Backporting problems
Signed-off-by: Raphael Wutzke <raphael.wutzke@googlemail.com>
mptcp: OPTION_ADD_ADDR truncates ipv6 addresses to ipv4

In function mptcp_options_write, the kind of address used is checked with:
if (opts->addr4) {...}
else if (opts->addr6) {...}
Because in tcp_out_options, addr4 and addr6 are in a union, addr4 will always be set if addr6 is.

Removed the union for now.

Signed-off-by: Mihai P. Andrei <mihai.p.andrei@intel.com>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: Check path-array and fail_rcvd after mptcp_post_parse_options

As the MPTCP-options are read only in mptcp_post_parse_options, we have
to move the code out of tcp_fast_parse_options into
tcp_validate_incoming, where mptcp_post_parse_options is called.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Add comment in tcp_rcv_state_process

To better understand, why this 'if' is there.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: Don't close if already SOCK_DEAD

We may call tcp_close twice, if the socket is already dead. We have to
prevent this!

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: memleak of reinjected segments

We should not increase the dataref for pskb_copy'd segments in
mptcp_write_xmit.

Because, this segment gets removed from the reinject-queue and will only
exist in the subflow-send-queue. Thus, the dataref should be one,
because the subflow-send-queue is the only place where we access this
segment.

If we increase the dataref, the linear part of the skb will not get
freed from kfree_skb() in tcp_clean_rtx_queue and we have a memory-leak,
as no one else (except the subflow-send-queue) had access to this
segment.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Fix: Correctly extract idsn out of sha-1

With big-endian machines the previous extract was wrong. We should just
convert it by using a u64 pointer.

Reported-by: Stephen Hankinson <stephen.hankinson@quarkengineering.com>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Tested-by: Stephen Hankinson <stephen.hankinson@quarkengineering.com>
Fix: Set inet_opt to NULL when deleting socket

Otherwise we will call a double-free in inet_sock_destruct, because we
will free the meta-sk (who has the same inet_opt-pointer as the
master_sk).

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
ipv4: Use newinet->inet_opt in inet_csk_route_child_sock()

Since 0e734419923bd ("ipv4: Use inet_csk_route_child_sock() in DCCP and
TCP."), inet_csk_route_child_sock() is called instead of
inet_csk_route_req().

However, after creating the child-sock in tcp/dccp_v4_syn_recv_sock(),
ireq->opt is set to NULL, before calling inet_csk_route_child_sock().
Thus, inside inet_csk_route_child_sock() opt is always NULL and the
SRR-options are not respected anymore.
Packets sent by the server won't have the correct destination-IP.

This patch fixes it by accessing newinet->inet_opt instead of ireq->opt
inside inet_csk_route_child_sock().

Reported-by: Luca Boccassi <luca.boccassi@gmail.com>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Display meta-sock addresses in /proc/net/mptcp_pm

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

Remove useless field mptcp_opt_type that was only used in
mptcp_check_req_child to see whether the MP_JOIN(ACK) option was present
in the incomming segment.

Signed-off-by: Gregory Detal <gregory.detal@uclouvain.be>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Build-Fix: Fit changes for the 3.2 kernel to 3.0