-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
LwIP seems to not correctly handle packages larger than MTU #2751
Comments
(testing lwip options) compiling with
in $SMING_HOME/Components/lwip/lwipopts.h did not change the behaviour. request tcp header:
response:
so the firmware correctly acks for 1390 bytes of payload, which is just right for the default TCP_MSS at 1390 bytes. But there still is no ICMP fragmentation required package being sent, which I would expect would be used to help determine the allowable MTU for this connection. Is there another lwip setting for that somewhere? The lwip documentation indicates it can do it. |
further checking with ENABLE_LWIPDEBUG=! I see
but the sequence numbers don't match with what I see in wireshark (which might be because lwip debug outputs them as signed integers :o) also, I can't see TCP RST packages on the packet trace, when filtered for the sming node's address. The front end, however, seems to respond to the sming app only acknowledging part of the data by re-sending the missing part - which is never ack'd by sming. |
Maybe unrelated to your issue, but there's clearly memory pressure. Assuming this is your |
Good point, also, the original design keeps the whole configuration in a large struct which alone is at least around 1.5kB and is not really used that much, so I should probably refractor this as well. 4.5kB more RAM is 25% more than now, so that should certainly be helpful. |
I have moved almost all string literals into F() and now have mostly >20kB of heap free, so that was well worth while the effort. (as a side note: the F macro doesn't work for debug_ - why would that be?) |
|
I'm not 100% sure that my lwipopts.h is used - where should that be placed to enable specific options? in the build directory? in the ./include directory? |
lwipopts customisation isn't supported by Sming. What specific changes do you need? |
from going through the lwipopts.h, I would think that
are what should allow fragmentation / reassembly (and with that, hopefully, path MTU) |
You can add these to your project's
This will require a full |
I'll give it a try |
this is an unexpected result
with
in component.mk with just
it compiles. That should be enough.... |
|
oh dang! thanks |
hmm.. no, that doesn't fix it. |
Note that serialising via You'll need a different approach to send large JSON serialisations. The following sample application does this using a custom stream and serialisation in parts. Source is in the |
trying to figure out the odd ip/tcp behaviour - which lwip is built by default? https://sming.readthedocs.io/en/latest/_inc/Sming/Components/lwip/index.html#envvar-ENABLE_CUSTOM_LWIP docments ENABLE_CUSTOM_LWIP defaulting to 2 for lwip2?
in my component.mk yields strange build issues
(and I really hope it's not a forgotten = or something as stupid again)
|
That page is for Host, see https://sming.readthedocs.io/en/latest/_inc/Sming/Arch/Esp8266/Components/sming-arch/index.html
Yep, me too - requires |
that alone doesn't do it for me, but I had a similar issue with enabling TCP_DEBUG which also required IP_DEBUG which is where the #defines were. currently, I compile with
and
and still get those build errors. btw: I am always amazed how complex the whole environment is. It never stops boggling the mind how much code and functionality fits on those tiny controllers nowadays (well, already did fit on it a decade ago, for the ESP8266). |
Fix for debug build errors,
PR #2754 |
that alone doesn't do it for me, but I had a similar issue with enabling TCP_DEBUG which also required IP_DEBUG which is where the #defines were. currently, I compile with
and
and still get those build errors. btw: I am always amazed how complex the whole environment is. It never stops boggling the mind how much code and functionality fits on those tiny controllers nowadays (well, already did fit on it a decade ago, for the ESP8266). |
puh, not sure lwip2, feels like lwip will lead into the next rabbit hole:
stack decode:
I found that pbuf_free is #defined as pbuf_free_LWIP2, but could not find that function anywhere in Sming/Sming. |
same thing again (albeit without the OS errors )
This is 100% reproducible - but I can't see at a glance if it's a double free or really a free on an unaligned address (I can't imagine how that would happen as pbuf_free takes a pbuf pointer that has been used by other functions before) |
(I'll open a new issue for that if you want) |
I get the same errors with lwip2, running in debugger:
May I suggest that you refactor code so as much of it as possible runs under the Host emulator. Then run it through valgrind - it can pick up a lot of issues. |
Regarding the original subject of this post, if you can reproduce the issue with one of the sample applications that would be helpful. |
sigh, I've replaced
with
and that fixed the oversized json package issue. |
The LWIP2 stack is pretty dated for esp8266, fork is from 2017. Upstream at https://github.com/d-a-v/esp82xx-nonos-linklayer is more actively developed but porting it not a job not for the feint-hearted! It's always hacky due to the closed-source nature of Espressif's low-level stuff. The |
I was a bit worried that it maybe had fallen behind modern standard use cases, but as said, using the getBodyStream() method seems to have done the trick (I think I have mentioned before that I have inherited this code which in itself is probably 10 years old by now) |
Due to an ever growing json structure, my client sends an ip package larger than the MTU of 1500 bytes (1960 bytes to be precise). Due to path MTU being on by default, my client ip stack happily sends this package out to the wire, expecting to be told if that's not what is expected.
On Sming, when I check the body length, I get 1497 bytes, so the rest is basically just cut off.
Expected behaviour:
the lwip stack should quietly discard the received package and respond to the sender with an ICMP "fragmentation required" package, allowing the sender to configure the best package size for this receiver.
I have not yet dug into the lwip debug for this, but the observed behaviour clearly points toward lwip not helping with path discovery.
The text was updated successfully, but these errors were encountered: