forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p' (head 17371fd6f9ef94bbb60a66c6bacb6828d6a4cde5)
to branch 'i2p.i2p.zzz.ipv6' (head 065a076899a2581b4196e626f2b0654c3d39518a)
This commit is contained in:
@ -50,7 +50,12 @@ public class ConfigNetHelper extends HelperBase {
|
|||||||
return ua.getHost();
|
return ua.getHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To reduce confusion caused by NATs, this is the current internal SSU port,
|
||||||
|
* not the external port.
|
||||||
|
*/
|
||||||
public String getUdpPort() {
|
public String getUdpPort() {
|
||||||
|
/****
|
||||||
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
|
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
|
||||||
if (addr == null)
|
if (addr == null)
|
||||||
return _("unknown");
|
return _("unknown");
|
||||||
@ -58,8 +63,17 @@ public class ConfigNetHelper extends HelperBase {
|
|||||||
if (ua.getPort() <= 0)
|
if (ua.getPort() <= 0)
|
||||||
return _("unknown");
|
return _("unknown");
|
||||||
return "" + ua.getPort();
|
return "" + ua.getPort();
|
||||||
|
****/
|
||||||
|
// Since we can't get to UDPTransport.getRequestedPort() from here, just use
|
||||||
|
// configured port. If UDPTransport is changed such that the actual port
|
||||||
|
// could be different, fix this.
|
||||||
|
return getConfiguredUdpPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This should always be the actual internal SSU port, as UDPTransport udpates
|
||||||
|
* the config when it changes.
|
||||||
|
*/
|
||||||
public String getConfiguredUdpPort() {
|
public String getConfiguredUdpPort() {
|
||||||
return _context.getProperty(UDPTransport.PROP_INTERNAL_PORT, "unset");
|
return _context.getProperty(UDPTransport.PROP_INTERNAL_PORT, "unset");
|
||||||
}
|
}
|
||||||
|
61
build.xml
61
build.xml
@ -250,35 +250,28 @@
|
|||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- this makes an empty build/launchi2p.jar and the build/i2p.exe for the no-wrapper windows startup, if possible -->
|
|
||||||
<target name="buildexe">
|
|
||||||
<condition property="noExe">
|
|
||||||
<or>
|
|
||||||
<os arch="ppc" />
|
|
||||||
<os arch="armv5tejl" />
|
|
||||||
<os arch="armv6l" />
|
|
||||||
<os arch="armv7l" />
|
|
||||||
</or>
|
|
||||||
</condition>
|
|
||||||
<condition property="noExe">
|
<condition property="noExe">
|
||||||
<not>
|
<not>
|
||||||
|
<!-- We only have launch4j binaries for the following systems -->
|
||||||
|
<and>
|
||||||
|
<or>
|
||||||
|
<os arch="x86" />
|
||||||
|
<os arch="i386" />
|
||||||
|
<os arch="i586" />
|
||||||
|
<os arch="i686" />
|
||||||
|
<os arch="amd64" />
|
||||||
|
<os arch="x86_64" />
|
||||||
|
</or>
|
||||||
<or>
|
<or>
|
||||||
<os name="Linux" />
|
<os name="Linux" />
|
||||||
<os family="windows" />
|
<os family="windows" />
|
||||||
</or>
|
</or>
|
||||||
|
</and>
|
||||||
</not>
|
</not>
|
||||||
</condition>
|
</condition>
|
||||||
<ant target="doBuildEXE" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="launch4j">
|
<!-- this makes an empty build/launchi2p.jar and the build/i2p.exe for the no-wrapper windows startup, if possible -->
|
||||||
<taskdef name="launch4j"
|
<target name="buildexe" depends="buildProperties, launch4j" unless="noExe">
|
||||||
classname="net.sf.launch4j.ant.Launch4jTask"
|
|
||||||
classpath="${basedir}/installer/lib/launch4j/launch4j.jar:${basedir}/installer/lib/launch4j/lib/xstream.jar" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- this makes an empty build/launchi2p.jar and the build/i2p.exe for the no-wrapper windows startup -->
|
|
||||||
<target name="doBuildEXE" depends="buildProperties, launch4j" unless="noExe">
|
|
||||||
<echo message="See the file "build.properties" if this step fails." />
|
<echo message="See the file "build.properties" if this step fails." />
|
||||||
<jar destfile="./build/launchi2p.jar">
|
<jar destfile="./build/launchi2p.jar">
|
||||||
<manifest>
|
<manifest>
|
||||||
@ -294,6 +287,12 @@
|
|||||||
<!-- thazzit -->
|
<!-- thazzit -->
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="launch4j">
|
||||||
|
<taskdef name="launch4j"
|
||||||
|
classname="net.sf.launch4j.ant.Launch4jTask"
|
||||||
|
classpath="${basedir}/installer/lib/launch4j/launch4j.jar:${basedir}/installer/lib/launch4j/lib/xstream.jar" />
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="jar" depends="jarSmall" >
|
<target name="jar" depends="jarSmall" >
|
||||||
<copy file="apps/BOB/dist/BOB.jar" todir="build/" />
|
<copy file="apps/BOB/dist/BOB.jar" todir="build/" />
|
||||||
<copy file="apps/sam/java/build/sam.jar" todir="build/" />
|
<copy file="apps/sam/java/build/sam.jar" todir="build/" />
|
||||||
@ -1211,28 +1210,8 @@
|
|||||||
<ant target="installerexe" />
|
<ant target="installerexe" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="installerexe" depends="launch4j">
|
|
||||||
<condition property="noExe">
|
|
||||||
<or>
|
|
||||||
<os arch="ppc" />
|
|
||||||
<os arch="armv5tejl" />
|
|
||||||
<os arch="armv6l" />
|
|
||||||
<os arch="armv7l" />
|
|
||||||
</or>
|
|
||||||
</condition>
|
|
||||||
<condition property="noExe">
|
|
||||||
<not>
|
|
||||||
<or>
|
|
||||||
<os name="Linux" />
|
|
||||||
<os family="windows" />
|
|
||||||
</or>
|
|
||||||
</not>
|
|
||||||
</condition>
|
|
||||||
<ant target="doInstallerEXE" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- this makes i2pinstall.exe from install.jar -->
|
<!-- this makes i2pinstall.exe from install.jar -->
|
||||||
<target name="doInstallerEXE" depends="launch4j" unless="noExe">
|
<target name="installerexe" depends="launch4j" unless="noExe">
|
||||||
<echo message="See the file "build.properties" if this step fails." />
|
<echo message="See the file "build.properties" if this step fails." />
|
||||||
<!-- now the installer exe -->
|
<!-- now the installer exe -->
|
||||||
<launch4j configFile="./installer/i2pinstaller.xml" />
|
<launch4j configFile="./installer/i2pinstaller.xml" />
|
||||||
|
13
history.txt
13
history.txt
@ -1,3 +1,16 @@
|
|||||||
|
2013-05-06 zzz
|
||||||
|
* Transports: Clean up internal/external port confusion (ticket #873)
|
||||||
|
- Bind SSU to configured internal, not external, port at startup
|
||||||
|
- Use only internal ports for UPnP (getRequestedPort() fixups)
|
||||||
|
- Don't have NTCP follow frequent SSU port changes
|
||||||
|
- Don't use external SSU port for internal NTCP port
|
||||||
|
- Display internal SSU port on /confignet
|
||||||
|
|
||||||
|
2013-05-01 zzz
|
||||||
|
* BuildRequestor: Slow down build loop if we have no exploratory tunnels
|
||||||
|
(ticket #926)
|
||||||
|
* IRC Server tunnel: Reject bad protocols immediately
|
||||||
|
|
||||||
2013-04-30 str4d
|
2013-04-30 str4d
|
||||||
* Console: Updates to readme_ar and a CSS tweak from hamada (ticket #489)
|
* Console: Updates to readme_ar and a CSS tweak from hamada (ticket #489)
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 20;
|
public final static long BUILD = 21;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "-ipv6";
|
public final static String EXTRA = "-ipv6";
|
||||||
|
@ -274,8 +274,8 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
|||||||
* This should really be moved to ntcp/NTCPTransport.java, why is it here?
|
* This should really be moved to ntcp/NTCPTransport.java, why is it here?
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void notifyReplaceAddress(RouterAddress UDPAddr) {
|
public synchronized void notifyReplaceAddress(RouterAddress udpAddr) {
|
||||||
if (UDPAddr == null)
|
if (udpAddr == null)
|
||||||
return;
|
return;
|
||||||
NTCPTransport t = (NTCPTransport) _manager.getTransport(NTCPTransport.STYLE);
|
NTCPTransport t = (NTCPTransport) _manager.getTransport(NTCPTransport.STYLE);
|
||||||
if (t == null)
|
if (t == null)
|
||||||
@ -309,19 +309,38 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
|||||||
// Auto Port Setting
|
// Auto Port Setting
|
||||||
// old behavior (<= 0.7.3): auto-port defaults to false, and true trumps explicit setting
|
// old behavior (<= 0.7.3): auto-port defaults to false, and true trumps explicit setting
|
||||||
// new behavior (>= 0.7.4): auto-port defaults to true, but explicit setting trumps auto
|
// new behavior (>= 0.7.4): auto-port defaults to true, but explicit setting trumps auto
|
||||||
|
// TODO rewrite this to operate on ints instead of strings
|
||||||
String oport = newProps.getProperty(NTCPAddress.PROP_PORT);
|
String oport = newProps.getProperty(NTCPAddress.PROP_PORT);
|
||||||
String nport = null;
|
String nport = null;
|
||||||
String cport = _context.getProperty(PROP_I2NP_NTCP_PORT);
|
String cport = _context.getProperty(PROP_I2NP_NTCP_PORT);
|
||||||
if (cport != null && cport.length() > 0) {
|
if (cport != null && cport.length() > 0) {
|
||||||
nport = cport;
|
nport = cport;
|
||||||
} else if (_context.getBooleanPropertyDefaultTrue(PROP_I2NP_NTCP_AUTO_PORT)) {
|
} else if (_context.getBooleanPropertyDefaultTrue(PROP_I2NP_NTCP_AUTO_PORT)) {
|
||||||
nport = UDPAddr.getOption(UDPAddress.PROP_PORT);
|
// 0.9.6 change
|
||||||
|
// This wasn't quite right, as udpAddr is the EXTERNAL port and we really
|
||||||
|
// want NTCP to bind to the INTERNAL port the first time,
|
||||||
|
// because if they are different, the NAT is changing them, and
|
||||||
|
// it probably isn't mapping UDP and TCP the same.
|
||||||
|
Transport udp = _manager.getTransport(UDPTransport.STYLE);
|
||||||
|
if (udp != null) {
|
||||||
|
int udpIntPort = udp.getRequestedPort();
|
||||||
|
if (udpIntPort > 0)
|
||||||
|
// should always be true
|
||||||
|
nport = Integer.toString(udpIntPort);
|
||||||
|
}
|
||||||
|
if (nport == null)
|
||||||
|
// fallback
|
||||||
|
nport = udpAddr.getOption(UDPAddress.PROP_PORT);
|
||||||
}
|
}
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info("old: " + oport + " config: " + cport + " new: " + nport);
|
_log.info("old: " + oport + " config: " + cport + " new: " + nport);
|
||||||
if (nport == null || nport.length() <= 0)
|
if (nport == null || nport.length() <= 0)
|
||||||
return;
|
return;
|
||||||
if (oport == null || ! oport.equals(nport)) {
|
// 0.9.6 change
|
||||||
|
// Don't have NTCP "chase" SSU's external port,
|
||||||
|
// as it may change, possibly frequently.
|
||||||
|
//if (oport == null || ! oport.equals(nport)) {
|
||||||
|
if (oport == null) {
|
||||||
newProps.setProperty(NTCPAddress.PROP_PORT, nport);
|
newProps.setProperty(NTCPAddress.PROP_PORT, nport);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -348,7 +367,7 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
|||||||
_log.info("old: " + ohost + " config: " + name + " auto: " + enabled + " status: " + status);
|
_log.info("old: " + ohost + " config: " + name + " auto: " + enabled + " status: " + status);
|
||||||
if (enabled.equals("always") ||
|
if (enabled.equals("always") ||
|
||||||
(Boolean.parseBoolean(enabled) && status == STATUS_OK)) {
|
(Boolean.parseBoolean(enabled) && status == STATUS_OK)) {
|
||||||
String nhost = UDPAddr.getOption(UDPAddress.PROP_HOST);
|
String nhost = udpAddr.getOption(UDPAddress.PROP_HOST);
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info("old: " + ohost + " config: " + name + " new: " + nhost);
|
_log.info("old: " + ohost + " config: " + name + " new: " + nhost);
|
||||||
if (nhost == null || nhost.length() <= 0)
|
if (nhost == null || nhost.length() <= 0)
|
||||||
|
@ -382,10 +382,6 @@ public class TransportManager implements TransportEventListener {
|
|||||||
Set<Port> rv = new HashSet(4);
|
Set<Port> rv = new HashSet(4);
|
||||||
for (Transport t : _transports.values()) {
|
for (Transport t : _transports.values()) {
|
||||||
int port = t.getRequestedPort();
|
int port = t.getRequestedPort();
|
||||||
for (RouterAddress ra : t.getCurrentAddresses()) {
|
|
||||||
int p = ra.getPort();
|
|
||||||
if (p > 0)
|
|
||||||
port = p;
|
|
||||||
// Use UDP port for NTCP too - see comment in NTCPTransport.getRequestedPort() for why this is here
|
// Use UDP port for NTCP too - see comment in NTCPTransport.getRequestedPort() for why this is here
|
||||||
if (t.getStyle().equals(NTCPTransport.STYLE) && port <= 0 &&
|
if (t.getStyle().equals(NTCPTransport.STYLE) && port <= 0 &&
|
||||||
_context.getBooleanProperty(CommSystemFacadeImpl.PROP_I2NP_NTCP_AUTO_PORT)) {
|
_context.getBooleanProperty(CommSystemFacadeImpl.PROP_I2NP_NTCP_AUTO_PORT)) {
|
||||||
@ -393,9 +389,6 @@ public class TransportManager implements TransportEventListener {
|
|||||||
if (udp != null)
|
if (udp != null)
|
||||||
port = t.getRequestedPort();
|
port = t.getRequestedPort();
|
||||||
}
|
}
|
||||||
if (port > 0)
|
|
||||||
rv.add(new Port(t.getStyle(), port));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -187,6 +187,10 @@ class EventPumper implements Runnable {
|
|||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Error selecting", ioe);
|
_log.warn("Error selecting", ioe);
|
||||||
|
} catch (CancelledKeyException cke) {
|
||||||
|
if (_log.shouldLog(Log.WARN))
|
||||||
|
_log.warn("Error selecting", cke);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastFailsafeIteration + FAILSAFE_ITERATION_FREQ < System.currentTimeMillis()) {
|
if (lastFailsafeIteration + FAILSAFE_ITERATION_FREQ < System.currentTimeMillis()) {
|
||||||
|
@ -636,6 +636,7 @@ public class NTCPTransport extends TransportImpl {
|
|||||||
|
|
||||||
//private boolean bindAllInterfaces() { return true; }
|
//private boolean bindAllInterfaces() { return true; }
|
||||||
|
|
||||||
|
/** caller must synch on this */
|
||||||
private void configureLocalAddress() {
|
private void configureLocalAddress() {
|
||||||
RouterContext ctx = getContext();
|
RouterContext ctx = getContext();
|
||||||
if (ctx == null) {
|
if (ctx == null) {
|
||||||
@ -682,8 +683,17 @@ public class NTCPTransport extends TransportImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return current port, else NTCP configured port, else -1 (but not UDP port if auto)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getRequestedPort() {
|
public int getRequestedPort() {
|
||||||
|
NTCPAddress addr = _myAddress;
|
||||||
|
if (addr != null) {
|
||||||
|
int port = addr.getPort();
|
||||||
|
if (port > 0)
|
||||||
|
return port;
|
||||||
|
}
|
||||||
// would be nice to do this here but we can't easily get to the UDP transport.getRequested_Port()
|
// would be nice to do this here but we can't easily get to the UDP transport.getRequested_Port()
|
||||||
// from here, so we do it in TransportManager.
|
// from here, so we do it in TransportManager.
|
||||||
// if (Boolean.valueOf(_context.getProperty(CommSystemFacadeImpl.PROP_I2NP_NTCP_AUTO_PORT)).booleanValue())
|
// if (Boolean.valueOf(_context.getProperty(CommSystemFacadeImpl.PROP_I2NP_NTCP_AUTO_PORT)).booleanValue())
|
||||||
|
@ -86,7 +86,10 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
|
|
||||||
/** summary info to distribute */
|
/** summary info to distribute */
|
||||||
private RouterAddress _externalAddress;
|
private RouterAddress _externalAddress;
|
||||||
/** port number on which we can be reached, or -1 for error, or 0 for unset */
|
/**
|
||||||
|
* Port number on which we can be reached, or -1 for error, or 0 for unset
|
||||||
|
* Do NOT use this for current internal port - use _endpoint.getListenPort()
|
||||||
|
*/
|
||||||
private int _externalListenPort;
|
private int _externalListenPort;
|
||||||
/** IP address of externally reachable host, or null */
|
/** IP address of externally reachable host, or null */
|
||||||
private InetAddress _externalListenHost;
|
private InetAddress _externalListenHost;
|
||||||
@ -317,19 +320,18 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
|
|
||||||
// Requested bind port
|
// Requested bind port
|
||||||
// This may be -1 or may not be honored if busy,
|
// This may be -1 or may not be honored if busy,
|
||||||
|
// Priority: Configured internal, then already used, then configured external
|
||||||
// we will check below after starting up the endpoint.
|
// we will check below after starting up the endpoint.
|
||||||
int port;
|
int port;
|
||||||
int oldIPort = _context.getProperty(PROP_INTERNAL_PORT, -1);
|
int oldIPort = _context.getProperty(PROP_INTERNAL_PORT, -1);
|
||||||
|
int oldBindPort = _endpoint != null ? _endpoint.getListenPort() : -1;
|
||||||
int oldEPort = _context.getProperty(PROP_EXTERNAL_PORT, -1);
|
int oldEPort = _context.getProperty(PROP_EXTERNAL_PORT, -1);
|
||||||
if (_externalListenPort <= 0) {
|
|
||||||
// no explicit external port, so lets try an internal one
|
|
||||||
if (oldIPort > 0)
|
if (oldIPort > 0)
|
||||||
port = oldIPort;
|
port = oldIPort;
|
||||||
|
else if (oldBindPort > 0)
|
||||||
|
port = oldBindPort;
|
||||||
else
|
else
|
||||||
port = oldEPort;
|
port = oldEPort;
|
||||||
} else {
|
|
||||||
port = _externalListenPort;
|
|
||||||
}
|
|
||||||
if (bindToAddr != null && _log.shouldLog(Log.WARN))
|
if (bindToAddr != null && _log.shouldLog(Log.WARN))
|
||||||
_log.warn("Binding only to " + bindToAddr);
|
_log.warn("Binding only to " + bindToAddr);
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
@ -461,14 +463,23 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _externalListenPort should always be set (by startup()) before this is called,
|
* The current or configured internal port.
|
||||||
* so the returned value should be > 0
|
* UDPEndpoint should always be instantiated (and a random port picked if not configured)
|
||||||
|
* before this is called, so the returned value should be > 0
|
||||||
|
* unless the endpoint failed to bind.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getRequestedPort() {
|
public int getRequestedPort() {
|
||||||
if (_externalListenPort > 0)
|
if (_endpoint != null) {
|
||||||
return _externalListenPort;
|
int rv = _endpoint.getListenPort();
|
||||||
return _context.getProperty(PROP_INTERNAL_PORT, -1);
|
if (rv > 0)
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
// fallbacks
|
||||||
|
int rv = _context.getProperty(PROP_INTERNAL_PORT, -1);
|
||||||
|
if (rv > 0)
|
||||||
|
return rv;
|
||||||
|
return _context.getProperty(PROP_EXTERNAL_PORT, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user