diff --git a/router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java b/router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java index 64c32cddff62500735fcd126a02681307027c612..77fdd78ba1367f1909dfa1a23a73e70af0bf383c 100644 --- a/router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java +++ b/router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java @@ -132,10 +132,11 @@ class EstablishmentManager { * but i2pd hasn't recognized it until this release. * No matter, the options weren't defined until this release anyway. * - * FIXME 0.9.22 for testing, change to 0.9.24 for release +********************************************************************************************************** + * FIXME 0.9.23 for testing, change to 0.9.24 for release * */ - private static final String VERSION_ALLOW_EXTENDED_OPTIONS = "0.9.22"; + private static final String VERSION_ALLOW_EXTENDED_OPTIONS = "0.9.23"; private static final String PROP_DISABLE_EXT_OPTS = "i2np.udp.disableExtendedOptions"; @@ -373,7 +374,9 @@ class EstablishmentManager { VERSION_ALLOW_EXTENDED_OPTIONS) >= 0 && !_context.getBooleanProperty(PROP_DISABLE_EXT_OPTS); // w/o ext options, it's always 'requested', no need to set - boolean requestIntroduction = allowExtendedOptions && _transport.introducersRequired(); + // don't ask if they are indirect + boolean requestIntroduction = allowExtendedOptions && !isIndirect && + _transport.introducersMaybeRequired(); state = new OutboundEstablishState(_context, maybeTo, to, toIdentity, allowExtendedOptions, requestIntroduction, diff --git a/router/java/src/net/i2p/router/transport/udp/InboundEstablishState.java b/router/java/src/net/i2p/router/transport/udp/InboundEstablishState.java index 96d45c216b480d7da763e842c45b5c205d11e5c7..332282c24d55a54ddf3151d9fd8d0615b912fcdf 100644 --- a/router/java/src/net/i2p/router/transport/udp/InboundEstablishState.java +++ b/router/java/src/net/i2p/router/transport/udp/InboundEstablishState.java @@ -155,6 +155,8 @@ class InboundEstablishState { byte[] ext = req.readExtendedOptions(); if (ext != null && ext.length >= UDPPacket.SESS_REQ_MIN_EXT_OPTIONS_LENGTH) { _introductionRequested = (ext[1] & (byte) UDPPacket.SESS_REQ_EXT_FLAG_REQUEST_RELAY_TAG) != 0; + if (_log.shouldInfo()) + _log.info("got sess req. w/ ext. options, need intro? " + _introductionRequested + ' ' + this); } if (_log.shouldLog(Log.DEBUG)) _log.debug("Receive sessionRequest, BobIP = " + Addresses.toString(_bobIP)); diff --git a/router/java/src/net/i2p/router/transport/udp/PacketBuilder.java b/router/java/src/net/i2p/router/transport/udp/PacketBuilder.java index 98cf82bb6163c7e04ccb2edf0121997854efa2e4..0f7e0ac80458f15576befbbc410033a36a98f214 100644 --- a/router/java/src/net/i2p/router/transport/udp/PacketBuilder.java +++ b/router/java/src/net/i2p/router/transport/udp/PacketBuilder.java @@ -788,8 +788,11 @@ class PacketBuilder { boolean ext = state.isExtendedOptionsAllowed(); if (ext) { options = new byte[UDPPacket.SESS_REQ_MIN_EXT_OPTIONS_LENGTH]; - if (state.needIntroduction()) + boolean intro = state.needIntroduction(); + if (intro) options[1] = (byte) UDPPacket.SESS_REQ_EXT_FLAG_REQUEST_RELAY_TAG; + if (_log.shouldInfo()) + _log.info("send sess req. w/ ext. options, need intro? " + intro + ' ' + state); off += UDPPacket.SESS_REQ_MIN_EXT_OPTIONS_LENGTH + 1; } else { options = null; 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 b68626ab50c32e5c635ac3a4ba84c1203c98751e..f6a94d7fb81a178b94ad90e9f09ec7d34a44b923 100644 --- a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java +++ b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java @@ -2216,6 +2216,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority if (_log.shouldLog(Log.DEBUG)) _log.debug("Require introducers, because our status is " + status); return true; + default: if (!allowDirectUDP()) { if (_log.shouldLog(Log.DEBUG)) @@ -2226,6 +2227,30 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority } } + /** + * MIGHT we require introducers? + * This is like introducersRequired, but if we aren't sure, this returns true. + * Used only by EstablishmentManager. + * + * @since 0.9.24 + */ + boolean introducersMaybeRequired() { + Status status = getReachabilityStatus(); + switch (status) { + case REJECT_UNSOLICITED: + case DIFFERENT: + case IPV4_FIREWALLED_IPV6_OK: + case IPV4_FIREWALLED_IPV6_UNKNOWN: + case IPV4_UNKNOWN_IPV6_OK: + case IPV4_UNKNOWN_IPV6_FIREWALLED: + case UNKNOWN: + return true; + + default: + return !allowDirectUDP(); + } + } + /** * For EstablishmentManager * @since 0.9.3