NTCP: Don't advertise interface addresses when configured for force-firewalled

log tweaks
This commit is contained in:
zzz
2018-07-04 16:22:56 +00:00
parent 9ac31573b4
commit 7d9207dc81
4 changed files with 12 additions and 4 deletions

View File

@@ -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 = 3;
public final static long BUILD = 4;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -83,7 +83,7 @@ public abstract class TransportImpl implements Transport {
*/
public TransportImpl(RouterContext context) {
_context = context;
_log = _context.logManager().getLog(TransportImpl.class);
_log = _context.logManager().getLog(getClass());
_context.statManager().createRateStat("transport.sendMessageFailureLifetime", "How long the lifetime of messages that fail are?", "Transport", new long[] { 60*1000l, 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
_context.statManager().createRequiredRateStat("transport.sendMessageSize", "Size of sent messages (bytes)", "Transport", new long[] { 60*1000l, 5*60*1000l, 60*60*1000l, 24*60*60*1000l });

View File

@@ -402,7 +402,8 @@ public class NTCPTransport extends TransportImpl {
con.close();
afterSend(msg, false);
} catch (IllegalStateException ise) {
_log.error("Failed opening a channel", ise);
if (_log.shouldWarn())
_log.warn("Failed opening a channel", ise);
afterSend(msg, false);
}
} else {
@@ -771,6 +772,8 @@ public class NTCPTransport extends TransportImpl {
else
// received by externalAddressReceived() from TransportManager
port = _ssuPort;
boolean isFixedOrForceFirewalled = _context.getProperty(PROP_I2NP_NTCP_AUTO_IP, "true")
.toLowerCase(Locale.US).equals("false");
RouterAddress myAddress = bindAddress(port);
if (myAddress != null) {
// fixed interface, or bound to the specified host
@@ -778,7 +781,7 @@ public class NTCPTransport extends TransportImpl {
} else if (addr != null) {
// specified host, bound to wildcard
replaceAddress(addr);
} else if (port > 0) {
} else if (port > 0 && !isFixedOrForceFirewalled) {
// all detected interfaces
Collection<InetAddress> addrs = getSavedLocalAddresses();
if (!addrs.isEmpty()) {