Update VPN isolation code for excluded routes

Bug: 230058738
Test: atest LinkPropertiesTest

Result: https://paste.googleplex.com/4706859672928256

Change-Id: I970fca6b0e2cd358e9bd77152563d13367867c74
This commit is contained in:
Prerana
2022-04-28 04:02:05 +00:00
committed by Prerana Patil
parent ac8935bee7
commit 2b97bbebf4
3 changed files with 28 additions and 1 deletions

View File

@@ -1261,6 +1261,17 @@ public class LinkPropertiesTest {
assertFalse(lp.hasIpv4UnreachableDefaultRoute());
}
@Test @IgnoreUpTo(Build.VERSION_CODES.S_V2)
public void testHasExcludeRoute() {
LinkProperties lp = new LinkProperties();
lp.setInterfaceName("VPN");
lp.addRoute(new RouteInfo(new IpPrefix(ADDRV4, 2), RTN_UNICAST));
lp.addRoute(new RouteInfo(new IpPrefix(ADDRV6, 0), RTN_UNICAST));
assertFalse(lp.hasExcludeRoute());
lp.addRoute(new RouteInfo(new IpPrefix(ADDRV6, 2), RTN_THROW));
assertTrue(lp.hasExcludeRoute());
}
@Test @IgnoreUpTo(Build.VERSION_CODES.Q)
@EnableCompatChanges({LinkProperties.EXCLUDED_ROUTES})
public void testRouteAddWithSameKey() throws Exception {