-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Telnet shell asserts if connection is closed #67637
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
Comments
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
This issue is still present in the rewritten telnet server in 3.7.0: As a result we're having to maintain a patched version of the telnet server that returns 0 when the connection closes, to avoid crashing our whole application. |
@kevinior if you have a patch for this, could you submit a PR for it? |
We just patched the |
Yeah, that sounds a bit hackish to me. But you could try to send it still, the review could give ideas how to solve it better. |
@jukkar OK, I've created a PR for the hackish fix. |
@jukkar No responses to the PR so far |
The code in shell_ops.c that calls telnet_write will assert if it returns non-zero. For a telnet shell it's normal that the network might disconnect unexepectedly, so that should not trigger an assert. Fixes zephyrproject-rtos#67637 Link: zephyrproject-rtos#67637 Signed-off-by: Kevin ORourke <[email protected]>
The code in shell_ops.c that calls telnet_write will assert if it returns non-zero. For a telnet shell it's normal that the network might disconnect unexepectedly, so that should not trigger an assert. Fixes #67637 (cherry picked from commit 3399e06) Original-Link: zephyrproject-rtos/zephyr#67637 Original-Signed-off-by: Kevin ORourke <[email protected]> GitOrigin-RevId: 3399e06 Cr-Build-Id: 8734380568354140561 Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8734380568354140561 Copybot-Job-Name: zephyr-main-copybot-downstream Change-Id: I4f40ac58f0ee844e4dff85196727fd3b4f56939d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5925541 Commit-Queue: Jeremy Bettis <[email protected]> Tested-by: ChromeOS Prod (Robot) <[email protected]> Tested-by: Jeremy Bettis <[email protected]> Reviewed-by: Jeremy Bettis <[email protected]>
Describe the bug
Some extra discussion about the issue can be found in PR #67596, basically telnet shell asserts if telnet connection is closed.
If asserts are disabled no visible error was seen, but according to the code in
zephyr/subsys/shell/shell_ops.c
Line 425 in 11f7fa2
the internal variables in the
z_shell_write()
could contain invalid values which could corrupt internal state of the shell.To Reproduce
Setup the network by executing
tools/net-tools/net-setup.sh
that is found in net-tools zephyr project.and then execute
echo x | telnet 192.0.2.1
from the host.Expected behavior
The telnet connection is closed without any errors / crashes.
Impact
If the asserts are enabled, the crashing of the system is not necessary as we just closed the connection.
If the asserts are disabled, the internal state of the shell might cause corruption.
Logs and console output
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: