From d0ca1d38cafff1bf81efca7fe95c02ea96472445 Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 9 Feb 2022 06:39:18 -0500 Subject: [PATCH] NTCP: Fixes for SSU disabled Update RI reachability after first inbound connection Allow local address in test mode --- history.txt | 3 +++ .../src/net/i2p/router/RouterVersion.java | 4 ++-- .../router/transport/ntcp/NTCPTransport.java | 20 ++++++++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/history.txt b/history.txt index 31f2b932b..e8a15d020 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,6 @@ +2022-02-09 zzz + * NTCP: Fixes for SSU disabled + 2022-02-03 zzz * SSU: Don't bid on connection to buggy routers * Tunnels: Avoid buggy routers diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 3c8f141dc..e827ead87 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,10 +18,10 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Git"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 11; + public final static long BUILD = 12; /** for example "-test" */ - public final static String EXTRA = ""; + public final static String EXTRA = "-rc"; public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA; public static void main(String args[]) { System.out.println("I2P Router version: " + FULL_VERSION); diff --git a/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java b/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java index fc70ab0f5..6e1f295ad 100644 --- a/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java +++ b/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java @@ -329,10 +329,28 @@ public class NTCPTransport extends TransportImpl { old = _conByIdent.put(peer, con); } if (con.isIPv6()) { + long last = _lastInboundIPv6; + Status oldStatus; + if (last <= 0) + oldStatus = getReachabilityStatus(); + else + oldStatus = null; _lastInboundIPv6 = con.getCreated(); + // Get that "R" cap in the netdb ASAP, esp. when SSU disabled + if (last <= 0) + addressChanged(oldStatus); _context.statManager().addRateData("ntcp.inboundIPv6Conn", 1); } else { + long last = _lastInboundIPv4; + Status oldStatus; + if (last <= 0) + oldStatus = getReachabilityStatus(); + else + oldStatus = null; _lastInboundIPv4 = con.getCreated(); + // Get that "R" cap in the netdb ASAP, esp. when SSU disabled + if (last <= 0) + addressChanged(oldStatus); _context.statManager().addRateData("ntcp.inboundIPv4Conn", 1); } return old; @@ -1440,7 +1458,7 @@ public class NTCPTransport extends TransportImpl { // must be set before isValid() call _haveIPv6Address = true; } - if (ip != null && !isValid(ip)) { + if (ip != null && !isValid(ip) && !allowLocal()) { if (_log.shouldLog(Log.WARN)) _log.warn("Invalid address: " + Addresses.toString(ip, port) + " from: " + source); return;