diff options
| author | Felix Fietkau | 2026-02-06 09:22:30 +0000 |
|---|---|---|
| committer | Felix Fietkau | 2026-02-16 08:09:09 +0000 |
| commit | ef79f65981306409812d4dcd294b6a2bca31d5af (patch) | |
| tree | 1159c08fb3c97a0fccf9bdb014c8b7839355833e | |
| parent | 535403297e4d4574008c85b483ff17c252819c90 (diff) | |
| download | openwrt-ef79f65981306409812d4dcd294b6a2bca31d5af.tar.gz | |
unetmsg: fix publish notification timing around remote auth
When a remote peer's publish registrations arrive via RX before the
local TX connection is authenticated, handle_publish fires but the
subscriber can't reach the remote publisher yet since the TX channel
isn't ready.
Suppress publish notifications on the RX side when no authenticated TX
channel exists for the remote host. After TX authentication completes,
re-trigger handle_publish only for topics that the specific peer
publishes and that have local subscribers.
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 3efcf444a11e9402d86ae79c733114827ce31b42)
| -rw-r--r-- | package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc b/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc index 92f81262ef..1f1c97a2ca 100644 --- a/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc +++ b/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc @@ -93,6 +93,8 @@ function network_socket_handle_request(sock_data, req) let host = sock_data.name; let network = sock_data.network; let args = { ...req.args, host, network }; + let tx_chan = net.tx_channels[host]; + let tx_auth = tx_chan && tx_chan.auth; switch (msgtype) { case "publish": case "subscribe": @@ -102,7 +104,8 @@ function network_socket_handle_request(sock_data, req) return; if (args.enabled) { if (list[name]) { - core.handle_publish(null, name); + if (tx_auth) + core.handle_publish(null, name); return 0; } @@ -121,7 +124,8 @@ function network_socket_handle_request(sock_data, req) network: sock_data.network, name: host, }, pubsub_proto); - core.handle_publish(null, name); + if (tx_auth) + core.handle_publish(null, name); list[name] = true; } else { if (!list[name]) @@ -318,6 +322,11 @@ function network_open_channel(net, name, peer) data: { name, enabled: true }, return: "ignore", }); + + let rx_chan = net.rx_channels[name]; + if (rx_chan) + for (let sub_name in rx_chan.publish) + core.handle_publish(null, sub_name); }; let auth_cb = () => { if (!sock_data.auth) |