diff --git a/docs/cli_commands.md b/docs/cli_commands.md index 1600ceb0a..bab45c11f 100644 --- a/docs/cli_commands.md +++ b/docs/cli_commands.md @@ -748,17 +748,15 @@ This document provides an overview of CLI commands that can be sent to MeshCore #### View or set the direct path override for the current remote client **Usage:** - `get outpath` -- `set outpath ` - `set outpath ` - `set outpath clear` **Parameters:** -- `hash_size`: Path hash size (`1`, `2`, or `3` bytes per hop) -- `path_hex`: Concatenated hop hashes (must align to `hash_size`) -- `hopN_hex`: Comma-separated hop hashes, each `2`, `4`, or `6` hex characters and all the same width +- `hopN_hex`: Hop hash, `2`, `4`, or `6` hex characters. All hops must use the same width. **Notes:** - These commands require remote client context (they target the caller's ACL entry). +- The path hash size is inferred from the hop hash width. - `outpath` overrides the primary direct route used for replies to the caller. --- diff --git a/examples/simple_repeater/MyMesh.cpp b/examples/simple_repeater/MyMesh.cpp index 1ef783797..fb03764fe 100644 --- a/examples/simple_repeater/MyMesh.cpp +++ b/examples/simple_repeater/MyMesh.cpp @@ -1189,38 +1189,6 @@ static bool parsePathCommand(char* raw, uint8_t* out_path, uint8_t& out_path_len return true; } - char* space = strchr(spec, ' '); - if (space != NULL) { - char* sep = space; - *space++ = 0; - space = trimSpaces(space); - - char* end_ptr = NULL; - long hash_size = strtol(spec, &end_ptr, 10); - if (end_ptr != spec && *end_ptr == 0 && hash_size >= 1 && hash_size <= 3 && *space != 0) { - int hex_len = strlen(space); - int step = (int)hash_size * 2; - if ((hex_len % step) != 0) { - err = "Err - hex length must align to hash size"; - return false; - } - - int hop_count = hex_len / step; - if (hop_count <= 0 || hop_count > 63 || hop_count * hash_size > MAX_PATH_SIZE) { - err = "Err - invalid hop count"; - return false; - } - if (!mesh::Utils::fromHex(out_path, hop_count * hash_size, space)) { - err = "Err - bad hex"; - return false; - } - out_path_len = (((uint8_t)hash_size - 1) << 6) | ((uint8_t)hop_count & 63); - return true; - } - - *sep = ' '; - } - uint8_t hash_size = 0; uint8_t hop_count = 0; char* token = spec; @@ -1231,7 +1199,7 @@ static bool parsePathCommand(char* raw, uint8_t* out_path, uint8_t& out_path_len int hex_len = strlen(token); if (!(hex_len == 2 || hex_len == 4 || hex_len == 6)) { - err = "Err - each hop must be 1/2/3 bytes hex"; + err = "Err - bad params"; return false; } @@ -1239,12 +1207,12 @@ static bool parsePathCommand(char* raw, uint8_t* out_path, uint8_t& out_path_len if (hash_size == 0) { hash_size = hop_hash_size; } else if (hash_size != hop_hash_size) { - err = "Err - mixed hash sizes in path"; + err = "Err - bad params"; return false; } if (hop_count >= 63 || (hop_count + 1) * hash_size > MAX_PATH_SIZE) { - err = "Err - path too long"; + err = "Err - bad params"; return false; } if (!mesh::Utils::fromHex(&out_path[hop_count * hash_size], hash_size, token)) {