Loading services/core/java/com/android/server/vcn/VcnGatewayConnection.java +11 −1 Original line number Diff line number Diff line Loading @@ -1409,7 +1409,7 @@ public class VcnGatewayConnection extends StateMachine { @NonNull IpSecTransform transform, int direction) { try { // TODO: Set underlying network of tunnel interface // TODO(b/180163196): Set underlying network of tunnel interface // Transforms do not need to be persisted; the IkeSession will keep them alive mIpSecManager.applyTunnelModeTransform(tunnelIface, direction, transform); Loading Loading @@ -1540,6 +1540,7 @@ public class VcnGatewayConnection extends StateMachine { // mUnderlying assumed non-null, given check above. // If network changed, migrate. Otherwise, update any existing networkAgent. if (oldUnderlying == null || !oldUnderlying.network.equals(mUnderlying.network)) { Slog.v(TAG, "Migrating to new network: " + mUnderlying.network); mIkeSession.setNetwork(mUnderlying.network); } else { // oldUnderlying is non-null & underlying network itself has not changed Loading Loading @@ -1807,6 +1808,15 @@ public class VcnGatewayConnection extends StateMachine { childTransformCreated(mToken, transform, direction); } @Override public void onIpSecTransformsMigrated( @NonNull IpSecTransform inIpSecTransform, @NonNull IpSecTransform outIpSecTransform) { Slog.v(TAG, "ChildTransformsMigrated; token " + mToken); onIpSecTransformCreated(inIpSecTransform, IpSecManager.DIRECTION_IN); onIpSecTransformCreated(outIpSecTransform, IpSecManager.DIRECTION_OUT); } @Override public void onIpSecTransformDeleted(@NonNull IpSecTransform transform, int direction) { // Nothing to be done; no references to the IpSecTransform are held, and this transform Loading tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,20 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection assertEquals(mGatewayConnection.mConnectedState, mGatewayConnection.getCurrentState()); } @Test public void testMigratedTransformsAreApplied() throws Exception { getChildSessionCallback() .onIpSecTransformsMigrated(makeDummyIpSecTransform(), makeDummyIpSecTransform()); mTestLooper.dispatchAll(); for (int direction : new int[] {DIRECTION_IN, DIRECTION_OUT}) { verify(mIpSecSvc) .applyTunnelModeTransform( eq(TEST_IPSEC_TUNNEL_RESOURCE_ID), eq(direction), anyInt(), any()); } assertEquals(mGatewayConnection.mConnectedState, mGatewayConnection.getCurrentState()); } @Test public void testChildOpenedRegistersNetwork() throws Exception { // Verify scheduled but not canceled when entering ConnectedState Loading Loading
services/core/java/com/android/server/vcn/VcnGatewayConnection.java +11 −1 Original line number Diff line number Diff line Loading @@ -1409,7 +1409,7 @@ public class VcnGatewayConnection extends StateMachine { @NonNull IpSecTransform transform, int direction) { try { // TODO: Set underlying network of tunnel interface // TODO(b/180163196): Set underlying network of tunnel interface // Transforms do not need to be persisted; the IkeSession will keep them alive mIpSecManager.applyTunnelModeTransform(tunnelIface, direction, transform); Loading Loading @@ -1540,6 +1540,7 @@ public class VcnGatewayConnection extends StateMachine { // mUnderlying assumed non-null, given check above. // If network changed, migrate. Otherwise, update any existing networkAgent. if (oldUnderlying == null || !oldUnderlying.network.equals(mUnderlying.network)) { Slog.v(TAG, "Migrating to new network: " + mUnderlying.network); mIkeSession.setNetwork(mUnderlying.network); } else { // oldUnderlying is non-null & underlying network itself has not changed Loading Loading @@ -1807,6 +1808,15 @@ public class VcnGatewayConnection extends StateMachine { childTransformCreated(mToken, transform, direction); } @Override public void onIpSecTransformsMigrated( @NonNull IpSecTransform inIpSecTransform, @NonNull IpSecTransform outIpSecTransform) { Slog.v(TAG, "ChildTransformsMigrated; token " + mToken); onIpSecTransformCreated(inIpSecTransform, IpSecManager.DIRECTION_IN); onIpSecTransformCreated(outIpSecTransform, IpSecManager.DIRECTION_OUT); } @Override public void onIpSecTransformDeleted(@NonNull IpSecTransform transform, int direction) { // Nothing to be done; no references to the IpSecTransform are held, and this transform Loading
tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,20 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection assertEquals(mGatewayConnection.mConnectedState, mGatewayConnection.getCurrentState()); } @Test public void testMigratedTransformsAreApplied() throws Exception { getChildSessionCallback() .onIpSecTransformsMigrated(makeDummyIpSecTransform(), makeDummyIpSecTransform()); mTestLooper.dispatchAll(); for (int direction : new int[] {DIRECTION_IN, DIRECTION_OUT}) { verify(mIpSecSvc) .applyTunnelModeTransform( eq(TEST_IPSEC_TUNNEL_RESOURCE_ID), eq(direction), anyInt(), any()); } assertEquals(mGatewayConnection.mConnectedState, mGatewayConnection.getCurrentState()); } @Test public void testChildOpenedRegistersNetwork() throws Exception { // Verify scheduled but not canceled when entering ConnectedState Loading