From 432caf4fdfffe024418541d97bddb58996547d0d Mon Sep 17 00:00:00 2001 From: vyzo Date: Tue, 14 Apr 2020 14:56:56 +0300 Subject: [PATCH] more rigorously defeat unspecified address gremlins --- score.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/score.go b/score.go index a912f1d..88c92cc 100644 --- a/score.go +++ b/score.go @@ -769,8 +769,8 @@ func (ps *peerScore) getIPs(p peer.ID) []string { continue } - // ignore those; loopback for unit testing and unspecific because gremlins in testground - // give us an unspecific IP6 conns everywhere! + // ignore those; loopback for unit testing and unspecified because gremlins + // seem give us an unspecified IPv6 conn everywhere in testground testing! if ip.IsUnspecified() || ip.IsLoopback() { continue } @@ -787,8 +787,12 @@ func (ps *peerScore) getIPs(p peer.ID) []string { ip6 := ip.String() res = append(res, ip6) - ip6mask := ip.Mask(net.CIDRMask(64, 128)).String() - res = append(res, ip6mask) + ip6mask := ip.Mask(net.CIDRMask(64, 128)) + // this seems necessary to defeat the unspecfied address gremlins -- plus it is in the + // IANA reserved address space anyway, so it doesn't hurt. + if !ip6mask.IsUnspecified() { + res = append(res, ip6mask.String()) + } } }