summaryrefslogtreecommitdiff
path: root/src/android/net/util
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-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-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-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-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-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-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-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-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-10Refine DNS private IP probesRemi NGUYEN VAN
This addresses comments on the parent change that introduced the optional feature. This change also considers IPv6 ULAs as private addresses, corrects some style and comments. Bug: 136734947 Test: atest NetworkStackTests:NetworkMonitorTest \ NetworkStackTests:NetworkStackUtilsTest Change-Id: I1169320f3a5c09631e754518c60acab337faf49b Merged-In: If4231804b77143b78f26a32c16db53fc4ac44cd8 (cherry picked from commit 0f62e8c6d21afd28280dbae7c3ea216097def466, aosp/1282802)
2020-04-10Do not detect portals when DNS returns private IPsRemi NGUYEN VAN
When access points return private IPs (as defined in the NetworkMonitor constant) in response to DNS probes, do not consider the access point as behind a portal, but instead indicate that it has no connectivity. This solves issues with some access points that return private IP responses to DNS queries when they do not have internet access. This feature is turned off by default while investigating its impact. OEMs can force-enable it through a resource overlay: config_force_dns_probe_private_ip_not_portal. Metrics to evaluate the feature will be added in a later change. Bug: 136734947 Test: atest NetworkStackTests Merged-In: I51975e18f424e3b7265011000f073777f376e597 Change-Id: I51975e18f424e3b7265011000f073777f376e597
2020-04-01[MP01] Add configuration to support multiple probesChiachang Wang
Add configuration to allow configuring multiple probe. Bug: 139034276 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: Ib2c1d16d2088ef043cdc6f9cb323a9df552beefb Change-Id: Ib2c1d16d2088ef043cdc6f9cb323a9df552beefb
2020-03-18Detect upstream hotspot device type by checking the vendor specific IE.Xiao Ma
Checking a particular IE (vendor specific) in the wifi scan results to identify upstream hotspot device type, meanwhile also checking if the ssid matches with the network which the downstream device is attaching to. Bug: 137835398 Test: atest FrameworksNetTests NetworkStackTests NetworkStackIntegrationTests Test: 1.attach to upstream hotspot device by selecting the sanned ssid from wifi settings, then check the OUI, vendor specific type fileds of IEs from the logcat. 2. build network stack module and install on Q device, verify wifi works normally. Merged-In: I8a3212fa066bdc8bf889768f92569891a3cb2408 Merged-In: I57c709c5da984accbbb389ab8d1295eae01328c6 Change-Id: I8b0ea9542775aecc13ed8ceede80abd693002825
2020-03-10Use redirect URL to start webviewAutomerger Merge Worker
NetworkMonitor will detect captive portal and may get a redirect URL from WiFi AP. Redirect URL should able to send to captive portal app to open the webview instead of detecting again by captive portal app. Bug: 134892996 Test: Manually test with captive portal AP Test: atest NetworkStackTests NetworkStackNextTests Change-Id: Idf363c79b7243a899121be8a68b32d0541dff14f Merged-In: Idf363c79b7243a899121be8a68b32d0541dff14f
2020-02-19Add captive portal info to DhcpClient outputRemi NGUYEN VAN
Requesting the captive portal option is flagged off by default. The URL it provides will be used to support the captive portal API; see RFC7710bis. Bug: 139269711 Test: atest NetworkStackTests NetworkStackNextTests Test: atest NetworkStackIntegrationTests NetworkStackNextIntegrationTests Change-Id: I783466e0e60f364e79cd76af3fe43a7862d35cf2
2020-02-18Allow tethering to use IpNeighborMonitor.Lorenzo Colitti
Test: m Change-Id: I4ca0c47d62ea90c30f88278b3ebf766be2c5a2e9
2019-12-27Merge "Provide RRO configuration to send DHCP client hostname option."Xiao Ma
2019-12-27Provide RRO configuration to send DHCP client hostname option.Xiao Ma
Add a configurable option in the RRO which controls whether or not to send the hostname set in the Settings->About phone->Device name. The option in RRO is false by default, that means DHCP Request still not include any hostname by default. Once the option is overlaid and enabled, the device name after transliteration will be wrote into hostname option. Bug: 131783527 Test: atest NetworkStackTests NetworkStackIntegrationTests Test: manual test, create empty APK to overlay the RRO configuration. Change-Id: I9af0b0d9e7bb526d3a3c1003bb99d0a3d69b1e9e
2019-12-27Read ARP timing properties from DeviceConfig appropriately.Xiao Ma
Overload NetworkStackUtils.getDeviceConfigPropertyInt API to check if the value of property read from DeviceConfig is valid, value in the range of mininum and maximum would be acceptable, otherwise, return the default value. Bug: 128639898 Test: atest NetworkStackTests NetworkStackIntegrationTests Change-Id: I07e3e9d1e1b7252d852d4665d2ea254f29a1c3eb
2019-12-11Add Rapid Commit option support in DHCP Server side.Xiao Ma
Bug:136216415 Test: atest FrameworksNetTests NetworkStackTests Test: atest NetworkStackIntegrationTests Test: manual tethering Change-Id: I0f9483c72374bab271eb18549a1a41812f32f2dd
2019-12-09Implement IPv4 address conflict detection and DHCPDECLINE.Xiao Ma
Disable this behavior by default, we can enable it with flag rollout later. Bug: 128639898 Test: atest NetworkStackTests NetworkStackIntegrationTests Test: manual test Change-Id: Ie2133bc5faaba085147519cdb5c8277c563cfbd7
2019-11-26Follow up commit of aosp/1157146Chiachang Wang
Address follow up actions and comments Bug: 130325409 Test: NetworkStackTests NetworkStackNextTests Change-Id: Ic768f08e5e54667e375c0d486df278773d9c707a
2019-11-20Evaluate data stall via tcp signalChiachang Wang
Allow NetworkStack to send SockDiag netlink request and parse returned tcp info. Evaluate the internet health from the tcp information. Bug: 136162280 Test: atest NetworkStackTests NetworkStackNextTests Test: Use "adb shell ss" command to check the parsing info Change-Id: I8df0d11c748c95d3a57115ebb6a4e29d8b50f177
2019-10-30Remove hidden annotation usage from NetworkStackRemi NGUYEN VAN
NetworkStack uses hidden android.annotation.* annotations by pulling the source files from frameworks/base. This should not be necessary, since androidx annotations can be used instead. Remove usage of such annotations and replace with androidx annotations. Test: m NetworkStack NetworkStackApiStable Test: builds, boots, WiFi working Bug: 139105333 Change-Id: I24e147ac4f01feaf53424430b4825b316ec154fe
2019-10-28Compile NetworkStackApiStable as system_29Remi NGUYEN VAN
Also slightly change the structure of shims so that the compat version uses a different package (com.android.networkstack.apishim.api29), which is jarjared to the main package name on API stable builds. On API current builds, the shim falls back to the compat version if Build.VERSION is older, or uses the main package otherwise. Jarjar requires using a java_library instead of a filegroup, so the shims build targets are converted to java_libraries. This allows the API current build to be usable on older devices, since it will automatically fall back to the compat APIs. When the new SDK is finalized, the API current build can then be shipped without code modification. The code also looks better in IDEs as there are no package conflicts. If there are several versions of the same shim depending on the API level (so different implementations for different methods in SocketUtilsShimImpl depending on the API level), having the shim extend the previous version shim allows to add methods with compatibility behavior without re-implementing the whole class. Test: m NetworkStack NetworkStackApiStable Test: flashed, WiFi working Test: atest NetworkStackTests Change-Id: I86f28912b80b8396d6b9b2acd2e247651ba80289
2019-10-17Optimize FdEventsReader to make it safer to use.Xiao Ma
Update the start() and createAndRegisterFd() to boolean type, to make sure we won't return null socket when failing to create socket. Throwing IllegalStateException if any caller is calling the FdEventsReader# start/stop from the different thread, to make it immediately obvious. Bug: None Test: atest NetworkStackTests Change-Id: I398b24da34b8fc9da7e8a9d07508c4d731c4a437
2019-09-26Add a general method to check version validity of DeviceConfig property.Xiao Ma
Considering boolean experimental flag is likely to cause misconfiguration, particularly when NetworkStack module rolls back to previous version. It's much safer to determine whether or not to enable one specific experimental feature by comparing flag version with module version. Test: atest NetworkStackTests Change-Id: Ie0c9527eb87b75c998584f2b4439cc0e309e8b28
2019-09-06Update connectivity namespace definitionChiachang Wang
Since DeviceConfig is available in aosp, update the definition reference from DeviceConfig instead of local definition. Bug: 120013793 Test: atest NetworkStackTests Change-Id: I3da82bd822ec340b98ad0b683478bd14ae94693c
2019-07-05Merge "Add DHCP Rapid Commit option(RFC4039) support in client side."Xiao Ma
am: d53f549885 Change-Id: I4a868d673f6263a5ad2d5acb475e99aac80b750c
2019-07-02Add DHCP Rapid Commit option(RFC4039) support in client side.Xiao Ma
Bug: 122710829 Bug: 136216415 Test: atest FrameworksNetTests NetworkStackTests Test: manual test Change-Id: I384282b7efd0df0c4a6de7bdc1957048303ad88b
2019-05-13Merge "Dropping NAT-T keepalive packet from APF" am: c4104f029fAaron Huang
am: 917c9f146b Change-Id: Ib3416ec37f0de12daf882068e00673ad60438c1a
2019-05-10Dropping NAT-T keepalive packet from APFAaron Huang
Add NAT Traversal keepalive filter to APF program to drop NAT-T keepalive packets when NAT-T keepalive offload is starting. Bug: 33530442 Test: - atest NetworkStackTests - atest FrameworksNetTests Change-Id: I1c537485e11b31e5a6e0d8b7b6a1f396f9441746
2019-04-25Remove Settings constants for NetworkStackChiachang Wang
The definitions reference of these constants are moved from Settings to DeviceConfig. These definitions are @hide and the usage in the Settings are removed. Thus, remove the definitions from API level. Bug: 123167629 Test: make system-api-stubs-docs-update-current-api \ test-api-stubs-docs-update-current-api Test: atest NetworkStackTests Change-Id: I28c4bf2c0b72e154cea91d11007a9497c7f21570 Merged-In: I7291cfa86cd6e907df35e8fbc97e2e9a77e56cab Merged-In: Ic48bea07e79490dd3787068bc88c748525752a61
2019-04-23Remove Settings constants for NetworkStackChiachang Wang
The definitions reference of these constants are moved from Settings to DeviceConfig. These definitions are @hide and the usage in the Settings are removed. Thus, remove the definitions from API level. Bug: 123167629 Test: make system-api-stubs-docs-update-current-api \ test-api-stubs-docs-update-current-api Test: atest NetworkStackTests Change-Id: I28c4bf2c0b72e154cea91d11007a9497c7f21570
2019-04-19Move Setting constants for NetworkStackChiachang Wang
From mainline perspective, we should use android flag api instead of using Settings. Thus, move the definitions into NetworkStack and apply new flag design. Bug: 123167629 Test: atest NetworkStackTests Change-Id: I9602263f0bff5d8e942bd652de69ccfcb3034a2f Merged-In: I6820300c412f94989a5fce7bd6c6f2a3b983b96e Merged-In: I4f6d130ffbee14f5087d75a8bc211680a34be682 (cherry picked from commit 01440ea909732e5d6f81604b61841f07b3d83217)
2019-04-17Move Setting constants for NetworkStackChiachang Wang
From mainline perspective, we should use android flag api instead of using Settings. Thus, move the definitions into NetworkStack and apply new flag design. Bug: 123167629 Test: atest NetworkStackTests Change-Id: I9602263f0bff5d8e942bd652de69ccfcb3034a2f
2019-04-12Address nit in NetworkStackUtilsChiachang Wang
Follow up commit to fix nit in aosp/937891 Bug: 120013793 Test: Build Change-Id: I61a6306d3c439a2d72323ab56e2b47771cc60d48 Merged-In: Ide4741305724a9e0d26305f8406c5445f9de12b3 (cherry picked from commit cfb4e06b14925a7ed4324df0e40ec521256ed249)
2019-04-11Address nit in NetworkStackUtilsChiachang Wang
Follow up commit to fix nit in aosp/937891 Bug: 120013793 Test: Build Change-Id: I61a6306d3c439a2d72323ab56e2b47771cc60d48
2019-04-10Move data stall definitions out from SettingChiachang Wang
From mainline perspective, we should use android flag api instead of using Settings. Thus, move the definitions into NetworkStack. Bug:120013793 Test: atest NetworkStackTests SettingsBackupTest Change-Id: I8e1fb5b47fff3bf624131ba1f5732daabd991e6d Merged-In: I8e1fb5b47fff3bf624131ba1f5732daabd991e6d Merged-In: I0a2a1e5d3de14ea86556ca471e26064df3481412
2019-04-09Move data stall definitions out from SettingChiachang Wang
From mainline perspective, we should use android flag api instead of using Settings. Thus, move the definitions into NetworkStack. Bug:120013793 Test: atest NetworkStackTests SettingsBackupTest Change-Id: I8e1fb5b47fff3bf624131ba1f5732daabd991e6d
2019-04-08Move attach*Filter() and addArpEntry() methods to NetworkStackRemi NGUYEN VAN
The SocketUtils.attach*Filter and SocketUtils.addArpEntry methods were added there because they could not be added as JNI inside the NetworkStack. This was not possible because on Go devices, the NetworkStack was a jar library. But now, Go also uses an APK. Hence, move these methods to the NetworkStack. Fixes: 129433183 Merged-In: I66d7b3e4fbfa32bb0bc853e8cf9399031daff8a9 (cherry picked from commit fe71be2b04a3213828dc0347a1dd4a3675d20562) Change-Id: Ice433a41469e784385f19498c154345d7b9c69b5
2019-04-03Move attach*Filter() and addArpEntry() methods to NetworkStackpaulhu
The SocketUtils.attach*Filter and SocketUtils.addArpEntry methods were added there because they could not be added as JNI inside the NetworkStack. This was not possible because on Go devices, the NetworkStack was a jar library. But now, Go also uses an APK. Hence, move these methods to the NetworkStack. Change-Id: I1d88a0f0be23f2b15d5103fa092b9bf982329d7c Fix: 129433183 Test: atest NetworkStackTests FrameworksNetTests
2019-04-01Link to android experimental flags APIChiachang Wang
Bug: 120013793 Test: Build and atest NetworkStackTests Change-Id: I5c12b48e886e124025ecaa8548b70f26ebd20263
2019-04-01Provide link to android experimental flags APIChiachang Wang
Add function to link to android experiemental flags API Bug: 120013793 Test: Build and atest NetworkStackTests Change-Id: I14b9a6f06f841a9d63e8c1954907447a9e7eb8a5
2019-03-25apf: Documentation improvements and code optimizations for keepalive filtersAaron Huang
Optimizing instruction to reduce code size of keepalive filters. Bug: 123992088 Test: atest NetworkStackTests Change-Id: I9ae55977c6d6740277ba55603ee957f33a97ecaa
2019-02-22Injecting data stall event to statsdChiachang Wang
Bug: 121185319 Bug: 120452078 Test: - Build and test against data stall code - atest NetworkStackTests Change-Id: I2ee16085e7861d38bcd203c98ffd682f86fdc867
2019-02-15Fix framework and NetworkStack classes conflictsRemi NGUYEN VAN
Classes that are used in framework.jar cannot be linked in NetworkStack, as the framework takes precedence in the classpath. This prevents the networkstack from using these classes due to the hidden API usage detection. Do the following: - jarjar any shared source file between framework and NetworkStack, so the version in the NetworkStack uses a different package. - Move any shared class not used in the NetworkStack to services.net The CL uses jarjar on the app copy and not the framework classes, as the framework cannot be updated without an OTA, and non-network stack specific classes should not be renamed because of the network stack. Test: atest FrameworksNetTests NetworkStackTests Test: flashed svelte build, WiFi works Bug: 124033493 Change-Id: I85d888b756adc28c36638913632bfdfdbf0e0486
2019-01-30Remove last NetworkStack usage of hidden APIsRemi NGUYEN VAN
Includes various small changes to stop using hidden APIs Test: make NetworkStack Test: flashed, booted, WiFi and tethering working Bug: 112869080 Change-Id: Id2830795a444f484b377ed6437435a1cd833697a