From 2152d88a16c899ffda75032a6db0fd0ad79cf697 Mon Sep 17 00:00:00 2001 From: Yan Yan Date: Tue, 27 Jun 2023 23:27:53 +0000 Subject: [PATCH] VPN: Explicitly handle IAE from updating underlying network IpSecTunnelInterface#setUnderlyingNetwork will throw IAE when the underlying network is not functional and has null LinkProperties. This commit updates IKEv2 VPN to explicitly handle this exception. Bug: 240112879 Test: VpnTest, VpnManagerTest, VpnManagerServiceTest, Ikev2VpnTest Change-Id: I962ee07a5b0e38a07653c25349e41ae47623e7f6 --- services/core/java/com/android/server/connectivity/Vpn.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java index e85eee817d297..bc054dd163ae2 100644 --- a/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java @@ -3343,7 +3343,7 @@ public class Vpn { // Transforms do not need to be persisted; the IkeSession will keep // them alive for us mIpSecManager.applyTunnelModeTransform(mTunnelIface, direction, transform); - } catch (IOException e) { + } catch (IOException | IllegalArgumentException e) { Log.d(TAG, "Transform application failed for token " + token, e); onSessionLost(token, e); } @@ -3437,7 +3437,7 @@ public class Vpn { mTunnelIface, IpSecManager.DIRECTION_IN, inTransform); mIpSecManager.applyTunnelModeTransform( mTunnelIface, IpSecManager.DIRECTION_OUT, outTransform); - } catch (IOException e) { + } catch (IOException | IllegalArgumentException e) { Log.d(TAG, "Transform application failed for token " + token, e); onSessionLost(token, e); }