From a9ef135e2dd53682d106c6a2aede9187026cc1de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=20=C4=90ANG?= Date: Fri, 15 Jul 2022 23:37:51 +0700 Subject: [PATCH] p2p/discover: apply netrestrict in discv5 response handler (#25304) --- p2p/discover/v5_udp.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/p2p/discover/v5_udp.go b/p2p/discover/v5_udp.go index 69aaefa27..6ffa7bef7 100644 --- a/p2p/discover/v5_udp.go +++ b/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 { 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 { return nil, errLowPort }