Skip to content

Commit 936260f

Browse files
authored
Default rebroadcast mode for Router and Repeater to ignore problematic portnums (#5178)
* Default rebroadcast mode for Router and Repeater to ignore problematic portnums * Verbiage * IS_ONE_OF
1 parent 2945b9c commit 936260f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/mesh/NodeDB.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,10 @@ void NodeDB::installRoleDefaults(meshtastic_Config_DeviceConfig_Role role)
557557
if (role == meshtastic_Config_DeviceConfig_Role_ROUTER) {
558558
initConfigIntervals();
559559
initModuleConfigIntervals();
560+
config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY;
560561
} else if (role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
561562
config.display.screen_on_secs = 1;
563+
config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY;
562564
} else if (role == meshtastic_Config_DeviceConfig_Role_SENSOR) {
563565
moduleConfig.telemetry.environment_measurement_enabled = true;
564566
moduleConfig.telemetry.environment_update_interval = 300;

src/mesh/Router.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -591,19 +591,20 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
591591
skipHandle = true;
592592
}
593593

594+
bool shouldIgnoreNonstandardPorts =
595+
config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY;
594596
#if USERPREFS_EVENT_MODE
595-
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag &&
596-
(p->decoded.portnum == meshtastic_PortNum_ATAK_FORWARDER || p->decoded.portnum == meshtastic_PortNum_ATAK_PLUGIN ||
597-
p->decoded.portnum == meshtastic_PortNum_PAXCOUNTER_APP || p->decoded.portnum == meshtastic_PortNum_IP_TUNNEL_APP ||
598-
p->decoded.portnum == meshtastic_PortNum_AUDIO_APP || p->decoded.portnum == meshtastic_PortNum_PRIVATE_APP ||
599-
p->decoded.portnum == meshtastic_PortNum_DETECTION_SENSOR_APP ||
600-
p->decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP ||
601-
p->decoded.portnum == meshtastic_PortNum_REMOTE_HARDWARE_APP)) {
602-
LOG_DEBUG("Ignoring packet on blacklisted portnum during event");
597+
shouldIgnoreNonstandardPorts = true;
598+
#endif
599+
if (shouldIgnoreNonstandardPorts && p->which_payload_variant == meshtastic_MeshPacket_decoded_tag &&
600+
IS_ONE_OF(p->decoded.portnum, meshtastic_PortNum_ATAK_FORWARDER, meshtastic_PortNum_ATAK_PLUGIN,
601+
meshtastic_PortNum_PAXCOUNTER_APP, meshtastic_PortNum_IP_TUNNEL_APP, meshtastic_PortNum_AUDIO_APP,
602+
meshtastic_PortNum_PRIVATE_APP, meshtastic_PortNum_DETECTION_SENSOR_APP, meshtastic_PortNum_RANGE_TEST_APP,
603+
meshtastic_PortNum_REMOTE_HARDWARE_APP)) {
604+
LOG_DEBUG("Ignoring packet on blacklisted portnum for CORE_PORTNUMS_ONLY");
603605
cancelSending(p->from, p->id);
604606
skipHandle = true;
605607
}
606-
#endif
607608
} else {
608609
printPacket("packet decoding failed or skipped (no PSK?)", p);
609610
}

0 commit comments

Comments
 (0)