]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
unetmsg: fix reconnect loop when RX authenticates before TX
authorFelix Fietkau <nbd@nbd.name>
Fri, 6 Feb 2026 10:12:31 +0000 (10:12 +0000)
committerFelix Fietkau <nbd@nbd.name>
Sat, 7 Feb 2026 09:04:18 +0000 (10:04 +0100)
When both peers connect simultaneously, the RX side can authenticate
before the TX handshake completes. network_check_auth() was sending a
ping on the unauthenticated TX channel, which gets rejected by the
remote's pre-auth handler as "Auth failed", killing the connection and
triggering an endless reconnect cycle.

Check chan.auth before interacting with the TX channel. If TX auth
hasn't completed yet, just schedule a reconnect timer - auth_data_cb
already handles state sync when TX auth completes.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc

index f6b0ef2d5958d9c28a5bc06cb83f15c02afe9d19..c7301e1a09fe0f7b2709245e08450deb61e11870 100644 (file)
@@ -203,16 +203,8 @@ function network_check_auth(sock_data, info)
        core.dbg(`Incoming connection from ${sock_data.name} established\n`);
 
        let chan = net.tx_channels[sock_data.name];
-       if (!chan) {
+       if (!chan || !chan.auth)
                net.timer.set(100);
-               return;
-       }
-
-       chan.channel.request({
-               method: "ping",
-               data: {},
-               return: "ignore",
-       });
 }
 
 function network_accept(net, sock, addr)