p2p/discover: apply netrestrict in discv5 response handler (#25304)

pull/25315/head
Ha ĐANG 2 years ago committed by GitHub
parent e3df3d34cf
commit a9ef135e2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      p2p/discover/v5_udp.go

@ -407,6 +407,9 @@ func (t *UDPv5) verifyResponseNode(c *callV5, r *enr.Record, distances []uint, s
if err := netutil.CheckRelayIP(c.node.IP(), node.IP()); err != nil { if err := netutil.CheckRelayIP(c.node.IP(), node.IP()); err != nil {
return nil, err return nil, err
} }
if t.netrestrict != nil && !t.netrestrict.Contains(node.IP()) {
return nil, errors.New("not contained in netrestrict list")
}
if c.node.UDP() <= 1024 { if c.node.UDP() <= 1024 {
return nil, errLowPort return nil, errLowPort
} }

Loading…
Cancel
Save