Skip to content

sys/net/telnet: automatically disconnect after period of inactivity#17897

Closed
benpicco wants to merge 1 commit intoRIOT-OS:masterfrom
benpicco:sys/net/telnet-workaround
Closed

sys/net/telnet: automatically disconnect after period of inactivity#17897
benpicco wants to merge 1 commit intoRIOT-OS:masterfrom
benpicco:sys/net/telnet-workaround

Conversation

@benpicco
Copy link
Contributor

@benpicco benpicco commented Apr 2, 2022

Contribution description

gnrc_tcp can't detect if a connection was lost (not closed), so terminate the connection after a period of inactivity to prevent losing the socket forever if we lose the connection.

Testing procedure

I tested this with examples/telnet_server on same54-xpro where I can easily trigger a loss of network connection by disconnecting the ethernet cable.
Make sure to set CONFIG_GNRC_TCP_CONNECTION_TIMEOUT_DURATION_MS to something lower than the default, otherwise you'll have to wait an additional 2 minutes for sock_tcp_disconnect() to return.

  • connect to the board with e.g telnet fe80::fec2:3dff:fe23:22df%eno1
  • disconnect the Ethernet cable
  • close the telnet application
  • wait 10s (CONFIG_TELNET_AUTO_DISCONNECT_SEC) and an additional ~10s (or whatever you have set for CONFIG_GNRC_TCP_CONNECTION_TIMEOUT_DURATION_MS)
  • connect the ethernet cable again
  • try to connect again with e.g. telnet fe80::fec2:3dff:fe23:22df%eno1

On master the new connection can not be established as the server is still connected to the stale socket.
With this patch you can connect to the server again.

Issues/PRs references

work-around for #17896

gnrc_tcp can't detect if a connection was lost (not closed) so terminate
the connection after a period of inactivity to prevent losing the socket
forever if we lose the connection.
@benpicco
Copy link
Contributor Author

superseded by #13082

@benpicco benpicco closed this Jul 13, 2022
@benpicco benpicco deleted the sys/net/telnet-workaround branch July 13, 2022 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: network Area: Networking Area: sys Area: System

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant