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