Repository navigation
Conversation
…s it When a line filled the buffer, ethernet_read_line() wrote '\r' over the terminating NUL at buf_size-1, so the next call's strlen() ran past the end of the buffer (AddressSanitizer: stack-buffer-overflow with a 200- character line into the 160-byte buffer). Treat a full buffer as a completed line instead, the way the serial CLI loop already does.
A telnet line longer than the 160-byte command buffer was cut at the buffer size and the first part run as a command; the rest then ran as a second command. A truncated command can do something other than what was typed (a cut-off "set" value, for example). Now the line is answered with "ERR: line too long", the rest of it is discarded up to the end of the line, and nothing runs. The longest line that fits still runs as before.
Browsers cannot open raw TCP sockets, so web tools (e.g. the MeshCore web config) could not reach the Ethernet CLI on the telnet port. Add a WebSocket server (default port 8023, -D ETHERNET_WS_PORT=0 disables) to the RAK13800 Ethernet builds, serving the same CLI. - Minimal RFC 6455 server (EthernetWebSocket.h): strict handshake and frame validation, ping/pong, close, binary frames. - Browser Origin allowlist: localhost by default, plus -D ETHERNET_WS_ALLOWED_ORIGIN or -D ETHERNET_WS_ALLOW_ANY_ORIGIN=1. - One CLI session at a time: a new telnet connection, or a WebSocket connection once its handshake succeeds, replaces the current one. A half-typed line is not carried into the new session. - DHCP renewal is held back while all four W5100S sockets are in use (two listeners, the active session and a pending handshake): the library gives up renewing for good when it finds no free socket. - A client socket whose peer is gone is released before accept(): the library reuses closed sockets, and a stale handle could later stop() a socket that now belongs to a new connection. - Writes to a peer that stopped answering are bounded: the W5100S retransmission count is set to 3 (about 3 s instead of the chip's ~32 s worst case; -D ETHERNET_RETRANSMIT_COUNT to change it), and each telnet reply goes out in one write instead of three. - eth.status also reports the WebSocket port. - docs/cli_commands.md: WebSocket access, and a security note (the network console has no password). Tested on a RAK4631 + RAK13800 (W5100S).
On RAK13800 Ethernet builds, "eth.ota" (local serial console and Ethernet sessions only, not remote admin) reboots into the bootloader's Ethernet update mode, handing over the current IP, netmask, gateway, MAC and port 8024 in no-init RAM (EthernetDfu.h). The LoRa radio is put to sleep first. The command lives in the Ethernet CLI next to eth.status; no shared CLI code changes. It needs the OTAFIX bootloader built for wiscore_rak4631_ethernet_board: the firmware looks for that bootloader's marker string in the first 1 KB of the bootloader (cached) and refuses otherwise. eth.status reports "ota:<port>" or "ota:no-bootloader" so tools can tell before trying. The firmware is then uploaded from the MeshCore config tool (browser, over a WebSocket) or with the bootloader's tools/eth_dfu_upload.py. docs/cli_commands.md covers usage, security and known limitations. Tested on a RAK4631 + RAK13800 (W5100S).
This was referenced Nov 28, 2026
Open
Open
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second half of #3983: firmware updates without climbing the pole. This adds
eth.ota, an Ethernet-only command next toeth.status. It reboots into the bootloader's Ethernet update mode, so the node gets updated over the network instead of USB or Bluetooth.eth.statusshowsota:8024orota:no-bootloader, and on any other bootloadereth.otaanswers with an error and nothing happens. So merging this early is harmless.adafruit-nrfutil) or WebSocket (for the browser).start otais untouched.It's stacked on the WebSocket PR (#3985), which is stacked on #3980 and #3981; only the top commit (
Add "eth.ota": firmware update over Ethernet) is new here.Ethernet builds only: +1.3 KB flash. The docs cover the command and its limits: no authentication (trusted networks only), PoE power, and what to do after a power loss.
What I tested on my node (RAK4631 + RAK13800 + RAK19018):
eth.otafrom telnet (also with a trailing space), WebSocket and USB, each followed by an update;Not tested: PoE-only power, since my unit's battery can't be removed.
Want to use it before it's merged? The bootloader and firmware I tested, the uploader script and a step-by-step guide (USB once, then everything over Ethernet) are in my repo: https://github.com/jpdborgna/ham/tree/main/meshcore/rak (downloads: https://github.com/jpdborgna/ham/releases/tag/meshcore-rak-ethernet-2026-11-27).
I wrote this with help from Claude Code; I read every line and tested it on my node.