forked from I2P_Developers/i2p.i2p
SSU2: Don't rectify MTUs to mod 16 in SSU2 addresses
Set max MTU for range48.org brokered addresses Limit MTU for brokered addresses in UDPAddress also
This commit is contained in:
@@ -90,12 +90,18 @@ public class MTU {
|
||||
log.logAlways(Log.WARN, "Unusually low MTU " + mtu + " for interface " + ia +
|
||||
", consider disabling");
|
||||
}
|
||||
// fix for he.net tunnels with too big MTU
|
||||
if (isIPv6 && mtu > 1472) {
|
||||
// fix for brokered tunnels with too big MTU
|
||||
if (isIPv6 && mtu > 1420) {
|
||||
byte[] ip = addr.getAddress();
|
||||
if (ip[0] == 0x20 && ip[1] == 0x01 &&
|
||||
// he.net
|
||||
if (mtu > 1472 &&
|
||||
ip[0] == 0x20 && ip[1] == 0x01 &&
|
||||
ip[2] == 0x04 && ip[3] == 0x70)
|
||||
return 1472;
|
||||
// route48.org, supports Wireguard
|
||||
if (ip[0] == 0x2a && ip[1] == 0x06 &&
|
||||
ip[2] == (byte) 0xa0 && ip[3] == 0x04)
|
||||
return 1420;
|
||||
}
|
||||
if (isSSU2)
|
||||
return Math.min(mtu, PeerState2.MAX_MTU);
|
||||
|
||||
@@ -98,12 +98,27 @@ class UDPAddress {
|
||||
_isIPv4 = (_host != null && _host.contains(".")) || (caps != null && caps.contains("4"));
|
||||
_isIPv6 = (_host != null && _host.contains(":")) || (caps != null && caps.contains("6"));
|
||||
|
||||
final boolean ssu2only = addr.getTransportStyle().equals("SSU2");
|
||||
int cmtu = 0;
|
||||
try {
|
||||
String mtu = addr.getOption(PROP_MTU);
|
||||
if (mtu != null) {
|
||||
int imtu = Integer.parseInt(mtu);
|
||||
boolean isIPv6 = _host != null && _host.contains(":");
|
||||
cmtu = MTU.rectify(isIPv6, Integer.parseInt(mtu));
|
||||
if (isIPv6 && imtu > 1420) {
|
||||
// fix for brokered tunnels with too big MTU
|
||||
if (imtu > 1472 && _host.startsWith("2001:470:"))
|
||||
imtu = 1472;
|
||||
else if (_host.startsWith("2a06:a004:"))
|
||||
imtu = 1420;
|
||||
}
|
||||
if (ssu2only) {
|
||||
// 1280 min is not enforced here, so that it may be
|
||||
// rejected in OES2 constructor and IES2.gotRI()
|
||||
cmtu = Math.min(imtu, PeerState2.MAX_MTU);
|
||||
} else {
|
||||
cmtu = MTU.rectify(isIPv6, imtu);
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException nfe) {}
|
||||
_mtu = cmtu;
|
||||
@@ -126,7 +141,6 @@ class UDPAddress {
|
||||
InetAddress[] cintroAddresses = null;
|
||||
long[] cintroExps = null;
|
||||
Hash[] cintroHashes = null;
|
||||
final boolean ssu2only = addr.getTransportStyle().equals("SSU2");
|
||||
final boolean ssu2enable = SSU2Util.ENABLE_RELAY && (ssu2only || "2".equals(addr.getOption("v")));
|
||||
for (int i = MAX_INTRODUCERS - 1; i >= 0; i--) {
|
||||
// This is the only one required for SSU 1 and 2
|
||||
|
||||
Reference in New Issue
Block a user