Browse Source

shell: backend: telnet: Don't assert if connection closed

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

Link: https://github.com/zephyrproject-rtos/zephyr/issues/67637

Signed-off-by: Kevin ORourke <kevin.orourke@ferroamp.se>
(cherry picked from commit 3399e0614a)
backport-78976-to-v3.7-branch
Kevin ORourke 10 months ago committed by github-actions[bot]
parent
commit
3a4bd352d3
  1. 7
      subsys/shell/backends/shell_telnet.c

7
subsys/shell/backends/shell_telnet.c

@ -704,7 +704,12 @@ static int telnet_write(const struct shell_transport *transport, @@ -704,7 +704,12 @@ static int telnet_write(const struct shell_transport *transport,
err = telnet_send(true);
if (err != 0) {
*cnt = length;
return err;
if ((err == -ENOTCONN) || (err == -ENETDOWN)) {
LOG_ERR("Network disconnected, shutting down");
} else {
LOG_ERR("Error %d, shutting down", err);
}
return 0; /* Return 0 to not trigger ASSERT in shell_ops.c */
}
}

Loading…
Cancel
Save