From 4fba5586380b59ba063fd5adaded1dec7c6f9cbf Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 16 Jan 2019 13:20:12 +0000 Subject: [PATCH 1/2] Fix concurrent map write in tcp.go --- src/yggdrasil/tcp.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/yggdrasil/tcp.go b/src/yggdrasil/tcp.go index c90c3ffb..1ebf0b69 100644 --- a/src/yggdrasil/tcp.go +++ b/src/yggdrasil/tcp.go @@ -125,8 +125,10 @@ func (iface *tcpInterface) listen() error { } iface.serv, err = lc.Listen(ctx, "tcp", iface.tcp_addr) if err == nil { + iface.mutex.Lock() iface.calls = make(map[string]struct{}) iface.conns = make(map[tcpInfo](chan struct{})) + iface.mutex.Unlock() go iface.listener() return nil } @@ -187,7 +189,9 @@ func (iface *tcpInterface) call(saddr string, socksaddr *string, sintf string) { if iface.isAlreadyCalling(saddr) { return } + iface.mutex.Lock() iface.calls[callname] = struct{}{} + iface.mutex.Unlock() defer func() { // Block new calls for a little while, to mitigate livelock scenarios time.Sleep(default_tcp_timeout) From c85dbaea958bd2be603dcbb1012c1bb3845664a5 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 16 Jan 2019 13:23:26 +0000 Subject: [PATCH 2/2] Fix missing nodeinfo.init --- src/yggdrasil/router.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/yggdrasil/router.go b/src/yggdrasil/router.go index 11509d44..31eefbb2 100644 --- a/src/yggdrasil/router.go +++ b/src/yggdrasil/router.go @@ -86,6 +86,7 @@ func (r *router) init(core *Core) { r.send = send r.reset = make(chan struct{}, 1) r.admin = make(chan func(), 32) + r.nodeinfo.init(r.core) r.core.configMutex.RLock() r.nodeinfo.setNodeInfo(r.core.config.NodeInfo, r.core.config.NodeInfoPrivacy) r.core.configMutex.RUnlock()