From 950d10f9cb903dd1b1728279637b9c7368bd0d87 Mon Sep 17 00:00:00 2001 From: Chalard Jean Date: Sun, 26 Jul 2020 20:02:04 +0900 Subject: [PATCH] Resolve the endpoint in legacy VPN This adds code to resolve the endpoint in the legacy VPN runner if it was specified as a hostname, and enables the previously added test that was disabled because this was broken until this patch. See the linked bug for details. This patch uses the async DNS API to do the resolution. This lets the resolution be fully cancellable, though the code is more complex than with the non-interruptible getByName. Test: VpnTest and in particular VpnTest#testStartRacoon Fixes the test meant to test this Also manual testing that resolution of a real hostname works as expected, that failure to resolve returns correctly, and that cancellation/interruption will unblock the thread and terminate immediately. Bug: 158974172 Change-Id: I714985f3c7919dad9c1854830c50f29c1f94a21e --- tests/net/java/com/android/server/connectivity/VpnTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/net/java/com/android/server/connectivity/VpnTest.java b/tests/net/java/com/android/server/connectivity/VpnTest.java index a9313a30c1..de1c5759ee 100644 --- a/tests/net/java/com/android/server/connectivity/VpnTest.java +++ b/tests/net/java/com/android/server/connectivity/VpnTest.java @@ -98,7 +98,6 @@ import com.android.internal.net.VpnProfile; import com.android.server.IpSecService; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Answers; @@ -1054,7 +1053,6 @@ public class VpnTest { } @Test - @Ignore("b/158974172") // remove when the bug is fixed public void testStartRacoonHostname() throws Exception { startRacoon("hostname", "5.6.7.8"); // address returned by deps.resolve }