Skip to content

Commit 8f17900

Browse files
committed
Address GUVWAF feedback: count short-RX as rxGood + promote invalid-protobuf to WARN
GUVWAF flagged two remaining log/counter items on the hardened RX path: - RadioLibInterface.cpp: the short-packet branch was neither rxGood nor rxBad after the previous revision. Move rxGood++ above the payloadLen<0 check so every CRC-passed OTA reception counts regardless of subsequent header-validation outcome. - Router.cpp: 'Invalid protobufs in received mesh packet (bad psk?)' is more than DEBUG-worthy — either our channel key is wrong or someone's feeding us corrupted data. Promote to LOG_WARN per GUVWAF's request. ("Invalid portnum" at the same site stays at LOG_DEBUG — that one only means the decoded protobuf had the default portnum field, which is a weaker signal.)
1 parent 65117c0 commit 8f17900

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/mesh/RadioLibInterface.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,11 +505,15 @@ void RadioLibInterface::handleReceiveInterrupt()
505505
// Skip the 4 headers that are at the beginning of the rxBuf
506506
int32_t payloadLen = length - sizeof(PacketHeader);
507507

508+
// CRC-good OTA reception — count as rxGood regardless of whether we process
509+
// it further. Short/from==0/pool-exhausted packets still represent successful
510+
// airtime usage and shouldn't silently vanish from the stats.
511+
rxGood++;
512+
508513
// check for short packets
509514
if (payloadLen < 0) {
510515
LOG_WARN("Ignore received packet too short");
511516
} else {
512-
rxGood++;
513517
// altered packet with "from == 0" can do Remote Node Administration without permission.
514518
// Still counted as a "good" OTA reception above — we just refuse to process it.
515519
if (radioBuffer.header.from == 0) {

src/mesh/Router.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ DecodeState perhapsDecode(meshtastic_MeshPacket *p)
499499
meshtastic_Data decodedtmp;
500500
memset(&decodedtmp, 0, sizeof(decodedtmp));
501501
if (!pb_decode_from_bytes(bytes, rawSize, &meshtastic_Data_msg, &decodedtmp)) {
502-
LOG_DEBUG("Invalid protobufs in received mesh packet id=0x%08x (bad psk?)", p->id);
502+
LOG_WARN("Invalid protobufs in received mesh packet id=0x%08x (bad psk?)", p->id);
503503
} else if (decodedtmp.portnum == meshtastic_PortNum_UNKNOWN_APP) {
504504
LOG_DEBUG("Invalid portnum (bad psk?)");
505505
#if !(MESHTASTIC_EXCLUDE_PKI)

0 commit comments

Comments
 (0)