diff options
author | Nate Jiang <qiangjiang@google.com> | 2020-08-20 09:25:25 -0700 |
---|---|---|
committer | Nate Jiang <qiangjiang@google.com> | 2020-08-24 16:44:45 +0000 |
commit | 756e8046a6ace88b0b3c566a940c7d25f8e8c69a (patch) | |
tree | b79c443ed507f699d71f400c809929660d0ef057 /service | |
parent | a15056fede28509e49c4854d933f789cedfcc37f (diff) |
[Aware] End ndp and clean up after timeout.
Keep trying to get link-local address and verify usablity until time
out.
Bug: 165775713
Test: atest com.android.server.wifi
Merged-In: I3c6f0e832b8afb8f8dd79c8e31e58fc491732238
Change-Id: I3c6f0e832b8afb8f8dd79c8e31e58fc491732238
(cherry picked from commit 6e91d1d9cfa58699c93e9cab80c467a23727bcce)
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java b/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java index e190a2454..226304019 100644 --- a/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java +++ b/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java @@ -654,16 +654,9 @@ public class WifiAwareDataPathStateManager { sNetworkCapabilitiesFilter); LinkProperties linkProperties = new LinkProperties(); getInet6Address(nnri, mac); - if (nnri.peerIpv6 != null) { - final WifiAwareNetworkInfo ni = new WifiAwareNetworkInfo( - nnri.peerIpv6, nnri.peerPort, nnri.peerTransportProtocol); - ncBuilder.setTransportInfo(ni); - if (VDBG) { - Log.v(TAG, "onDataPathConfirm: AwareNetworkInfo=" + ni); - } - } - if (!(mNiWrapper.configureAgentProperties(nnri, nnri.equivalentRequests, ndpId, - ncBuilder, linkProperties) && mNiWrapper.isAddressUsable(linkProperties))) { + if (!(nnri.peerIpv6 != null && mNiWrapper.configureAgentProperties(nnri, + nnri.equivalentRequests, ndpId, ncBuilder, linkProperties) + && mNiWrapper.isAddressUsable(linkProperties))) { if (VDBG) { Log.d(TAG, "Failed address validation"); } @@ -674,6 +667,12 @@ public class WifiAwareDataPathStateManager { } return; } + final WifiAwareNetworkInfo ni = new WifiAwareNetworkInfo( + nnri.peerIpv6, nnri.peerPort, nnri.peerTransportProtocol); + ncBuilder.setTransportInfo(ni); + if (VDBG) { + Log.v(TAG, "onDataPathConfirm: AwareNetworkInfo=" + ni); + } final NetworkAgentConfig naConfig = new NetworkAgentConfig.Builder() .setLegacyType(ConnectivityManager.TYPE_NONE) .setLegacyTypeName(NETWORK_TAG) @@ -691,6 +690,8 @@ public class WifiAwareDataPathStateManager { if (mClock.getElapsedSinceBootMillis() - nnri.startValidationTimestamp > ADDRESS_VALIDATION_TIMEOUT_MS) { Log.e(TAG, "Timed-out while waiting for IPv6 address to be usable"); + mMgr.endDataPath(ndpId); + nnri.state = AwareNetworkRequestInformation.STATE_TERMINATING; declareUnfullfillableAndEndDp(nnri, ndpId); return true; } @@ -1486,17 +1487,13 @@ public class WifiAwareDataPathStateManager { try { ni = NetworkInterface.getByName(nnri.interfaceName); } catch (SocketException e) { - Log.e(TAG, "onDataPathConfirm: ACCEPT nnri=" + nnri + Log.v(TAG, "onDataPathConfirm: ACCEPT nnri=" + nnri + ": can't get network interface - " + e); - mMgr.endDataPath(ndpId); - nnri.state = AwareNetworkRequestInformation.STATE_TERMINATING; return false; } if (ni == null) { - Log.e(TAG, "onDataPathConfirm: ACCEPT nnri=" + nnri + Log.v(TAG, "onDataPathConfirm: ACCEPT nnri=" + nnri + ": can't get network interface (null)"); - mMgr.endDataPath(ndpId); - nnri.state = AwareNetworkRequestInformation.STATE_TERMINATING; return false; } Enumeration<InetAddress> addresses = ni.getInetAddresses(); @@ -1509,9 +1506,7 @@ public class WifiAwareDataPathStateManager { } if (linkLocal == null) { - Log.e(TAG, "onDataPathConfirm: ACCEPT nnri=" + nnri + ": no link local addresses"); - mMgr.endDataPath(ndpId); - nnri.state = AwareNetworkRequestInformation.STATE_TERMINATING; + Log.v(TAG, "onDataPathConfirm: ACCEPT nnri=" + nnri + ": no link local addresses"); return false; } |