net: telnet: Fix character mode handling
If the telnet client operates in a character mode, it may send individual characters in packets. Such packets were dropped in the telnet shell backend instead of being process by the shell engine. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
d3d789d7ee
commit
0b63a9618b
1 changed files with 6 additions and 8 deletions
|
@ -30,7 +30,7 @@ struct shell_telnet *sh_telnet;
|
||||||
#define TELNET_LINE_SIZE CONFIG_SHELL_TELNET_LINE_BUF_SIZE
|
#define TELNET_LINE_SIZE CONFIG_SHELL_TELNET_LINE_BUF_SIZE
|
||||||
#define TELNET_TIMEOUT CONFIG_SHELL_TELNET_SEND_TIMEOUT
|
#define TELNET_TIMEOUT CONFIG_SHELL_TELNET_SEND_TIMEOUT
|
||||||
|
|
||||||
#define TELNET_MIN_MSG 2
|
#define TELNET_MIN_COMMAND_LEN 2
|
||||||
|
|
||||||
/* Basic TELNET implmentation. */
|
/* Basic TELNET implmentation. */
|
||||||
|
|
||||||
|
@ -196,14 +196,12 @@ static void telnet_recv(struct net_context *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
len = net_pkt_remaining_data(pkt);
|
len = net_pkt_remaining_data(pkt);
|
||||||
if (len < TELNET_MIN_MSG) {
|
|
||||||
LOG_DBG("Packet smaller than minimum length");
|
|
||||||
goto unref;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (telnet_handle_command(pkt)) {
|
if (len >= TELNET_MIN_COMMAND_LEN) {
|
||||||
LOG_DBG("Handled command");
|
if (telnet_handle_command(pkt)) {
|
||||||
goto unref;
|
LOG_DBG("Handled command");
|
||||||
|
goto unref;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fifo add */
|
/* Fifo add */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue