-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport patch from lwip2 to fix lwip1.4 behaviour with MTU<1500 #5902
Comments
Out of curiosity, what is preventing you from using lwIP-v2 ? TBH, the primary goal of lwip2 was exactly to avoid your situation: |
I happened to notice this when trying to fix issues with the app running 2.3.0, and testing with other versions happen to pinpoint LWIP1 as the culprit. Since it is a (still) selectable menu option , I thought it might warrant a patch. (although, I have missed how old lwip source actually is...) Also, TBH, I would agree that using a single library source is much easier :) Amazing work on that. |
@earlephilhower @devyte Should we mark lwIP-v1.4 as deprecated for the next release ? |
Yes, I'd like to get rid of it in next major. |
ref: d-a-v/esp82xx-nonos-linklayer#31 origin: #5902 me-no-dev/ESPAsyncTCP#108 Following the links above is instructive. To summarize: * currently and from a long time lwIP tcp client connections always uses the same tcp source port number right after boot * this port number is increased everytime a new one is needed (= new tcp client connection) (to be noted, linux has the same increasing behavior) * when connecting to the same server (right after boot), the triplet (esp-ip-address, source port, destination port) are the same, and may hit remote server list of sockets in time-wait-state (previous connection unproperly closed from the same esp). Consequently the new connection fails when it happens. * this is happening only when debugging (esp reboots often, in less time than time-wait expiration), so the nasty effect is amplified especially when bugs are being chased * efforts had been done when espressif's lwIP implementation wasn't open source, with WiFiClient::setLocalPortStart() #632 but it must be explicitely called with a different random number at every reboot. Efficient but not ideal. This PR uses espressif firmware's r_rand() everytime a new local source port is needed. A different source port number is now showed by tcpdump right after boot. Source port range and duplication is verified everytime in lwIP's src/core/tcp.c:tcp_new_port(). It is implemented as a local patch for upstream lwIP so it is valid not only with WiFiClient but also with @me-no-dev's Async libraries (they don't use WiFiClient). WiFiClient::setLocalPortStart() is still usable with the same effects as before.
Resolved via #7436, no more lwip1.4 |
Basic Infos
Platform
Settings in IDE
Problem Description
Using ESPAsyncTCP, ESPAsyncWebServer, AsyncWebSocket, lwip v1.4
It is impossible to receive data-chunk larger than MSS size via websockets if MTU of the client device is different from 1500. I can see data is sent to the router, but fragmenting does not work properly, so router refuses to send the data further. Surprisingly, HTML is sent properly.
I was able to find one related issue:
#2437
This was already fixed in lwip2. Related issue + fix:
http://savannah.nongnu.org/bugs/?46384
http://git.savannah.gnu.org/cgit/lwip.git/commit/src?id=8e8571da6a6771f9d2d82bbd0b5a6c27474ce0fc
Can we apply this patch to the local tree here and rebuild
liblwip_gcc.a
so pre built option works too?MCVE Sketch
Gist of the sketch, to avoid blowing up the issue with long strings:
https://gist.github.com/mcspr/00e95d3ea8d680aeaa04cbe8a707ba8d
Debug Messages
On Windows machine with MTU of 1492 (meaning, MSS is auto calculated to be 1452)
In browser, using lwip v1.4:
Same log with lwip2 low memory:
The text was updated successfully, but these errors were encountered: