forked from I2P_Developers/i2p.i2p
Transports: Remove IPv6 addresses on transition to IPv6 firewalled
log tweaks
This commit is contained in:
14
history.txt
14
history.txt
@ -1,5 +1,19 @@
|
||||
2019-09-06 zzz
|
||||
* Transports: Remove IPv6 addresses on transition to IPv6 firewalled
|
||||
|
||||
2019-09-04 zzz
|
||||
* SSU: Don't mark peer unreachable if it reports
|
||||
we have a bad port (ticket #2467)
|
||||
* SusiMail:
|
||||
- Show "to" rather than "from" in sent and drafts folder (ticket #2571)
|
||||
- Fix sort links going to wrong folder
|
||||
|
||||
2019-09-03 zzz
|
||||
* SSU: Fix IPv6 peer test not firing
|
||||
* Tunnels: Use context AES for hop processing
|
||||
* Utils:
|
||||
- Fix SAN verification for IPv6 hostnames
|
||||
- Add Quad9 DoH servers
|
||||
|
||||
2019-09-02 zzz
|
||||
* Unit test fixes
|
||||
|
@ -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 = 2;
|
||||
public final static long BUILD = 3;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
@ -371,7 +371,8 @@ public abstract class TransportImpl implements Transport {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Took too long from preparation to afterSend(ok? " + sendSuccessful
|
||||
+ "): " + allTime + "ms/" + sendTime + "ms after failing on: "
|
||||
+ msg.getFailedTransports() + " and succeeding on " + getStyle());
|
||||
+ msg.getFailedTransports()
|
||||
+ (sendSuccessful ? (" and succeeding on " + getStyle()) : ""));
|
||||
if ( (allTime > 60*1000) && (sendSuccessful) ) {
|
||||
// VERY slow
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
@ -942,8 +943,8 @@ public abstract class TransportImpl implements Transport {
|
||||
_wasUnreachableEntries.remove(peer);
|
||||
}
|
||||
}
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(this.getStyle() + " setting wasUnreachable to " + yes + " for " + peer,
|
||||
if (_log.shouldDebug())
|
||||
_log.debug(this.getStyle() + " setting wasUnreachable to " + yes + " for " + peer,
|
||||
yes ? new Exception() : null);
|
||||
}
|
||||
|
||||
|
@ -1674,7 +1674,15 @@ public class NTCPTransport extends TransportImpl {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
addNTCP2Options(newProps);
|
||||
|
||||
if (!isIPv6 || newProps.containsKey(RouterAddress.PROP_HOST) || getIPv6Config() == IPV6_ONLY) {
|
||||
addNTCP2Options(newProps);
|
||||
} else {
|
||||
// IPv6
|
||||
// We have an IPv4 address, IPv6 transitioned to firewalled,
|
||||
// so just remove the v6 address
|
||||
newAddr = null;
|
||||
}
|
||||
|
||||
// stopListening stops the pumper, readers, and writers, so required even if
|
||||
// oldAddr == null since startListening starts them all again
|
||||
|
@ -960,8 +960,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
// Note that this fails us if we switch from one IP to a second, then back to the first,
|
||||
// as some routers still have the first IP and will successfully connect,
|
||||
// leaving us thinking the second IP is still good.
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Ignoring IP address suggestion, since we have received an inbound con recently");
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Ignoring IP address suggestion, since we have received an inbound con recently");
|
||||
} else {
|
||||
// New IP
|
||||
boolean changeIt = false;
|
||||
@ -982,7 +982,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
}
|
||||
if (changeIt) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(from + " and " + _lastFrom + " agree we have a new IP - "
|
||||
_log.info(from + " and " + _lastFrom + " agree we have the IP "
|
||||
+ Addresses.toString(ourIP, ourPort) + ". Changing address.");
|
||||
changeAddress(ourIP, ourPort);
|
||||
}
|
||||
@ -1011,8 +1011,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
byte[] externalListenHost = current != null ? current.getIP() : null;
|
||||
int externalListenPort = current != null ? current.getPort() : getRequestedPort(isIPv6);
|
||||
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Change address? status = " + _reachabilityStatus +
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Change address? status = " + _reachabilityStatus +
|
||||
" diff = " + (_context.clock().now() - _reachabilityStatusLastUpdated) +
|
||||
" old = " + Addresses.toString(externalListenHost, externalListenPort) +
|
||||
" new = " + Addresses.toString(ourIP, ourPort));
|
||||
@ -1041,8 +1041,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
//}
|
||||
} else {
|
||||
// matched what we expect
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Same address as the current one");
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Same address as the current one");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1288,8 +1288,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
*
|
||||
*/
|
||||
boolean addRemotePeerState(PeerState peer) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Add remote peer state: " + peer);
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Add remote peer state: " + peer);
|
||||
synchronized(_addDropLock) {
|
||||
return locked_addRemotePeerState(peer);
|
||||
}
|
||||
@ -1485,7 +1485,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
* @param shouldBanlist doesn't really, only sets unreachable
|
||||
*/
|
||||
void dropPeer(PeerState peer, boolean shouldBanlist, String why) {
|
||||
if (_log.shouldLog(Log.INFO)) {
|
||||
if (_log.shouldDebug()) {
|
||||
long now = _context.clock().now();
|
||||
StringBuilder buf = new StringBuilder(4096);
|
||||
long timeSinceSend = now - peer.getLastSendTime();
|
||||
@ -1529,7 +1529,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
}
|
||||
}
|
||||
*/
|
||||
_log.info(buf.toString(), new Exception("Dropped by"));
|
||||
_log.debug(buf.toString(), new Exception("Dropped by"));
|
||||
}
|
||||
synchronized(_addDropLock) {
|
||||
locked_dropPeer(peer, shouldBanlist, why);
|
||||
@ -2334,16 +2334,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
RouterAddress local = new RouterAddress(STYLE, localOpts, DEFAULT_COST);
|
||||
replaceCurrentExternalAddress(local, isIPv6);
|
||||
}
|
||||
if (getCurrentAddress(false) != null) {
|
||||
// We must remove current address, otherwise the user will see
|
||||
// "firewalled with inbound NTCP enabled" warning in console.
|
||||
// Remove the IPv4 address only
|
||||
removeAddress(false);
|
||||
// warning, this calls back into us with allowRebuildRouterInfo = false,
|
||||
// via CSFI.createAddresses->TM.getAddresses()->updateAddress()->REA
|
||||
if (allowRebuildRouterInfo)
|
||||
_context.router().rebuildRouterInfo();
|
||||
}
|
||||
removeExternalAddress(isIPv6, allowRebuildRouterInfo);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -2364,6 +2355,24 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
_currentOurV4Address = ra;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.9.43 pulled out of locked_rebuildExternalAddress
|
||||
*/
|
||||
private void removeExternalAddress(boolean isIPv6, boolean allowRebuildRouterInfo) {
|
||||
synchronized (_rebuildLock) {
|
||||
if (getCurrentAddress(isIPv6) != null) {
|
||||
// We must remove current address, otherwise the user will see
|
||||
// "firewalled with inbound NTCP enabled" warning in console.
|
||||
// Remove the v4/v6 address only
|
||||
removeAddress(isIPv6);
|
||||
// warning, this calls back into us with allowRebuildRouterInfo = false,
|
||||
// via CSFI.createAddresses->TM.getAddresses()->updateAddress()->REA
|
||||
if (allowRebuildRouterInfo)
|
||||
_context.router().rebuildRouterInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple fetch of stored IP and port, since
|
||||
* we don't put them in the real, published RouterAddress anymore
|
||||
@ -2885,8 +2894,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
}
|
||||
|
||||
if (!_expireBuffer.isEmpty()) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Expiring " + _expireBuffer.size() + " peers");
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Expiring " + _expireBuffer.size() + " peers");
|
||||
for (PeerState peer : _expireBuffer) {
|
||||
sendDestroy(peer);
|
||||
dropPeer(peer, false, "idle too long");
|
||||
@ -3014,8 +3023,15 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
// Always rebuild when the status changes, even if our address hasn't changed,
|
||||
// as rebuildExternalAddress() calls replaceAddress() which calls CSFI.notifyReplaceAddress()
|
||||
// which will start up NTCP inbound when we transition to OK.
|
||||
// if (needsRebuild())
|
||||
if (isIPv6) {
|
||||
if (status == Status.IPV4_OK_IPV6_FIREWALLED ||
|
||||
status == Status.IPV4_UNKNOWN_IPV6_FIREWALLED ||
|
||||
status == Status.IPV4_DISABLED_IPV6_FIREWALLED) {
|
||||
removeExternalAddress(true, true);
|
||||
}
|
||||
} else {
|
||||
rebuildExternalAddress();
|
||||
}
|
||||
} else {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Status unchanged: " + _reachabilityStatus +
|
||||
|
Reference in New Issue
Block a user