From 87b0f5fe24212678c500407a808db3c65b4deadf Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 5 Nov 2018 22:39:30 +0000 Subject: [PATCH] Use CKR in router when sending packets --- src/yggdrasil/router.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/yggdrasil/router.go b/src/yggdrasil/router.go index e83bb114..0faf850b 100644 --- a/src/yggdrasil/router.go +++ b/src/yggdrasil/router.go @@ -134,7 +134,16 @@ func (r *router) sendPacket(bs []byte) { var snet subnet copy(snet[:], bs[24:]) if !dest.isValid() && !snet.isValid() { - return + if key, err := r.cryptokey.getPublicKeyForAddress(dest); err == nil { + addr := *address_addrForNodeID(getNodeID(&key)) + copy(dest[:], addr[:]) + copy(snet[:], addr[:]) + if !dest.isValid() && !snet.isValid() { + return + } + } else { + return + } } doSearch := func(packet []byte) { var nodeID, mask *NodeID