Only accept a address from a peer if it is a valid IP address (#6439)

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
pull/6445/head
Matt Whitehead 10 months ago committed by GitHub
parent 925f4946b8
commit 98718ae270
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryAgent.java

@ -293,7 +293,9 @@ public abstract class PeerDiscoveryAgent {
.getPacketData(PingPacketData.class)
.flatMap(PingPacketData::getFrom)
.map(Endpoint::getHost)
.filter(abc -> !abc.equals("127.0.0.1"))
.filter(
fromAddr ->
(!fromAddr.equals("127.0.0.1") && InetAddresses.isInetAddress(fromAddr)))
.stream()
.peek(
h ->

Loading…
Cancel
Save