Add NoHopPorts

This commit is contained in:
Jonathan Bennett
2026-01-11 17:33:23 -06:00
parent a1d6978626
commit 8b8c1881a8
3 changed files with 13 additions and 1 deletions

View File

@@ -757,6 +757,13 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
skipHandle = true;
}
}
for (const auto &port : portduino_config.nohop_ports) {
if (port == p->decoded.portnum) {
p->hop_start -= p->hop_limit;
p->hop_limit = 0;
break;
}
}
#endif
} else {
printPacket("packet decoding failed or skipped (no PSK?)", p);

View File

@@ -850,6 +850,9 @@ bool loadConfig(const char *configPath)
portduino_config.whitelist_enabled = true;
}
}
if (yamlConfig["Routing"]["NoHopPorts"]) {
portduino_config.nohop_ports = (yamlConfig["Routing"]["NoHopPorts"]).as<std::vector<int>>();
}
}
if (yamlConfig["General"]) {
portduino_config.MaxNodes = (yamlConfig["General"]["MaxNodes"]).as<int>(200);

View File

@@ -188,6 +188,7 @@ extern struct portduino_config_struct {
// Routing
bool whitelist_enabled = false;
std::vector<int> whitelist_ports = {};
std::vector<int> nohop_ports = {};
// General
std::string mac_address = "";
@@ -524,9 +525,10 @@ extern struct portduino_config_struct {
}
// Routing
if (whitelist_enabled) {
if (whitelist_enabled || nohop_ports.size() > 0) {
out << YAML::Key << "Routing" << YAML::Value << YAML::BeginMap;
out << YAML::Key << "WhitelistPorts" << YAML::Value << whitelist_ports;
out << YAML::Key << "NoHopPorts" << YAML::Value << nohop_ports;
out << YAML::EndMap; // Routing
}