Skip to content

Commit 3ad3e43

Browse files
yacovmC0rWin
authored andcommitted
[FAB-2710] Gossip: Log WARN upon bad network config
This commit adds a log warning in case a peer detects peers with the same PKI-ID as itself but with different endpoints. The only reason that this can happen is that someone configured different peers with the same identity. Change-Id: Ie29d871627b521cb586a50bb447e1615710b366c Signed-off-by: Yacov Manevich <[email protected]> Signed-off-by: Artem Barger <[email protected]>
1 parent 450b122 commit 3ad3e43

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

gossip/discovery/discovery_impl.go

+10
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,16 @@ func (d *gossipDiscoveryImpl) handleAliveMessage(m *proto.SignedGossipMessage) {
436436
pkiID := m.GetAliveMsg().Membership.PkiId
437437
if equalPKIid(pkiID, d.self.PKIid) {
438438
d.logger.Debug("Got alive message about ourselves,", m)
439+
diffExternalEndpoint := d.self.Endpoint != m.GetAliveMsg().Membership.Endpoint
440+
var diffInternalEndpoint bool
441+
secretEnvelope := m.GetSecretEnvelope()
442+
if secretEnvelope != nil && secretEnvelope.InternalEndpoint() != "" {
443+
diffInternalEndpoint = secretEnvelope.InternalEndpoint() != d.self.InternalEndpoint
444+
}
445+
if diffInternalEndpoint || diffExternalEndpoint {
446+
d.logger.Error("Bad configuration detected: Received AliveMessage from a peer with the same PKI-ID as myself:", m.GossipMessage)
447+
}
448+
439449
return
440450
}
441451

0 commit comments

Comments
 (0)