summaryrefslogtreecommitdiff
path: root/src/android/net
AgeCommit message (Collapse)Author
2020-07-03Refine validation metricsRemi NGUYEN VAN
Rename members for a clearer API, and add try/catch blocks to each NetworkMonitor call to guarantee there will not be any crash. Add a flag allowing to disable all the metrics collection code. Bug: 151796056 Test: atest NetworkStackTests (see also test-only change) Change-Id: I06d6dccc57146b955b15cf36a2109c68a5355494
2020-07-03Update CapportData in CapportApiProbeResult to be nullableChiachang Wang
If capport API does not send any valid rely, the capportData could be null in CapportApiProbeResult. Thus, take null capportData for invalid case. Bug: 154196512 Bug: 139034276 Bug: 151796056 Test: atest NetworkStackTests Merged-In: I99cbff2eb1a9ab87a42011038d911fe15e7344a4 Change-Id: I99cbff2eb1a9ab87a42011038d911fe15e7344a4
2020-06-24Get link state with same lock as LinkPropertiesRemi NGUYEN VAN
The previous IpClientLinkObserver code could in theory call mCallback.update with a linkState that came from another update; for example: 1. onInterfaceAddressUpdated - mLinkProperties.addLinkAddress 2. onInterfaceLinkStateChanged - setInterfaceLinkState(false) 1. mCallback.update(false) <- should be true ? 2. mCallback.update(false) In practice this would not happen because the onFoo methods are all called in order (same binder token from netd), but IpClientLinkObserver should not need to make such assumptions. Bug: 151796056 Test: atest NetworkStackIntegrationTests (see also test-only change) Change-Id: I60f5a319519069070eb5a07643686bf5ec937665
2020-06-24Send normal termination metrics on wifi offRemi NGUYEN VAN
When turning wifi off, the interface gets torn down and empty LinkProperties are received before wifi calls stop(). This causes a loss of provisioning to be logged, instead of normal termination. Watch interface link status up/down events, and when provisioning is lost when the interface is down, consider it a normal termination. Bug: 151796056 Test: manual: turn wifi off, observe events Test: atest NetworkStackIntegrationTests (see also test-only change) Original-Change: https://android-review.googlesource.com/1343236 Merged-In: I9d086a199de0017aa425219d20882211423925e0 Change-Id: I9d086a199de0017aa425219d20882211423925e0
2020-06-23Fix the mStopTimeNs not be reset in Stopwatch#RestartFrank Li
Bug: 151796056 Test: atest NetworkStackIntegrationTests NetworkStackTests Test: atest FrameworksNetTests Test: Manual test with statsd_testdrive Original-Change: https://android-review.googlesource.com/1343438 Merged-In: Ib83ceb70af3491dacbb4a45f65ef38661ae75e32 Change-Id: Ib83ceb70af3491dacbb4a45f65ef38661ae75e32
2020-06-23Merge "Injecting network ip provision stats into statsd" into rvc-devRemi NGUYEN VAN
2020-06-23Injecting network ip provision stats into statsdlifr
1. Fill in each field of the NetworkIpProvisioningReported 2. Write the NetworkIpProvisioningReported into statsd Bug: 151796056 Test: atest NetworkStackIntegrationTests NetworkStackTests Test: atest FrameworksNetTests Test: Manual test with statsd_testdrive Original-Change: https://android-review.googlesource.com/1313574 Merged-In: If4bc6af1b794a8620a08858d6cfd85e661865bd7 Change-Id: If4bc6af1b794a8620a08858d6cfd85e661865bd7
2020-06-19Merge "Move Inet[4]AddressUtils to libs/net" into rvc-devRemi NGUYEN VAN
2020-06-18Transition to appropriate state after all left addresses have been cleared.Treehugger Robot
State machine will transit to RunningState directly after clearing all left addresses even if the preconnection flag is enabled, that seems incorrect to skip PreconnectingState. Rely on the preconnection flag to determine which correct state should transit to. Bug: 159109671 Test: atest NetworkStackIntegrationTests NetworkStackTests Merged-In: I3d520a50f26ba7fac804c85c968013b2cb7cab91 Change-Id: I3d520a50f26ba7fac804c85c968013b2cb7cab91
2020-06-12Move Inet[4]AddressUtils to libs/netRemi NGUYEN VAN
The classes should not be picked up from frameworks/base, as they are part of several mainline modules. Bug: 151052811 Test: m; manual: flashed, wifi and telephony working Test: atest NetworkStackCoverageTests Change-Id: I62da3419408b7eb71ea5319e8717fbb22c76a94e
2020-06-11Remove DhcpResults from NetworkStack shared libRemi NGUYEN VAN
Remove the dependency on DhcpResults in moduleutils by moving toStableParcelable to NetworkStack main code, and fromStableParcelable to the test only. Only NetworkStack should be generating DhcpResultsParcelables, and only the NetworkStack should be using DhcpResults at this point (eventually the class would move from frameworks/base/core to NetworkStack). Test: built, flashed, WiFi working Bug: 149403767 Original-Change: https://android-review.googlesource.com/1277444 Merged-In: I093fa48967a48f594b242b1e05e7d481fa9ee529 Change-Id: I093fa48967a48f594b242b1e05e7d481fa9ee529
2020-06-11Merge "Increase tcp polling interval on data stall detection" into rvc-devTreeHugger Robot
2020-06-09Disable IPv6 stack when IPv6 provisioning is lost but IPv4 is still alive.Treehugger Robot
When IPv6 provisioning loss happens due to the default route has gone, however, if IPv4 network is still provisioned, we can consider to disable IPv6 stack and still keep the current connection without disconnecting from wifi, applications will be able to reconnect over IPv4 network. Bug: 131781810 Test: atest NetworkStackTests NetworkStackNextTests Test: atest NetworkStackIntegrationTests Merged-In: I8f56a05b38c8387c91306c0dc2bdf4430ec3bd00 Change-Id: I8f56a05b38c8387c91306c0dc2bdf4430ec3bd00
2020-06-09Increase tcp polling interval on data stall detectionChiachang Wang
NetworkMonitor suspects stall if we get high tcp fail rate in 10s. In a cell transition frequently environment, a certain percentage packets lost or retransmission may stay for a longer time interval. The shorter tcp polling interval may not able to get confident enough result. The looser timer may also increase validated result in the metrics which may not a good signal. Thus, increase the polling interval to address it. Bug: 157957111 Test: atest NetworkStackTests Merged-In: I496a32da8f57f88908402722ebe1cd3d0a8483b6 Change-Id: I496a32da8f57f88908402722ebe1cd3d0a8483b6
2020-06-04Merge "Shorten the timeout of DHCP INIT-REBOOT state." into rvc-devTreeHugger Robot
2020-06-04Merge "Adjust the timeout parameters in DHCP client." into rvc-devTreeHugger Robot
2020-06-03Shorten the timeout of DHCP INIT-REBOOT state.Xiao Ma
Currently the timeout in the INIT-REBOOT state is 18s which allows 4 retransmits. In the scenario where DHCP server fails to response due to certain reason, DhcpClient should go back to INIT state ASAP and do the regular DHCPDISCOVER. Shorten the timeout to 5s to speed up the fallback process. Bug: 157960451 Bug: 157603386 Test: atest NetworkStackIntegrationTests Test: manual test to verify that client goes back to INIT state and broadcasts DHCPDISCOVER after 2 retransmissions. Merged-In: I9d214e193a4f80a9512a3a6f385ca3554f050386 Change-Id: I9d214e193a4f80a9512a3a6f385ca3554f050386
2020-06-01Allow localhost HTTP URLs for the capport APIRemi NGUYEN VAN
Allowing the capport API to be hosted on localhost makes it easy to write fast, stable tests for the feature. This was not possible because: - Pre-validation of the URL used Patterns.WEB_URL, which is over-restrictive and excludes domain names without TLD - NetworkMonitor needs the API to be hosted via HTTPS which is working as intended, however relaxing this requirement only for localhost (for testing) seems reasonable. Bug: 156062304 Test: atest CaptivePortalApiTest in associated change Original-Change: https://android-review.googlesource.com/1309235 Merged-In: I5f2cdd02376785b152e5b9a6e798d797894ea45b Change-Id: I5f2cdd02376785b152e5b9a6e798d797894ea45b
2020-05-29Rename groupHint to cluster.Chalard Jean
Bug: 146460486 Test: atest android.net.IpMemoryStoreTest Test: atest com.android.server.connectivity.ipmemorystore.IpMemoryStoreServiceTest Change-Id: I493472cb65262b04769192b702178351416c9869 Merged-In: I805733e201aa1286477cfac589cdf4ac18bb7e2b (cherry-picked from aosp/1311636)
2020-05-28Merge "Change stopwatch accuracy from milliseconds to microseconds" into rvc-devFrank Li
2020-05-28Merge "Enable DHCP INIT-REBOOT state on R." into rvc-devXiao Ma
2020-05-28Change stopwatch accuracy from milliseconds to microsecondsFrank Li
The microsecond time information needs to be recorded in the NetworkStack Metrics (NetworkIpProvisioningReported). So the unit of stopwatch is converted from millisecond to microsecond. Bug: 151926185 Test: atest com.android.server.connectivity.NetworkMonitorTest Original-Change: https://android-review.googlesource.com/1299376 Merged-In: I5a27a3b1316c67bf076b2e490860385267358ef8 Change-Id: I5a27a3b1316c67bf076b2e490860385267358ef8
2020-05-27Merge "add TCP data stall metrics" into rvc-devChiachang Wang
2020-05-25Enable DHCP INIT-REBOOT state on R.Xiao Ma
Bug: 156575243 Test: atest NetworkStackTests NetworkStackIntegrationTests Test: atest NetworkStackNextIntegrationTests Test: manual test: 1. connect to AP successfully at the first time 2. disconnect wifi 3. reconnect to the same AP 4. checked client broadcasts REQUEST instead of DISCOVER 5. checked client broadcasts DISCOVER if lease has expired Merged-In: I62d1ab6b94be1ee95fbaa2ecce62eaba01e7892d Change-Id: I62d1ab6b94be1ee95fbaa2ecce62eaba01e7892d
2020-05-25Merge "Mock IpConnectivityLog in IpClientTest" into rvc-devMark Chien
2020-05-25Mock IpConnectivityLog in IpClientTestmarkchien
IpConnectivityLog which is used to send metrics need NETWORK_STACK permission. Mock IpConnectivityLog to avoid sending metrics from tests. Also remove platform cert from the network stack unit test because it is not necessary for any signature permission anymore. Bug: 156866746 Test: NetworkStackNextTests, NetworkStackCoverageTests, TetheringTests, TetheringCoverageTests Change-Id: Ibff052b30e000de3c5a08d7265c7642d67d9b0d0
2020-05-21add TCP data stall metricsChiachang Wang
Current metrics contains only DNS signal. Given TCP info is also considered to detection data stall, the related TCP information should be included into metrics. Bug: 150182763 Test: atest NetworkStackTests NetworkStackNextTests Test: Test with ./out/host/linux-x86/bin/statsd_testdrive 121 to ensure log properly Merged-In: I5e306299f3cf4f49c46f161cd0aa4cb40d1ab76e Change-Id: I5e306299f3cf4f49c46f161cd0aa4cb40d1ab76e
2020-05-19Adjust the timeout parameters in DHCP client.Xiao Ma
MAX_TIMEOUT_MS: 128s -> 512s, battery drain for DHCP packet retransmit. FIRST_TIMEOUT_MS: 2s -> 1s, shorten DHCP packet retransmit interval. DEFAULT_TIMEOUT_MS: 36s -> 18s, quickly detect provisioning timeout. Bug: 131781810 Test: atest NetworkStackIntegrationTests NetworkStackTests Merged-In: Ie162b0d59da0082cd0c5ec02bb391c3d27f40607 Change-Id: Ie162b0d59da0082cd0c5ec02bb391c3d27f40607
2020-05-19Support MirrorLink DHCPDECLINE.Xiao Ma
Bug: 130741856 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: I9f558ce0838c87d9bb0ef519ee7c91e16f3bb066 Change-Id: I9f558ce0838c87d9bb0ef519ee7c91e16f3bb066
2020-05-18Refactor DHCP server with StateMachine.Xiao Ma
To support DHCPDECLINE message and request a new prefix from IpServer, a WaitState is required to wait until IpServer allocates a different prefix and completes configuring this prefix/route. Then server could resume from pausing DHCP packets listening. From this point, StateMachine is easier to add a WaitState for implementation. Refactor DHCP server by replacing ThreadHandler with StateMachine first. Bug: 130741856 Test: atest NetworkStackTests NetworkStackNextTests Test: manual test: connect wifi, turn on hotspot, downstream device attaches to hotspot successfully, then turn off hotspot, repeat multiple times. Merged-In: I6c09d9c371e9c4e71d8ba26adaed640e3b97437b Change-Id: I6c09d9c371e9c4e71d8ba26adaed640e3b97437b
2020-05-15Move common apishim classes to apishim.common pkgRemi NGUYEN VAN
This provides a better separation of the classes based on their role (an actual shim, or an interface or utility common to all shims), and forces the apishim package to import the common classes, which makes it easier at SDK bump time since the imports do not need to be added at that point. Bug: 143586229 Test: atest NetworkStackTests Original-Change: https://android-review.googlesource.com/1310517 Merged-In: Ie77c17a96a67016f35890afa065bea0a07b09504 Change-Id: Ie77c17a96a67016f35890afa065bea0a07b09504
2020-05-08Merge "Set clientId when parsing an explicit DHCP_CLIENT_IDENTIFIER option." ↵TreeHugger Robot
into rvc-dev
2020-05-07Set clientId when parsing an explicit DHCP_CLIENT_IDENTIFIER option.Xiao Ma
Bug: 130741856 Test: atest NetworkStackTests TetheringTests Test: manually turn on the hotspot and verify the downstream device can attach to the upstream hotspot, then turn it off, repeat multiple times. Merged-In: I9da5fec47a74de36869e795fa9b1d7170d2f91c9 Change-Id: I9da5fec47a74de36869e795fa9b1d7170d2f91c9
2020-05-07Update default value of probe url to be a constantChiachang Wang
Default value for probing url should be a constant in NetworkStack but not an overlayable config due to some technical limitations. OEMs can mistakenly override configs that were not designed to be overridden. Bug: 152730542 Test: atest NetworkStackTests NetworkStackNextTests Change-Id: I1846958e7c4e8b64ae287718c63e705bb232632a Merged-In: I1846958e7c4e8b64ae287718c63e705bb232632a
2020-05-04Don't crash if the PREF64 expires when IpClient is stopped.Lorenzo Colitti
Currently the code does not cancel the PREF64 alarm when IpClient is stopped. If the alarm fires when IpClient has disconnected, it will call updatePref64 with a null prefix, which will crash. Ensure that the alarm is cancelled when IpClient is stopped. Bug: 153694684 Bug: 155559286 Test: new unit tests Change-Id: I397eb36c1a8ecf1324de33e720577fe2e4e07056
2020-05-01Do not stop FdEventsReader on handlePacket errorTreehugger Robot
Previously if handlePacket threw an exception, FdEventsReader would stop reading and close the file descriptor. This is not helpful as users of this class may encounter errors processing a particular packet (typically), but they generally should not stop completely for that reason. Also address comments from previous change (Exception instead of Throwable: Throwable should not be caught in general; event -> events). Bug: 152842850 Test: atest NetworkStackTests Original-Change: https://android-review.googlesource.com/1295503 Merged-In: I14abe8163ecdfd5251731915f10ea374bfa38b70 Change-Id: I14abe8163ecdfd5251731915f10ea374bfa38b70
2020-05-01Fix potential exceptions in FdEventReader usersRemi NGUYEN VAN
In particular, - Fix a possible NPE In IpNeighborMonitor, if a NUD_FAILED is received for some neighbor before all other neighbors have received RTM_NEWNEIGH. - Add try / catch in IpNeighborMonitor, DhcpPacketListener, ConnectivityPacketTracker in case some unexpected exception is thrown while processing packets. - Add Log.wtf logging in FdEventsReader in case any such exception is missed. Bug: 152842850 Test: atest NetworkStackTests Original-Change: https://android-review.googlesource.com/1274609 Merged-In: Ia03fec358e98b3f218220e70fc3265e14ca15f78 Change-Id: Ia03fec358e98b3f218220e70fc3265e14ca15f78
2020-05-01Merge "Add test configuration values for probe URLs" into rvc-devRemi NGUYEN VAN
2020-04-30Merge "Fix the potential double transition in DhcpState#enter" into rvc-devTreeHugger Robot
2020-04-30Merge changes I9d38c696,I8da6a8f4 into rvc-devRemi NGUYEN VAN
* changes: Fix IpReachabilityMonitorTest flakes/Q failures Add tests for IpReachabilityMonitor
2020-04-30Fix IpReachabilityMonitorTest flakes/Q failuresRemi NGUYEN VAN
IpReachabilityMonitor was failing on Q because of: - Usage of HexEncoding.encodeToString(byte[], boolean) that did not exist in Q - Flakes/failures caused by missing permissions when calling IpConnectivityLog - Flakes caused by mocking FileDescriptor#valid() while it could be accessed from another thread Bug: 152723363 Test: atest IpReachabilityMonitorTest --rerun-until-failure 500 Merged-In: I9d38c696bf1b3b63be3b9df3161168ee291e7beb Change-Id: I9d38c696bf1b3b63be3b9df3161168ee291e7beb (cherry picked from commit 162c7ee3601b49f55b7a72597067bc93836dbb96)
2020-04-30Add test configuration values for probe URLsRemi NGUYEN VAN
The test configuration values override RROs that may have been set by OEMs, which is necessary to be able to rely on them in CTS tests. Test: atest NetworkStackTests Bug: 152280218 Merged-In: I8171fd6360a6e504f3abaea3d7de4fa308bbb35b Change-Id: I8171fd6360a6e504f3abaea3d7de4fa308bbb35b
2020-04-30Fix the potential double transition in DhcpState#enterXiao Ma
The double transition problem might happen when interface is gone by accident after starting DhcpClient. The StateMachine doesn’t allow to call transitionTo() in enter(). Use deferMessage() instead to avoid this crash. Bug: 145182281 Test: manual Merged-In: I03c4161a01861b47cf878945f7f5cc77c821cd57 Change-Id: I03c4161a01861b47cf878945f7f5cc77c821cd57
2020-04-28Address comments on NetworkStack AIDL v6Remi NGUYEN VAN
Address issues found during AIDL review: - Rename clientAddr to singleClientAddr - Do not use a ParcelableBundle for notifyNetworkTested or notifyDataStallSuspected; instead use AIDL parcelables for stronger backwards compatibility guarantees. As part of moving notifyNetworkTested to using a parcelable the test result int is split into two: the actual evaluation result, and the probesSucceeded int. It used to contain both as a bit mask, which does not make sense if probesAttempted is in a separate int itself. Test: atest NetworkMonitorTest ConnectivityServiceTest ConnectivityServiceIntegrationTest, manual Bug: 153500847 Merged-In: I4aac6ff7432472f8a9345fb5785c6314ec8946e4 Change-Id: I4aac6ff7432472f8a9345fb5785c6314ec8946e4
2020-04-28Merge "Remove Preconditions usage from moduleutils and IpClient" into rvc-devMark Chien
2020-04-27Don't crash or wtf if the interface doesn't exist.Lorenzo Colitti
This prevents the code from issuing a Log.wtf due to calling transitionTo in ClearingIpAddressesState#enter if the interface does not exist when IpClient starts provisioning is called. This prevents IpClientIntegrationTest from crashing on eng builds due to the Log.wtf being unhandled. Bug: 155005801 Bug: 152723363 Test: atest NetworkStackNextIntegrationTests:IpClientIntegrationTest#testRestoreInitialInterfaceMtu_NotFoundInterfaceWhenStartingProvisioning Original-Change: http://aosp/1290575 Merged-In: I4f34343816202c996f9227b72d453ea4a464f4b8 Change-Id: I4f34343816202c996f9227b72d453ea4a464f4b8
2020-04-27Remove Preconditions usage from moduleutils and IpClientMark Chien
moduleutils is a shared utility to be used by multiple network modules. Stop depending on a framework private class usage. Then all of its users can stop depending on the statically linked and jarjared private framework class. Bug: 148636687 Test: atest TetheringTests NetworkStackNextTests Merged-In: I693d0318fa4f1afbc220aa7c43e614ab5714a984 Change-Id: I693d0318fa4f1afbc220aa7c43e614ab5714a984
2020-04-24Merge "Address comments on ag/11204387." into rvc-devTreeHugger Robot
2020-04-24Address comments on ag/11204387.Lorenzo Colitti
Add comments and slightly increase test coverage. Bug: 153694684 Test: new test coverage in IpClientIntegrationTest Change-Id: I160a0801449cbe9e66976eaacdd3a914adc3d341
2020-04-23Merge "Ensure that the NAT64 prefix is removed when its lifetime expires." ↵Lorenzo Colitti
into rvc-dev