TCP sockets aren't reset on ethernet cable reconnect #111
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It is possible to leave TCP sessions open when disconnecting an Ethernet cable to the Thermostat, and when reconnected they don't reset if the telnet client has already been killed prior.
This makes it possible to gradually use up all 4 TCP sessions, making the Thermostat refuse any new connections to it when we've lost all handles on previous sessions already, soft-locking it.
How is this handled in other projects like stabilizer?
I haven't looked at Stabilizer yet but on Kirdy the TCP sockets are explicitly reset once a new link is up, and that doesn't seem to happen here. I'll need to port that over.
Please look at Stabilizer first.
Resetting all sockets on Ethernet link drop isn't necessarily the right thing to do and Kirdy might need fixing as well.
Stabilizer Firmware does reset all the sockets when Ethernet link is dropped. Just the part that reset all sockets is written inside the smoltcp-nal crate.
74c43885d9/src/net/network_processor.rs (L38-L56)
e0c131d55e/src/lib.rs (L349-L363)
Doesn't sound like a very sensible thing to do. Better (1) increase the number of sockets (we have a bloated MCU so we might as well make use of it) (2) terminate stale connections by implementing a heartbeat mechanism (TCP keepalive is built into smoltcp and could be used easily on the device side) and/or closing the oldest connection when a new one comes and we're out of socket handles.