public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: roy.qing.li@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] ipv4: fix mss comparison
Date: Tue, 28 Feb 2012 02:01:18 -0800	[thread overview]
Message-ID: <1330423278.2610.17.camel@edumazet-laptop> (raw)
In-Reply-To: <1330417697-2637-2-git-send-email-roy.qing.li@gmail.com>

Le mardi 28 février 2012 à 16:28 +0800, roy.qing.li@gmail.com a écrit :
> From: RongQing.Li <roy.qing.li@gmail.com>
> 
> mss should compare with 65535 - sizeof(struct tcphdr),  
> the largest mss is 65535 - sizeof(struct tcphdr).  
> 40 is sum of sizeof(struct tcphdr) and sizeof(struct iphdr)
> 
> Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
> ---
>  net/ipv4/route.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 0489ced..c72f765 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1914,8 +1914,8 @@ static unsigned int ipv4_default_advmss(const struct dst_entry *dst)
>  	if (advmss == 0) {
>  		advmss = max_t(unsigned int, dst->dev->mtu - 40,
>  			       ip_rt_min_advmss);
> -		if (advmss > 65535 - 40)
> -			advmss = 65535 - 40;
> +		if (advmss > 65535 - sizeof(struct tcphdr))
> +			advmss = 65535 - sizeof(struct tcphdr);
>  	}
>  	return advmss;
>  }

Hmm... I am puzzled.

1) If you touch this code, please use min_t() macro to be consistent
with prior line ? Please note I dont advocate a general use of these
min/max macros, just some consistency in the same page of code.

2) Prior line still has the magic 40 value.
    (I personally like 40 more than sizeof(struct tcphdr) +
sizeof(struct iphdr)), its not like 40 is going to change one day :)

3) What is the maximum datagram size in ipv4.
      (Say you name this IPV4_MAXPLEN)

4) What would be the meaning of having TCP MSS bigger than
    IPV4_MAXPLEN - 40 ?

  parent reply	other threads:[~2012-02-28 10:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28  8:28 [PATCH 1/2] ipv6: fix mss when it is bigger than IPV6_MAXPLEN - sizeof(struct tcphdr) roy.qing.li
2012-02-28  8:28 ` [PATCH 2/2] ipv4: fix mss comparison roy.qing.li
2012-02-28  9:34   ` Francois Romieu
2012-02-28  9:55     ` RongQing Li
2012-02-28 10:01   ` Eric Dumazet [this message]
2012-02-28  9:56 ` [PATCH 1/2] ipv6: fix mss when it is bigger than IPV6_MAXPLEN - sizeof(struct tcphdr) Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330423278.2610.17.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=roy.qing.li@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox