Skip to content
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

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

Closed
wants to merge 1 commit into from

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.

None yet

1 participant