Skip adding ingress discard rule to legacy VPN

Some legacy VPNs need to receive packets to VPN address via
non-VPN interface.

Bug: 352424251
Test: CsIngressDiscardRuleTest
Change-Id: Iad06dc69c5bf5ccda476e89ed9b0fc1bc63d2ebe
This commit is contained in:
Motomu Utsumi 2024-08-01 21:27:12 +09:00
commit 1b376f0fc4

View file

@ -9400,8 +9400,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
* interfaces.
* Ingress discard rule is added to the address iff
* 1. The address is not a link local address
* 2. The address is used by a single VPN interface and not used by any other
* 2. The address is used by a single non-Legacy VPN interface and not used by any other
* interfaces even non-VPN ones
* Ingress discard rule is not be added to Legacy VPN since some Legacy VPNs need to receive
* packet to VPN address via non-VPN interface.
* This method can be called during network disconnects, when nai has already been removed from
* mNetworkAgentInfos.
*
@ -9436,7 +9438,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
// for different network.
final Set<Pair<InetAddress, String>> ingressDiscardRules = new ArraySet<>();
for (final NetworkAgentInfo agent : nais) {
if (!agent.isVPN() || agent.isDestroyed()) {
if (!agent.isVPN() || agent.isDestroyed()
|| getVpnType(agent) == VpnManager.TYPE_VPN_LEGACY) {
continue;
}
final LinkProperties agentLp = (nai == agent) ? lp : agent.linkProperties;