From c20b66f3b60c40c45125cc13c07803998432f8db Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 10 May 2021 22:31:01 +0100 Subject: [PATCH] Metadata/version tweaks --- src/yggdrasil/link.go | 14 +++++++++----- src/yggdrasil/version.go | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/yggdrasil/link.go b/src/yggdrasil/link.go index aff40549..3d06fbf1 100644 --- a/src/yggdrasil/link.go +++ b/src/yggdrasil/link.go @@ -185,13 +185,17 @@ func (intf *link) handler() (chan struct{}, error) { return nil, err } meta = version_metadata{} - if !meta.decode(metaBytes) || !meta.check() { + base := version_getBaseMetadata() + if !meta.decode(metaBytes) { return nil, errors.New("failed to decode metadata") } - base := version_getBaseMetadata() - if meta.ver > base.ver || meta.ver == base.ver && meta.minorVer > base.minorVer { - intf.links.core.log.Errorln("Failed to connect to node: " + intf.lname + " version: " + fmt.Sprintf("%d.%d", meta.ver, meta.minorVer)) - return nil, errors.New("failed to connect: wrong version") + if !meta.check() { + intf.links.core.log.Errorf("Failed to connect to node: %s is incompatible version (local %s, remote %s)", + intf.lname, + fmt.Sprintf("%d.%d", base.ver, base.minorVer), + fmt.Sprintf("%d.%d", meta.ver, meta.minorVer), + ) + return nil, errors.New("remote node is incompatible version") } // Check if the remote side matches the keys we expected. This is a bit of a weak // check - in future versions we really should check a signature or something like that. diff --git a/src/yggdrasil/version.go b/src/yggdrasil/version.go index e653e92f..ad334c8b 100644 --- a/src/yggdrasil/version.go +++ b/src/yggdrasil/version.go @@ -22,7 +22,7 @@ func version_getBaseMetadata() version_metadata { return version_metadata{ meta: [4]byte{'m', 'e', 't', 'a'}, ver: 0, - minorVer: 1, + minorVer: 3, } }