[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Getting the server to use an MSS larger than 536
From: |
Mason |
Subject: |
Re: [lwip-users] Getting the server to use an MSS larger than 536 |
Date: |
Wed, 21 Mar 2012 17:45:52 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20120216 Firefox/10.0.2 SeaMonkey/2.7.2 |
Simon Goldschmidt wrote:
> Mason wrote:
>
>> Note that Google sends only 590-byte frames. How do I get lwip
>> to advertize larger MSS?
>>
>> NB: I have the following TCP-related definitions in my lwipopts.h
>>
>> #define TCP_MSS 1460
>> #define TCP_WND (40*TCP_MSS)
>> #define TCP_SND_BUF (8*TCP_MSS)
>> #define TCP_SND_QUEUELEN 16
>>
>> There's relevant code in src/core/tcp.c
>>
>> pcb->snd_wnd = TCP_WND;
>> /* As initial send MSS, we use TCP_MSS but limit it to 536.
>> The send MSS is updated when an MSS option is received. */
>> pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS;
>> #if TCP_CALCULATE_EFF_SEND_MSS
>> pcb->mss = tcp_eff_send_mss(pcb->mss, ipaddr);
>> #endif /* TCP_CALCULATE_EFF_SEND_MSS */
>
> In that case (if you have set netif->mtu to 1500), tcp_eff_send_mss()
> should return 1460 (1500 - IP_HLEN - TCP_HLEN). If it doesn't,
> possible problems could be that ip_route() doesn't return your netif
> or that netif->mtu isn't set to 1500.
>
>> When I receive Google's SYN+ACK packet with MSS=1430 in
>> tcp_parseopt, the pcb mss is correctly set to 1430. Perhaps
>> this is only the /write/ MSS?
>
> Yes, this is lwIP's send MSS, while the initial pcb->mss is used to
> construct an MSS option in the initial SYN packet sent on connect.
Applying the following patch makes the distant system send larger
frames (1484 bytes in Google's case, 1430-byte segment).
--- tcp.c.orig 2012-02-23 10:57:12.843750000 +0100
+++ tcp.c 2012-03-21 17:29:25.515625000 +0100
@@ -749,7 +749,7 @@
pcb->snd_wnd = TCP_WND;
/* As initial send MSS, we use TCP_MSS but limit it to 536.
The send MSS is updated when an MSS option is received. */
- pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS;
+ pcb->mss = TCP_MSS;
#if TCP_CALCULATE_EFF_SEND_MSS
pcb->mss = tcp_eff_send_mss(pcb->mss, ipaddr);
#endif /* TCP_CALCULATE_EFF_SEND_MSS */
I don't understand the comment explaining why the MSS is clipped.
Does this come from an RFC?
Relevant commits are:
http://git.savannah.gnu.org/cgit/lwip.git/commit/?id=2d5908f4dedeac4ae2f568bd6f06ea218de5a125
http://git.savannah.gnu.org/cgit/lwip.git/commit/?id=aee9c4c8e6c9ec54783f3657c40be96753c72dd9
--
Regards.