mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-16 23:07:34 +00:00
Add NoHopPorts
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user