Fix packet, delivery, clock and radio stability regressions

Reject truncated anonymous reply paths and advert metadata before copying,
while preserving timestamp-only empty-password logins. Limit room posting to
read-write/admin ACL roles, retain inbox frames until the requesting transport
accepts them, and lock raw LittleFS traversal against concurrent writes.

Separate ISR event generations from main-loop radio state. Confirm RX/TX IRQs,
detach concrete wrapper callbacks safely, and discard inconsistent LR2021 FIFO
snapshots before rearming. Preserve bridge RX frames through packet-pool
exhaustion and bound ESP-NOW retries and missing-callback recovery. Screen RTC
register layouts without losing DS1307 startup, and ignore poisoned future
contact timestamps during clock bootstrap.

Keep the nRF52 loop stack at 8 KiB while reducing the OTA listing call chain
from 7,832 to 6,056 static bytes. Retain all target names through lossless Full
Companion compression and the canonical size optimizer. Preserve constrained
STM32 filesystems and bind corrected ESP32 UART/OLED budgets to source size
assertions. Document the separately measured preexisting W12 package limits.

Adapted for this branch from meshcore-dev/MeshCore PRs #3521, #3340, #3362,
#2062, #3503, #3038, #3534, #3544 and #3512.

Validation: 1,829 native tests; sanitized parser, inbox, LittleFS, ACL, clock,
RTC, IRQ/FIFO and bridge fault tests; 332 additional Companion cases; real
RAK4631 Full and both repeater profiles, G2 Full/standard, V3 Full and both
constrained STM32 release recipes. Radio-family compile coverage continues
separately; W12 full/portable package guards remain enforced.
This commit is contained in:
mikecarper committed 2026-10-09 19:56:08 -07:00
1 parent f79a316da8
commit ddf625e9d0
60 files changed
+3647 -369

No files matched your search

+22 -28
View File
@@ -913,36 +913,30 @@ void MyMesh::onPeerDataRecv(mesh::Packet *packet, uint8_t type, int sender_idx,
bool send_ack = false;
if (flags == TXT_TYPE_PLAIN) {
const bool is_guest =
(client->permissions & PERM_ACL_ROLE_MASK) == PERM_ACL_GUEST;
if (is_guest) {
if (sender_timestamp < client->extra.room.last_post_timestamp) {
MESH_DEBUG_PRINTLN("onPeerDataRecv: stale room post detected");
return;
}
client->extra.room.last_post_timestamp = sender_timestamp;
} else {
uint8_t message_fingerprint[MAX_HASH_SIZE];
mesh::Utils::sha256(message_fingerprint, sizeof(message_fingerprint),
client->id.pub_key, PUB_KEY_SIZE,
(const uint8_t*)text, text_len);
const auto replay_decision = recent_room_posts.classifyAndRemember(
message_fingerprint, sender_timestamp,
client->extra.room.last_post_timestamp);
const uint8_t role = client->permissions & PERM_ACL_ROLE_MASK;
// Management roles grant their specific CLI permissions, not room posting.
if (role != PERM_ACL_READ_WRITE && role != PERM_ACL_ADMIN) return;
using ReplayDecision =
mesh::LogicalMessageCache<ROOM_MESSAGE_CACHE_SIZE>::ReplayDecision;
if (replay_decision == ReplayDecision::StaleOrMismatched) {
MESH_DEBUG_PRINTLN("onPeerDataRecv: stale or mismatched room post detected");
return;
}
if (replay_decision == ReplayDecision::NewMessage) {
addPost(client, text);
}
// Exact retries are ACKed again regardless of whether newer posts have
// advanced this client's room-post replay timestamp.
send_ack = true;
uint8_t message_fingerprint[MAX_HASH_SIZE];
mesh::Utils::sha256(message_fingerprint, sizeof(message_fingerprint),
client->id.pub_key, PUB_KEY_SIZE,
(const uint8_t*)text, text_len);
const auto replay_decision = recent_room_posts.classifyAndRemember(
message_fingerprint, sender_timestamp,
client->extra.room.last_post_timestamp);
using ReplayDecision =
mesh::LogicalMessageCache<ROOM_MESSAGE_CACHE_SIZE>::ReplayDecision;
if (replay_decision == ReplayDecision::StaleOrMismatched) {
MESH_DEBUG_PRINTLN("onPeerDataRecv: stale or mismatched room post detected");
return;
}
if (replay_decision == ReplayDecision::NewMessage) {
addPost(client, text);
}
// Exact retries are ACKed again regardless of whether newer posts have
// advanced this client's room-post replay timestamp.
send_ack = true;
} else { // TXT_TYPE_CLI_DATA or TXT_TYPE_CLI_COMMAND
uint32_t request_id = sender_timestamp;
mesh::RemoteCliRequest::parse(data, len, 5, request_id);