diff options
-rw-r--r-- | net/ipv4/tcp_output.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index fd0cea114b5d..e2b4461074da 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1351,8 +1351,8 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) | |||
1351 | return 0; | 1351 | return 0; |
1352 | } | 1352 | } |
1353 | 1353 | ||
1354 | /* Calculate MSS. Not accounting for SACKs here. */ | 1354 | /* Calculate MSS not accounting any TCP options. */ |
1355 | int tcp_mtu_to_mss(struct sock *sk, int pmtu) | 1355 | static inline int __tcp_mtu_to_mss(struct sock *sk, int pmtu) |
1356 | { | 1356 | { |
1357 | const struct tcp_sock *tp = tcp_sk(sk); | 1357 | const struct tcp_sock *tp = tcp_sk(sk); |
1358 | const struct inet_connection_sock *icsk = inet_csk(sk); | 1358 | const struct inet_connection_sock *icsk = inet_csk(sk); |
@@ -1381,13 +1381,17 @@ int tcp_mtu_to_mss(struct sock *sk, int pmtu) | |||
1381 | /* Then reserve room for full set of TCP options and 8 bytes of data */ | 1381 | /* Then reserve room for full set of TCP options and 8 bytes of data */ |
1382 | if (mss_now < 48) | 1382 | if (mss_now < 48) |
1383 | mss_now = 48; | 1383 | mss_now = 48; |
1384 | |||
1385 | /* Now subtract TCP options size, not including SACKs */ | ||
1386 | mss_now -= tp->tcp_header_len - sizeof(struct tcphdr); | ||
1387 | |||
1388 | return mss_now; | 1384 | return mss_now; |
1389 | } | 1385 | } |
1390 | 1386 | ||
1387 | /* Calculate MSS. Not accounting for SACKs here. */ | ||
1388 | int tcp_mtu_to_mss(struct sock *sk, int pmtu) | ||
1389 | { | ||
1390 | /* Subtract TCP options size, not including SACKs */ | ||
1391 | return __tcp_mtu_to_mss(sk, pmtu) - | ||
1392 | (tcp_sk(sk)->tcp_header_len - sizeof(struct tcphdr)); | ||
1393 | } | ||
1394 | |||
1391 | /* Inverse of above */ | 1395 | /* Inverse of above */ |
1392 | int tcp_mss_to_mtu(struct sock *sk, int mss) | 1396 | int tcp_mss_to_mtu(struct sock *sk, int mss) |
1393 | { | 1397 | { |
@@ -2930,7 +2934,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) | |||
2930 | */ | 2934 | */ |
2931 | if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < tp->rx_opt.mss_clamp) | 2935 | if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < tp->rx_opt.mss_clamp) |
2932 | tp->rx_opt.mss_clamp = tp->rx_opt.user_mss; | 2936 | tp->rx_opt.mss_clamp = tp->rx_opt.user_mss; |
2933 | space = tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) - | 2937 | space = __tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) - |
2934 | MAX_TCP_OPTION_SPACE; | 2938 | MAX_TCP_OPTION_SPACE; |
2935 | 2939 | ||
2936 | syn_data = skb_copy_expand(syn, skb_headroom(syn), space, | 2940 | syn_data = skb_copy_expand(syn, skb_headroom(syn), space, |