From 84cf531f5f38ef6d10ef349408e9c6e146faeb2f Mon Sep 17 00:00:00 2001 From: zzz Date: Thu, 29 Jan 2015 22:23:28 +0000 Subject: [PATCH] SSU: Fix transition from firewalled to non-firewalled --- history.txt | 1 + .../java/src/net/i2p/router/RouterVersion.java | 2 +- .../i2p/router/transport/udp/UDPTransport.java | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/history.txt b/history.txt index 26436280d6..a1ad60ff9f 100644 --- a/history.txt +++ b/history.txt @@ -5,6 +5,7 @@ due to a different ordering of the same introducers - Don't publish an address if we need introducers but don't have any, so the user won't see a 'firewalled with inbound NTCP enabled' message + - Fix transition from firewalled to non-firewalled 2015-01-28 zzz * UPnP: diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 31c35f8c3e..ea17ad55f3 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 14; + public final static long BUILD = 15; /** for example "-test" */ public final static String EXTRA = ""; 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 b64b313c27..fceab9b642 100644 --- a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java +++ b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java @@ -1816,9 +1816,11 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority return rv; } } else { - RouterAddress cur = getCurrentAddress(false); - if (cur != null) - host = cur.getHost(); + if (!introducersRequired()) { + RouterAddress cur = getCurrentExternalAddress(false); + if (cur != null) + host = cur.getHost(); + } } return rebuildExternalAddress(host, port, allowRebuildRouterInfo); } @@ -1974,6 +1976,14 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority _log.warn("Wanted to rebuild my SSU address, but couldn't specify either the direct or indirect info (needs introducers? " + introducersRequired + ")", new Exception("source")); _needsRebuild = true; + // save the external address, even if we didn't publish it + if (port > 0 && host != null) { + OrderedProperties localOpts = new OrderedProperties(); + localOpts.setProperty(UDPAddress.PROP_PORT, String.valueOf(port)); + localOpts.setProperty(UDPAddress.PROP_HOST, host); + RouterAddress local = new RouterAddress(STYLE, localOpts, DEFAULT_COST); + replaceCurrentExternalAddress(local, isIPv6); + } if (hasCurrentAddress()) { // We must remove current address, otherwise the user will see // "firewalled with inbound NTCP enabled" warning in console.