Repository navigation
Drop received packets whose LoRa header says no CRC in RadioLib override - #3739
Conversation
|
Good stuff. |
|
The testing above was on an emulated SX1262, so here's what it looks like on real hardware. I've had this change running on two Seeed SenseCAP Solar nodes (SX1262) since the evening of Nov 30, built from dev at 779d916 with the 0x08B5 gain fix turned on, on the US preset. Over about 15 hours they received 3,162 and 2,494 packets, with recv_errors at 55 and 40. A rejected "no CRC" header is counted in recv_errors along with ordinary CRC failures, so those are an upper bound on what the check threw away. It doesn't seem to cost any good traffic. One of my Pi-based repeaters hears both nodes directly and logs which of its forwarded floods it hears them repeat. Before the update, on 1.18.0, one of them repeated 4,025 of 4,997 (80.5%) over about 2.8 days. Overnight on dev with this change it was 660 of 831 (79.4%), and the other node 681 of 864 (78.8%). That gap is inside the noise for counts this size. I haven't caught a damaged-header packet in the act, so this only shows the check stays out of the way on hardware. |
If a packet's LoRa header says it carries no CRC, the radio checks nothing and reports a good packet, so a corrupted payload is repeated as a new packet that nobody can decrypt. RadioLib's readData() rejects this on SX127x (SX127x.cpp: "most likely damaged packet header")
Example
On the ScotMesh mesh, 97damaged copies in two weeks had bytes changed in the body, which should have failed the CRC. One of them, a Public message with 9 bits changed in payload bytes 8, 10 and 26.
Genuine, 16 October 00:19:39 (packet):
Damaged copy, 38 seconds later (packet):
Testing
I tested this in MeshBench with an emulated SX1262. A repeater handed that damaged copy with a "no CRC" header forwarded it on stock dev and dropped it with this change
PS
This should probably be fixed in RadioLib but for now using the Custom Radio Classes will do as overrides.
Also I think this is could be the cause for #1386
TLDR: As MeshCore sets CRC on with all radio varients. This forces it to stay on when received as if its off its corruption anyway. The theory is the CRC on bit gets flipped in the LoRa header (on weak links due to corruption). Explains #1386 and the packet above. It is not very common though.