mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
check root before accepting that a message is good and unblocking a new peer
This commit is contained in:
parent
f30d040366
commit
1dcc60f054
2 changed files with 28 additions and 0 deletions
|
@ -297,6 +297,13 @@ func (p *peer) handleSwitchMsg(packet []byte) {
|
|||
prevKey = hop.Next
|
||||
}
|
||||
p.core.switchTable.handleMsg(&msg, p.port)
|
||||
if !p.core.switchTable.checkRoot(&msg) {
|
||||
// Bad switch message
|
||||
// Stop forwarding traffic from it
|
||||
// Stop refreshing it in the DHT
|
||||
p.dinfo = nil
|
||||
return
|
||||
}
|
||||
// Pass a mesage to the dht informing it that this peer (still) exists
|
||||
loc.coords = loc.coords[:len(loc.coords)-1]
|
||||
dinfo := dhtInfo{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue