Skip to content

Commit 95f50d0

Browse files
Motomu UtsumiExactExampl
authored andcommitted
Skip adding ingress discard rule to legacy VPN
Cherry-pick of aosp/3201971 to backport VPN security fix to non-mainline U devices. Some legacy VPNs need to receive packets to VPN address via non-VPN interface. Bug: 193031925 Test: TH (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5441470a6a04f36369ec79c3eff3a72fc47ca9e3) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:717bb36e5963c2dc4c315b7d58f0c7b3d85fcf31) Merged-In: If4f6b095a719a0abcb6254c522beac5d45110d4d Change-Id: If4f6b095a719a0abcb6254c522beac5d45110d4d
1 parent a18b211 commit 95f50d0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

service/src/com/android/server/ConnectivityService.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8349,8 +8349,10 @@ private void updateVpnFiltering(@NonNull LinkProperties newLp, @Nullable LinkPro
83498349
* interfaces.
83508350
* Ingress discard rule is added to the address iff
83518351
* 1. The address is not a link local address
8352-
* 2. The address is used by a single VPN interface and not used by any other
8352+
* 2. The address is used by a single non-Legacy VPN interface and not used by any other
83538353
* interfaces even non-VPN ones
8354+
* Ingress discard rule is not be added to Legacy VPN since some Legacy VPNs need to receive
8355+
* packet to VPN address via non-VPN interface.
83548356
* This method can be called during network disconnects, when nai has already been removed from
83558357
* mNetworkAgentInfos.
83568358
*
@@ -8385,7 +8387,8 @@ private Set<Pair<InetAddress, String>> generateIngressDiscardRules(
83858387
// for different network.
83868388
final Set<Pair<InetAddress, String>> ingressDiscardRules = new ArraySet<>();
83878389
for (final NetworkAgentInfo agent : nais) {
8388-
if (!agent.isVPN() || agent.isDestroyed()) {
8390+
if (!agent.isVPN() || agent.isDestroyed()
8391+
|| getVpnType(agent) == VpnManager.TYPE_VPN_LEGACY) {
83898392
continue;
83908393
}
83918394
final LinkProperties agentLp = (nai == agent) ? lp : agent.linkProperties;

0 commit comments

Comments
 (0)