NTCP: Fixes for SSU disabled

Update RI reachability after first inbound connection
Allow local address in test mode
This commit is contained in:
zzz
2022-02-09 06:39:18 -05:00
parent 96560e8590
commit d0ca1d38ca
3 changed files with 24 additions and 3 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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;