mirror of
https://github.com/fosrl/newt.git
synced 2026-08-31 03:01:28 +02:00
Merge pull request #424 from Serph91P/fix/compat-registration-chain-race
fix: preserve the pending WireGuard registration chain
This commit is contained in:
@@ -1010,7 +1010,9 @@ func (n *Newt) registerHandlers(ctx context.Context) {
|
||||
}
|
||||
|
||||
bcChainId := generateChainId()
|
||||
n.pendingRegisterChainId = bcChainId
|
||||
// Pangolin intentionally does not answer backwards-compatible
|
||||
// registrations with newt/wg/connect. Do not replace the chain ID of
|
||||
// the real registration while its response may already be in flight.
|
||||
if err := n.client.SendMessage(topicWGRegister, map[string]interface{}{
|
||||
"publicKey": n.publicKey.String(),
|
||||
"newtVersion": n.config.Version,
|
||||
|
||||
@@ -280,7 +280,8 @@ func (n *Newt) startPingCheck(fn pingFunc, serverIP, tunnelID string) chan struc
|
||||
"chainId": pingChainId,
|
||||
}, 3*time.Second)
|
||||
bcChainId := generateChainId()
|
||||
n.pendingRegisterChainId = bcChainId
|
||||
// This compatibility message has no wg/connect response and must
|
||||
// not supersede the pending real registration chain.
|
||||
if err := n.client.SendMessage("newt/wg/register", map[string]interface{}{
|
||||
"publicKey": n.publicKey.String(),
|
||||
"backwardsCompatible": true,
|
||||
|
||||
Reference in New Issue
Block a user