Repeater: CLI reply to 'setperm <key> 0' is lost when the removed ACL entry sits before the requester (stale ClientInfo* after array shift)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 77/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- c
- 领域
- backend, embedded-iot
调研方向
阅读 examples/simple_repeater/MyMesh.cpp 中 onPeerDataRecv() 附近的内容,以及 src/helpers/ClientACL.cpp 中 applyPermissions() 附近的内容。跟踪 setperm 0 如何压缩 ACL,同时回复仍使用请求方的指针。保留用于路由回复的请求方详细信息,然后验证撤销请求方之前、之后以及请求方所在位置的条目时,CLI 响应仍会发送给管理员。
由索引模型根据 Issue 内容生成。
描述
Summary
On a repeater, setperm <prefix> 0 (revoke) often gets no CLI reply although the entry is removed. Cause: MyMesh::onPeerDataRecv() keeps a ClientInfo* into the ACL array across handleCommand(), and the revoke path compacts that array in place, so the reply is addressed/routed with another client's data.
Where
examples/simple_repeater/MyMesh.cpp (tag repeater-v1.17.1; main @ e94125987e is identical):
- L670 — requester resolved by index before the command runs:
ClientInfo* client = acl.getClientByIdx(i); - L739 —
handleCommand(...)runssetperm→ClientACL::applyPermissions() - L751-L757 — the same
clientpointer is used afterwards:createDatagram(..., client->id, ...),client->out_path_len,client->out_path
src/helpers/ClientACL.cpp L123-L132 — guest/revoke branch shifts the fixed array down in place:
num_clients--;
int i = c - clients;
while (i < num_clients) {
clients[i] = clients[i + 1];
i++;
}
If the removed row's index is ≤ the requester's own index, client now points at the next client's data, so the OK goes to the wrong destination hash/path and the admin never sees it. If the removed row sits after the requester, nothing moves under the pointer and the reply arrives. Edge case: when the requester occupies the last populated slot, its old slot is not overwritten (stale copy of itself), so the reply still arrives.
Same code in v1.15.0, v1.16.0, v1.17.0 and v1.17.1 (only line numbers differ in MyMesh.cpp).
Reproduce (observed on a stock repeater, v1.17.0-727fc05)
- Log in as admin A. Make sure a client B sits before A in the ACL and another client C sits after A (e.g. add B, remove and re-add A with a password login, then add C with
setperm <C> 1). setperm <B-prefix> 0→ no reply. Repeat the same command →Err - invalid params(B is already gone, so the first command did work).setperm <C-prefix> 0→OKas expected.setperm <A-prefix> 0(self-revoke) with another client after A → no reply either.
Expected
The CLI reply always goes to the admin who sent the command.
Suggested fix
Smallest change: before handleCommand(), copy what the reply needs (the requester's id, out_path, out_path_len) into locals and use those afterwards instead of client->.... Alternatives: look the requester up again by pubkey after the command, or defer the array compaction (mark permissions = 0 and compact later).
Clients can currently only treat a missing reply to setperm … 0 as "unconfirmed" and re-read the list with REQ_TYPE_GET_ACCESS_LIST.
- 主要语言
- C
- 星标
- 3.9k
- 派生
- 1.5k
- 平均合并
- 19 小时 9 分钟
- 30 天内合并 PR
- 27
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
meshcore-dev/MeshCore 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 63/100
meshcore-dev/MeshCore#3622 ·
维护者通常 1 天内回复
-
[Feature Request] Set Australia (Mid) Preset to automatically enable 2 byte default path hash size未关闭
难度 2/5 1-3 小时 新手友好度 62/100
meshcore-dev/MeshCore#3571 · 5 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
meshcore-dev/MeshCore#3567 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
meshcore-dev/MeshCore#3549 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
meshcore-dev/MeshCore#3409 · 2 条评论 ·
维护者通常 1 天内回复
查看 meshcore-dev/MeshCore 的全部 Issue
相似的 Issue
-
Go device SDK: Whisper transcriber keeps buffering and transcribing audio appended after Stop()可能已有人在做 @apoorvdarshan 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
BasedHardware/omi#22770 ·
维护者通常 1 天内回复
-
severity: low
难度 1/5 1-3 小时 新手友好度 89/100
luainkernel/lunatik#1980 ·
维护者通常 1 天内回复
-
Investigation-Finding Issue-Bug Needs-Author-Feedback Needs-Triage Product-Command Palette
难度 2/5 1-3 小时 新手友好度 78/100
microsoft/PowerToys#51421 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
EchoTools/nevr-runtime#698 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
FujiNetWIFI/fujinet-firmware#2079 ·
维护者通常 1 天内回复