Skip to content

Backport patch from lwip2 to fix lwip1.4 behaviour with MTU<1500 #5902

Closed
@mcspr

Description

@mcspr

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: ESP-12
  • Core Version: [2019/03/21 git 8961bba]
  • Development Env: Arduino IDE
  • Operating System: Any

Settings in IDE

  • Module: Generic ESP8266 Module
  • lwip Variant: v1.4
  • Flash Mode: dout
  • Flash Size: 4MB
  • CPU Frequency: 80Mhz
  • Upload Using: SERIAL
  • Upload Speed: 115200 (serial upload only)

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)

> netsh interface ipv4 set subinterface "WLAN" mtu=1492

In browser, using lwip v1.4:

SDK:2.2.2-dev(c0eb301)/Core:unix-2.6.0-dev=-194000/lwIP:1.4.0rc2/BearSSL:6778687
client connected

Same log with lwip2 low memory:

SDK:2.2.2-dev(c0eb301)/Core:unix-2.6.0-dev=-194000/lwIP:STABLE-2_1_2_RELEASE/glue:1.1-2-ga501b57/BearSSL:6778687
client connected
aaaaaaaaaaaaaa...
aaaaaaaaaaaaaa...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions