forked from I2P_Developers/i2p.i2p
Transport: Don't use HE addresses for GeoIP
Limit max MTU for HE addresses
This commit is contained in:
@@ -782,6 +782,11 @@ public class GeoIP {
|
||||
* @param ip IPv4 or IPv6
|
||||
*/
|
||||
public void add(byte ip[]) {
|
||||
// skip he.net tunnel 2001:470:: so we will get correct geoip from IPv4
|
||||
if (ip.length == 16 &&
|
||||
ip[0] == 0x20 && ip[1] == 0x01 &&
|
||||
ip[2] == 0x04 && ip[3] == 0x70)
|
||||
return;
|
||||
add(toLong(ip));
|
||||
}
|
||||
|
||||
@@ -815,6 +820,11 @@ public class GeoIP {
|
||||
* @return lower-case code, generally two letters, or null.
|
||||
*/
|
||||
String get(byte ip[]) {
|
||||
// skip he.net tunnel 2001:470:: so we will get correct geoip from IPv4
|
||||
if (ip.length == 16 &&
|
||||
ip[0] == 0x20 && ip[1] == 0x01 &&
|
||||
ip[2] == 0x04 && ip[3] == 0x70)
|
||||
return null;
|
||||
return get(toLong(ip));
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,13 @@ 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) {
|
||||
byte[] ip = addr.getAddress();
|
||||
if (ip[0] == 0x20 && ip[1] == 0x01 &&
|
||||
ip[2] == 0x04 && ip[3] == 0x70)
|
||||
return 1472;
|
||||
}
|
||||
return rectify(isIPv6, mtu);
|
||||
} catch (SocketException se) {
|
||||
// ignore
|
||||
|
||||
Reference in New Issue
Block a user