Fix Android VPN traffic from external apps
This commit is contained in:
@@ -30,8 +30,8 @@ android {
|
||||
applicationId "su.cin.rapvpn"
|
||||
minSdk 26
|
||||
targetSdk 35
|
||||
versionCode 182
|
||||
versionName "0.2.182"
|
||||
versionCode 183
|
||||
versionName "0.2.183"
|
||||
buildConfigField "String", "DEFAULT_BACKEND_URL", "\"${normalizeGradleString(defaultBackendUrl)}\""
|
||||
buildConfigField "String", "DEFAULT_CLUSTER_ID", "\"${normalizeGradleString(defaultClusterId)}\""
|
||||
buildConfigField "String", "DEFAULT_ORGANIZATION_ID", "\"${normalizeGradleString(defaultOrganizationId)}\""
|
||||
|
||||
@@ -1771,12 +1771,16 @@ public class RapVpnService extends VpnService {
|
||||
byte[] copy = new byte[length];
|
||||
System.arraycopy(packet, 0, copy, 0, length);
|
||||
if (!hasIPv4Source(copy, length)) {
|
||||
String natKey = natKeyForOutboundReturn(copy, length);
|
||||
if (natKey.isEmpty() || !rewriteIPv4SourceToVPN(copy, length, natKey)) {
|
||||
long mismatch = uplinkSourceMismatchPackets.incrementAndGet();
|
||||
Log.w(TAG, "vpn uplink source is not vpn address; dropping " + packetSummary(copy, length));
|
||||
writeRuntimeDetail("source_drop", packetSummary(copy, length), "uplink", -1, mismatch, "SOURCE_MISMATCH");
|
||||
recordUplinkDrop(length);
|
||||
return;
|
||||
}
|
||||
writeRuntimeDetail("source_nat", packetSummary(copy, length), "uplink", -1, -1, "");
|
||||
}
|
||||
if (clampIPv4TCPMSS(copy, length, VPN_TCP_MSS_CLAMP)) {
|
||||
writeRuntimeDetail("tcp_mss_clamp", packetSummary(copy, length), "uplink_tcp", -1, -1, "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user