Skip to content

Commit 649a3c2

Browse files
authored
fix: unify system payload queue filtering across linux and arduino paths
1 parent de20b48 commit 649a3c2

2 files changed

Lines changed: 11 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
### <!-- 4 --> 🛠️ Fixed
1212

13-
- Prevent non-fragment, non-external system payloads (e.g. mesh control-plane types) from leaking into the user queue on non-Linux/Arduino nodes
13+
- Prevent non-fragment, non-external system payloads (e.g. mesh control-plane types) from leaking into the normal user queue in `update()`, while still allowing `returnSysMsgs` handling and queueing fragments/external payloads
1414

1515
## [2.1.0] - 2026-04-08
1616

RF24Network.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -191,30 +191,24 @@ uint8_t ESBNetwork<radio_t>::update(void)
191191
write(header->to_node, TX_NORMAL);
192192
continue;
193193
}
194-
if ((returnSysMsgs && header->type > MAX_USER_DEFINED_HEADER_TYPE) || header->type == NETWORK_ACK) {
194+
bool isSystemType = header->type > MAX_USER_DEFINED_HEADER_TYPE;
195+
bool isQueueableSystemType = header->type == NETWORK_FIRST_FRAGMENT ||
196+
header->type == NETWORK_MORE_FRAGMENTS ||
197+
header->type == NETWORK_LAST_FRAGMENT ||
198+
header->type == EXTERNAL_DATA_TYPE;
199+
200+
if (header->type == NETWORK_ACK) {
195201
IF_RF24NETWORK_DEBUG_ROUTING(printf_P(PSTR("MAC System payload rcvd %d\n"), returnVal););
196-
if (header->type != NETWORK_FIRST_FRAGMENT && header->type != NETWORK_MORE_FRAGMENTS && header->type != EXTERNAL_DATA_TYPE && header->type != NETWORK_LAST_FRAGMENT) {
197-
return returnVal;
198-
}
202+
return returnVal;
199203
}
200204

201-
#if !defined(RF24_LINUX)
202-
// Prevent non-fragment, non-external system payloads from leaking into the
203-
// normal user queue. Mesh control-plane types (e.g. MESH_ADDR_LOOKUP,
204-
// MESH_ADDR_RELEASE, MESH_ID_LOOKUP) must never be visible via
205-
// available()/read() on Arduino/non-Linux nodes.
206-
if (header->type > MAX_USER_DEFINED_HEADER_TYPE &&
207-
header->type != NETWORK_FIRST_FRAGMENT &&
208-
header->type != NETWORK_MORE_FRAGMENTS &&
209-
header->type != NETWORK_LAST_FRAGMENT &&
210-
header->type != EXTERNAL_DATA_TYPE) {
205+
if (isSystemType && !isQueueableSystemType) {
211206
IF_RF24NETWORK_DEBUG_ROUTING(printf_P(PSTR("MAC System payload rcvd %d\n"), returnVal););
212207
if (returnSysMsgs) {
213208
return returnVal;
214209
}
215-
continue; // consume/drop; do not enqueue into user queue
210+
continue;
216211
}
217-
#endif
218212

219213
if (enqueue(header) == 2) { //External data received
220214
IF_RF24NETWORK_DEBUG_MINIMAL(printf_P(PSTR("ret ext\n")););

0 commit comments

Comments
 (0)