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

net: telnet: Switch TELNET shell backend to use sockets #69612

Merged

Conversation

rlubos
Copy link
Contributor

@rlubos rlubos commented Feb 29, 2024

Rework TELNET shell backend to use socket API for communication and socket service library for socket monitoring.
Improve TELNET command parsing to make it more robust against possible stream fragmentation.

Socket service pollfd count should not exceed the configured
NET_SOCKETS_POLL_MAX limit, as poll() will not be able to monitor
sockets beyond that limit anyway. Adding +1 there prevented the library
from catching the configuration error.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
@rlubos rlubos force-pushed the net/switch-telnet-to-socket-service branch from 6a7fc4e to 8a8fea8 Compare March 1, 2024 08:38
@jukkar jukkar requested a review from pdgendt March 1, 2024 13:49
Rework TELNET shell backend to use socket API for communication and
socket service library for socket monitoring.

Additionally, rework the TX part so that non-blocking TX is used when
sending from the system work queue. In case transfer is not possible at
the moment, the TX work is rescheduled instead of blocking the system
work queue.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Current TELNET implementation wrongly assumed that if the command is
present, it will always be included at the beginning of the packet/data
buffer. Such assumptions however are not valid for STREAM sockets,
where the actual stream data could be fragmented in any way.

Therefore, the command parsing needed rework, so that we analyze each
byte received for the command escape code, and once received we enter
"command parsing" mode. Once no more commands are identified in a data
streak, the command bytes are removed from the data buffer before the
buffer is provided to the shell subsystem for processing.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Rename command defines to make checkpatch happy.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
@rlubos rlubos force-pushed the net/switch-telnet-to-socket-service branch from 8a8fea8 to c835188 Compare March 4, 2024 08:24
@jukkar
Copy link
Member

jukkar commented Mar 11, 2024

ping @jakub-uC, PTAL

Copy link
Contributor

@jakub-uC jakub-uC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a telnet expert :) However it looks good to me.

@dleach02 dleach02 merged commit 4300f04 into zephyrproject-rtos:main Mar 11, 2024
22 checks passed
@jukkar
Copy link
Member

jukkar commented Mar 12, 2024

I am not a telnet expert :) However it looks good to me.

I asked your review because you are the assignee of the PR, and there seems to be a rule that the assignee should +1 the PR before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking area: Shell Shell subsystem area: Sockets Networking sockets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants