From f475be19c622bde013dacad655df2dd537b30ea7 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Wed, 8 Apr 2026 14:27:15 -0500 Subject: [PATCH] Dumb fixes --- bin/dmshell_client.py | 6 +++--- src/modules/DMShell.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/dmshell_client.py b/bin/dmshell_client.py index 12da26104..c20eda5e7 100644 --- a/bin/dmshell_client.py +++ b/bin/dmshell_client.py @@ -297,9 +297,9 @@ def drain_events(state: SessionState) -> None: def run_command_mode(sock: socket.socket, state: SessionState, commands: list[str], close_after: float) -> None: for command in commands: - send_shell_frame(sock, state, state.mesh_pb2.DMShell.INPUT, (command + "\n").encode("utf-8")) + send_shell_frame(sock, state, state.pb2.mesh.DMShell.INPUT, (command + "\n").encode("utf-8")) time.sleep(close_after) - send_shell_frame(sock, state, state.mesh_pb2.DMShell.CLOSE) + send_shell_frame(sock, state, state.pb2.mesh.DMShell.CLOSE) state.closed_event.wait(timeout=close_after + 5.0) @@ -330,7 +330,7 @@ def run_interactive_mode(sock: socket.socket, state: SessionState) -> None: if len(parts) != 3: print("usage: /resize COLS ROWS", file=sys.stderr) continue - send_shell_frame(sock, state, state.pb2.mesh.DMShell.RESIZE, cols=int(parts[1]), rows=int(parts[2])) + send_shell_frame(sock, state, state.pb2.mesh.DMShell.RESIZE, cols=int(parts[1]), rows=int(parts[2])) continue send_shell_frame(sock, state, state.pb2.mesh.DMShell.INPUT, (line + "\n").encode("utf-8")) diff --git a/src/modules/DMShell.cpp b/src/modules/DMShell.cpp index ba7ad7acb..84d8a8f9a 100644 --- a/src/modules/DMShell.cpp +++ b/src/modules/DMShell.cpp @@ -83,6 +83,11 @@ ProcessMessage DMShellModule::handleReceived(const meshtastic_MeshPacket &mp) return ProcessMessage::STOP; } + if (frame.op >= 64) { + LOG_WARN("DMShell: ignoring frame with op code %d", frame.op); + return ProcessMessage::CONTINUE; + } + if (!isAuthorizedPacket(mp)) { LOG_WARN("DMShell: unauthorized sender 0x%x", mp.from); myReply = allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp); @@ -234,7 +239,7 @@ bool DMShellModule::isAuthorizedPacket(const meshtastic_MeshPacket &mp) const bool DMShellModule::openSession(const meshtastic_MeshPacket &mp, const DMShellFrame &frame) { if (session.active) { - closeSession("preempted", true); + closeSession("preempted", false); } int masterFd = -1;