diff --git a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java index 4b2fea424d694759aced56193f5bf7bafc81961a..5c3372d5d4b22717bd6f6936ec521144f3c1e47b 100644 --- a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java +++ b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java @@ -1049,17 +1049,15 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority boolean isTooClose(byte[] ip) { if (allowLocal()) return false; - for (RouterAddress addr : getCurrentAddresses()) { - byte[] myip = addr.getIP(); - if (myip == null || ip.length != myip.length) - continue; - if (ip.length == 4) { - if (DataHelper.eq(ip, 0, myip, 0, 2)) - return true; - } else if (ip.length == 16) { - if (DataHelper.eq(ip, 0, myip, 0, 4)) - return true; - } + byte[] myip = ip.length == 16 ? _lastOurIPv6 : _lastOurIPv4; + if (myip == null) + return false; + if (ip.length == 4) { + if (DataHelper.eq(ip, 0, myip, 0, 2)) + return true; + } else if (ip.length == 16) { + if (DataHelper.eq(ip, 0, myip, 0, 4)) + return true; } return false; }