mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-10-22 22:21:18 +00:00
Support 2+ path-hash width filters
This commit is contained in:
1 parent
d084f5b837
commit
7324bf06ef
12 files changed
+202
-37
No files matched your search
@@ -1108,8 +1108,8 @@ void FloodRuleEngine::formatDetail(int index, char* reply,
|
||||
char retry[10];
|
||||
char hashbytes[16] = {};
|
||||
if (entry.path_hops == 0 && entry.path_hash_size != 0)
|
||||
snprintf(hashbytes, sizeof(hashbytes), " hashbytes=%u",
|
||||
(unsigned)entry.path_hash_size);
|
||||
snprintf(hashbytes, sizeof(hashbytes), " hashbytes=%s",
|
||||
FloodFilterPolicy::pathHashBytesName(entry.path_hash_size));
|
||||
formatHopSpec(hops, sizeof(hops), entry.min_hops, entry.max_hops);
|
||||
if (entry.match_blacklisted_path) copyString(prefix, "blacklist", sizeof(prefix));
|
||||
else formatPathPrefix(prefix, sizeof(prefix), entry.path_hash_size,
|
||||
@@ -1616,7 +1616,7 @@ void FloodRuleEngine::set(const char* args, char* reply,
|
||||
}
|
||||
if (!FloodFilterPolicy::parsePathHashBytes(
|
||||
strchr(tokens[i], '=') + 1, hashbytes)) {
|
||||
copyString(reply, "Err - hashbytes must be any, 1, 2, or 3", 160);
|
||||
copyString(reply, "Err - hashbytes must be any, 1, 2, 2+, or 3", 160);
|
||||
return;
|
||||
}
|
||||
hashbytes_set = true;
|
||||
@@ -1654,11 +1654,13 @@ void FloodRuleEngine::set(const char* args, char* reply,
|
||||
}
|
||||
|
||||
if (hashbytes != 0) {
|
||||
if (path_hash_size != 0 && path_hash_size != hashbytes) {
|
||||
if (path_hash_size != 0
|
||||
&& !FloodFilterPolicy::pathHashBytesMatch(hashbytes, path_hash_size)) {
|
||||
copyString(reply, "Err - hashbytes conflicts with prefix width", 160);
|
||||
return;
|
||||
}
|
||||
path_hash_size = hashbytes;
|
||||
// An explicit prefix already narrows 2+ to its exact 2- or 3-byte width.
|
||||
if (path_hash_size == 0) path_hash_size = hashbytes;
|
||||
}
|
||||
if (scope_timing_set && !target_set) {
|
||||
copyString(reply, "Err - tx timing requires scope= or region=", 160);
|
||||
|
||||
Reference in new issue
Block a user