Hi Simon,
[ I'm not subscribed to the list, please keep me in cc' ]
[quote]
When TCP_WND is set to (for example) 1MiB, the initially advertised window in SYN packets ends up being 0. Would the fix below be sufficient?
> Shouldn't the #error check in init.c be enough to keep TCP_WND <= 0xffff (unless window scaling is enabled)?
This is exactly the scenario with window-scaling enabled (sorry that I didn't make it explicit). Hence, TCP_WND > 0xffff is legitimate.
#define TCP_WND (1*1048576)
#define LWIP_WND_SCALE 1
#define TCP_RCV_SCALE 7
#define LWIP_TCP_TIMESTAMPS 1
In my specific scenario, a Linux host opened a connection to a server-side LWIP application. The LWIP stack responded with SYN-ACK but, because of this bug, window was set to 0. Hence, the Linux app was not able to send any data (its request) immediately... what happened then, IIRC, is that Linux stack sent a window probe after some time, then LWIP responded with an ACK with the proper window (using the scaling factor). Only then Linux was able to send data.
This fix is similar to what the Linux stack does.
--Dmitry