diff --git a/src/mesh/NextHopRouter.cpp b/src/mesh/NextHopRouter.cpp index 00ccc814ef..1e7ddc9d42 100644 --- a/src/mesh/NextHopRouter.cpp +++ b/src/mesh/NextHopRouter.cpp @@ -33,7 +33,8 @@ bool NextHopRouter::relayOpaquePacket(const meshtastic_MeshPacket *p) const auto mode = config.device.rebroadcast_mode; if (!iface || isToUs(p) || isFromUs(p) || p->id == 0 || p->hop_limit == 0 || !isRebroadcaster() || owner.is_licensed || !IS_ONE_OF(mode, meshtastic_Config_DeviceConfig_RebroadcastMode_ALL, - meshtastic_Config_DeviceConfig_RebroadcastMode_ALL_SKIP_DECODING) || + meshtastic_Config_DeviceConfig_RebroadcastMode_ALL_SKIP_DECODING, + meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY) || (p->next_hop != NO_NEXT_HOP_PREFERENCE && p->next_hop != nodeDB->getLastByteOfNodeNum(getNodeNum()))) return false; diff --git a/test/test_packet_signing/test_main.cpp b/test/test_packet_signing/test_main.cpp index 47dabdbda8..50162dc5c7 100644 --- a/test/test_packet_signing/test_main.cpp +++ b/test/test_packet_signing/test_main.cpp @@ -1350,9 +1350,22 @@ void test_C6_opaque_unknown_channel_is_relay_only(void) TEST_ASSERT_NULL(pipelineService->getForPhone()); TEST_ASSERT_FALSE(pipelineRouter->historyContains(&addressed)); + // CORE_PORTNUMS_ONLY carries an opaque frame: the portnum filter cannot apply to a payload the relay + // cannot read, and the ROUTER role defaults to this mode (#11843). + pipelineRadio->reset(); + config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY; + meshtastic_MeshPacket core = opaque; + core.id += 0x10; + runPipelineIngress(core); + TEST_ASSERT_EQUAL_MESSAGE(1, pipelineRadio->sendCalls, "CORE_PORTNUMS_ONLY must relay an opaque frame"); + TEST_ASSERT_EQUAL(0, pipelineRouting->ackCalls); + TEST_ASSERT_EQUAL(0, pipelineModule->calls); + TEST_ASSERT_EQUAL(0, pipelineMqtt->queueSize()); + TEST_ASSERT_NULL(pipelineService->getForPhone()); + TEST_ASSERT_FALSE(pipelineRouter->historyContains(&core)); + const meshtastic_Config_DeviceConfig_RebroadcastMode blockedModes[] = { meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY, - meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY, meshtastic_Config_DeviceConfig_RebroadcastMode_NONE, }; for (const auto mode : blockedModes) {