diff mbox

[1/2] ipv6: fix mss when it is bigger than IPV6_MAXPLEN - sizeof(struct tcphdr)

Message ID 1330417697-2637-1-git-send-email-roy.qing.li@gmail.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Li RongQing Feb. 28, 2012, 8:28 a.m. UTC
From: RongQing.Li <roy.qing.li@gmail.com>

When mss is bigger than IPV6_MAXPLEN - sizeof(struct tcphdr),
set mss to IPV6_MAXPLEN - sizeof(struct tcphdr), not IPV6_MAXPLEN.

Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
---
 net/ipv6/route.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Eric Dumazet Feb. 28, 2012, 9:56 a.m. UTC | #1
Le mardi 28 février 2012 à 16:28 +0800, roy.qing.li@gmail.com a écrit :
> From: RongQing.Li <roy.qing.li@gmail.com>
> 
> When mss is bigger than IPV6_MAXPLEN - sizeof(struct tcphdr),
> set mss to IPV6_MAXPLEN - sizeof(struct tcphdr), not IPV6_MAXPLEN.
> 
> Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
> ---
>  net/ipv6/route.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 92be12b..42cc16c 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1054,7 +1054,7 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst)
>  	 * rely only on pmtu discovery"
>  	 */
>  	if (mtu > IPV6_MAXPLEN - sizeof(struct tcphdr))
> -		mtu = IPV6_MAXPLEN;
> +		mtu = IPV6_MAXPLEN - sizeof(struct tcphdr);
>  	return mtu;
>  }
>  

Hmm... What about the comment above the code mentioning pmtu discovery ?

        /*
         * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and
         * corresponding MSS is IPV6_MAXPLEN - tcp_header_size.
         * IPV6_MAXPLEN is also valid and means: "any MSS,
         * rely only on pmtu discovery"
         */


Check out code from net/ipv6/ip6_output.c, ip6_append_data() :

        if (mtu <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN) {
                if (cork->length + length > sizeof(struct ipv6hdr) + IPV6_MAXPLEN - fragheaderlen) {
                        ipv6_local_error(sk, EMSGSIZE, fl6, mtu-exthdrlen);
                        return -EMSGSIZE;
                }
        }

and __ip6_local_out()

	if (len > IPV6_MAXPLEN)
		len = 0;





--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 92be12b..42cc16c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1054,7 +1054,7 @@  static unsigned int ip6_default_advmss(const struct dst_entry *dst)
 	 * rely only on pmtu discovery"
 	 */
 	if (mtu > IPV6_MAXPLEN - sizeof(struct tcphdr))
-		mtu = IPV6_MAXPLEN;
+		mtu = IPV6_MAXPLEN - sizeof(struct tcphdr);
 	return mtu;
 }