Skip to content

Commit

Permalink
mptcp: change MP_FASTCLOSE retransmissions limit to const
Browse files Browse the repository at this point in the history
MP_FASTCLOSE retransmissions limit is defined by the sysctl
net.ipv4.tcp_retries2. Its default value is 15.

This value also influences the timeout of an alive TCP connection, when
RTO retransmissions remain unacknowledged. RFC 1122 recommends at least
100 s for the timeout, which corresponds to a value of at least 8.

RFC 6824 (section 3.5) recommends a limit of 3 retransmissions.

These requirements are not compatible. The limit of MP_FASTCLOSE
retransmissions should not be shared with net.ipv4.tcp_retries2 but
rather uses its own limit.

Moreover, the limit of MP_FASTCLOSE retransmissions is implemented via
a timeout (time limit), where the RFC 6824 specifies it as a count of
retransmissions.

This patch defines the limitations of MP_FASTCLOSE retransmissions as a
constant (MPTCP_FASTCLOSE_RETRIES), replacing the sysctl tcp_retries2.
The limitation of retransmissions is implemented via a count of
retransmissions instead of a timeout.

Exponential backoff reverting on ICMP destination unreachable is also
preventively disabled on the socket used for sending MP_FASTCLOSE.

It may happen that when the first MP_FASTCLOSE is sent, the
retransmission counter of the socket (icsk_retransmits) is not null,
due to a previous unacknowledged tcp retransmission.
After the first MP_FASTCLOSE transmission, icsk_retransmits counts the
number MP_FASTCLOSE retransmissions. This patch clears icsk_retransmits
when the first MP_FASTCLOSE is sent, to properly count the number of
MP_FASTCLOSE retransmissions. Thanks to Christoph Paasch for this
suggestion.

Fixes: 8248fb2 (Support sending/receiving of MPTCP_RST)
Signed-off-by: François Finfe <[email protected]>
Signed-off-by: Christoph Paasch <[email protected]>
(cherry picked from commit d9a6284)
Signed-off-by: Christoph Paasch <[email protected]>
  • Loading branch information
François Finfe authored and cpaasch committed Jul 19, 2017
1 parent e1243fb commit 809d4ff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions include/net/mptcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ struct mptcp_cb {

#define OPTION_MPTCP (1 << 5)

/* Max number of fastclose retransmissions */
#define MPTCP_FASTCLOSE_RETRIES 3

#ifdef CONFIG_MPTCP

/* Used for checking if the mptcp initialization has been successful */
Expand Down
4 changes: 3 additions & 1 deletion net/ipv4/tcp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,10 @@ static void tcp_keepalive_timer (unsigned long data)
if (!tp->retrans_stamp)
tp->retrans_stamp = tcp_time_stamp ? : 1;

if (tcp_write_timeout(sk))
if (icsk->icsk_retransmits >= MPTCP_FASTCLOSE_RETRIES) {
tcp_write_err(sk);
goto out;
}

tcp_send_ack(sk);
icsk->icsk_retransmits++;
Expand Down
4 changes: 4 additions & 0 deletions net/mptcp/mptcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,10 @@ void mptcp_send_active_reset(struct sock *meta_sk, gfp_t priority)
inet_csk_reset_keepalive_timer(sk, inet_csk(sk)->icsk_rto);

meta_tp->send_mp_fclose = 1;
inet_csk(sk)->icsk_retransmits = 0;

/* Prevent exp backoff reverting on ICMP dest unreachable */
inet_csk(sk)->icsk_backoff = 0;

MPTCP_INC_STATS(sock_net(meta_sk), MPTCP_MIB_FASTCLOSETX);
}
Expand Down

0 comments on commit 809d4ff

Please sign in to comment.