From a11655b9294bdb1aa41dfb4b140576fcf55441ee Mon Sep 17 00:00:00 2001 From: CValdesS Date: Wed, 16 Sep 2026 15:38:21 +0200 Subject: [PATCH] Transport: emit mtu and TX-drop counters in the remote status payload rnstatus from RNS 1.5.x reads ifstat["txdrp"] (and then "txdrb") without checking for the key, and ifstat["mtu"] whenever "bitrate" is present, so a remote status query against a microReticulum node crashed the client with a KeyError right after the first interface. Add mtu (HW_MTU, or the Reticulum MTU when the interface has none) and txdrp/txdrb/txbuffered/txstalled as zeros: there is no TX drop accounting on this side yet, and zero is what a Python interface without drops reports. --- src/microReticulum/Transport.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/microReticulum/Transport.cpp b/src/microReticulum/Transport.cpp index 89b5238b..56245194 100644 --- a/src/microReticulum/Transport.cpp +++ b/src/microReticulum/Transport.cpp @@ -3853,7 +3853,7 @@ static void remote_status_pack_interface(MsgPack::Packer& p, const Interface& if // ignore unknown keys; clients that look for them get the receiving // interface's last reported signal-quality stats, with nil for "not // reported by this interface" (e.g. non-radio interfaces such as UDP). - p.packMapSize(18); + p.packMapSize(23); // Cache std::string values so .c_str() / .size() reference stable storage. const std::string name_str = iface.toString(); @@ -3901,6 +3901,20 @@ static void remote_status_pack_interface(MsgPack::Packer& p, const Interface& if p.pack("txb"); p.serialize(static_cast(iface.txbytes())); + // rnstatus 1.5.x reads these without a presence check: `mtu` whenever + // `bitrate` is set, and `txdrp` (then `txdrb`) unconditionally. There is no + // TX drop accounting here, so they report zero rather than crash the client. + p.pack("mtu"); + p.serialize(static_cast(iface.HW_MTU() > 0 ? iface.HW_MTU() : Type::Reticulum::MTU)); + p.pack("txdrp"); + p.serialize(static_cast(0)); + p.pack("txdrb"); + p.serialize(static_cast(0)); + p.pack("txbuffered"); + p.serialize(static_cast(0)); + p.pack("txstalled"); + p.serialize(static_cast(0)); + p.pack("rxs"); p.packFloat64(iface.current_rx_speed());