From ac927fe532ab19b5557fadd6b648682932c26e99 Mon Sep 17 00:00:00 2001 From: manojboopathi Date: Thu, 30 Nov 2017 17:11:49 -0800 Subject: [PATCH] Fix CTS Test Dual Stack Test Passing Issue CTS test should fail if IPV6 Sockets is used on IPV4 address. Unfortunately its been passing fine due to unhandled catch exception. This is fixed in this CL. Bug: 64435904 Test: Ran CTS test to verify ./run_cts.sh Change-Id: I369c1b5baaa64b64feaa3f298e61f46d1200ea17 --- services/core/java/com/android/server/IpSecService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java index d3ab1259c9..989cb886c1 100644 --- a/services/core/java/com/android/server/IpSecService.java +++ b/services/core/java/com/android/server/IpSecService.java @@ -19,6 +19,7 @@ package com.android.server; import static android.Manifest.permission.DUMP; import static android.net.IpSecManager.INVALID_RESOURCE_ID; import static android.system.OsConstants.AF_INET; +import static android.system.OsConstants.EINVAL; import static android.system.OsConstants.IPPROTO_UDP; import static android.system.OsConstants.SOCK_DGRAM; import static com.android.internal.util.Preconditions.checkNotNull; @@ -1220,7 +1221,11 @@ public class IpSecService extends IIpSecService.Stub { info.getSpiRecord(direction).getSpi()); } } catch (ServiceSpecificException e) { - // FIXME: get the error code and throw is at an IOException from Errno Exception + if (e.errorCode == EINVAL) { + throw new IllegalArgumentException(e.toString()); + } else { + throw e; + } } }