From a3c330fd9d849eaaaf155585351330a657b1584f Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Mon, 5 May 2008 14:04:41 +0000
Subject: [PATCH]       - Restrict <= .32 SSU-only peers from inbound tunnels, 
        since they don't know if they are unreachable

---
 .../i2p/router/peermanager/ProfileOrganizer.java | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java b/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java
index 7c8d1eba33..eab0c1d388 100644
--- a/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java
+++ b/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java
@@ -424,6 +424,11 @@ public class ProfileOrganizer {
         return;
     }
     
+    /**
+     * Get the peers the transport layer thinks are unreachable, and
+     * add in the peers with the SSU peer testing bug.
+     *
+     */
     public List selectPeersLocallyUnreachable() { 
         List n;
         int count;
@@ -436,6 +441,17 @@ public class ProfileOrganizer {
             Hash peer = (Hash)iter.next();
             if (_context.commSystem().wasUnreachable(peer))
                 l.add(peer);
+            else {
+                // blacklist <= 0.6.1.32 SSU-only peers, they don't know if they are unreachable,
+                // and we may not know either if they contacted us first, so assume they are
+                RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);
+                if (info != null) {
+                    String v = info.getOption("router.version");
+                    if (v != null && (!v.equals("0.6.1.33")) &&
+                        v.startsWith("0.6.1.") && info.getTargetAddress("NTCP") == null)
+                        l.add(peer);
+                }
+            }
         }
         if (_log.shouldLog(Log.INFO))
             _log.info("Unreachable: " + l);
-- 
GitLab