I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Verified Commit 5c232792 authored by zzz's avatar zzz
Browse files

SSU: Don't change ports in some cases

parent 6e033003
No related branches found
No related tags found
No related merge requests found
......@@ -124,6 +124,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
private Hash _lastFromv4, _lastFromv6;
private byte[] _lastOurIPv4, _lastOurIPv6;
private int _lastOurPortv4, _lastOurPortv6;
private boolean _haveUPnP;
/** since we don't publish our IP/port if introduced anymore, we need
to store it somewhere. */
private RouterAddress _currentOurV4Address;
......@@ -963,6 +964,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
// (we don't want to set this for Teredo, 6to4, ...)
_haveIPv6Address = true;
}
if (source == SOURCE_UPNP)
_haveUPnP = true;
if (explicitAddressSpecified())
return;
String sources = _context.getProperty(PROP_SOURCES, DEFAULT_SOURCES);
......@@ -1033,6 +1036,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
*/
@Override
public void forwardPortStatus(byte[] ip, int port, int externalPort, boolean success, String reason) {
if (success)
_haveUPnP = true;
if (_log.shouldLog(Log.WARN)) {
if (success)
_log.warn("UPnP has opened the SSU port: " + port + " via " + Addresses.toString(ip, externalPort));
......@@ -1149,6 +1154,9 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
if (_log.shouldLog(Log.INFO))
_log.info(from + " and another peer agree we have the IP "
+ Addresses.toString(ourIP, ourPort) + ". Changing address.");
// Never change port for IPv6 or if we have UPnP
if (_haveUPnP || ourIP.length == 16)
ourPort = 0;
changeAddress(ourIP, ourPort);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment