1
1

unetd: cli: convey network name from inviter to joiner

The unet CLI's join handler used the joiner's --network value as the
local network name, so an unspecified --network fell back to the
literal 'unet'. The inviter typically uses a different name (e.g.
ucoord_<venue>), so the two sides ended up keyed differently and any
upper layer subscribing to the network-named unetmsg channel never
saw each other.

The inviter now passes enroll_info={ network } to enroll_start so
the inviter's network name rides along in enroll_meta. The joiner
prefers data.enroll_meta?.network when present, falling back to its
own --network value for backwards compatibility with older inviters.

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin 2026-05-25 11:35:10 +02:00 committed by Felix Fietkau
parent 4b7d5538bc
commit 5526366fea
2 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=unetd PKG_NAME:=unetd
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/unetd.git PKG_SOURCE_URL=$(PROJECT_GIT)/project/unetd.git
PKG_SOURCE_DATE:=2026-05-22 PKG_SOURCE_DATE:=2026-05-22

View File

@ -586,6 +586,7 @@ function network_invite(ctx, argv, named)
let req = { let req = {
network, network,
timeout: named.timeout, timeout: named.timeout,
enroll_info: { network },
}; };
if (named["access-key"]) { if (named["access-key"]) {
@ -606,12 +607,13 @@ function network_invite(ctx, argv, named)
function network_join_peer_update(model, ctx, msg) function network_join_peer_update(model, ctx, msg)
{ {
let joinreq = ctx.data.enroll; let joinreq = ctx.data.enroll;
let name = joinreq.name;
let data = network_handle_enroll_update(model, ctx, msg); let data = network_handle_enroll_update(model, ctx, msg);
if (!data) if (!data)
return; return;
let name = data.enroll_meta?.network ?? joinreq.name;
let iface = { let iface = {
proto: "unet", proto: "unet",
metric: joinreq.metric, metric: joinreq.metric,