summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
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-18Merge changes I86cb5af0,I706e40db into rvc-devRemi NGUYEN VAN
* changes: Fix dumpVersion for IpMemoryStore on Q Log interface hash in NetworkStack dumpsys version
2020-05-15Do not mock shim in TcpSocketTrackerTestRemi NGUYEN VAN
Instead of mocking the shim, the test needs to run only on platforms that support the feature, and can provide test versions of the underlying objects (here Network). Also move the SDK version check to TcpSocketTracker itself, as users of TcpSocketTracker should not be able to set isTcpInfoParsingSupported to true on Q. Bug: 143586229 Test: atest NetworkStackTests NetworkStackNextTests on Q and R Change-Id: I580ae9ded468d3f08da336b160596484938bf2a5 Merged-In: I580ae9ded468d3f08da336b160596484938bf2a5 (cherry picked from commit 3ad1d5f0fbfff40d3dc66c3c68f103a9b2d3f5ef)
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-15Fix dumpVersion for IpMemoryStore on QTreehugger Robot
IpMemoryStore was considered part of the system server AIDLs in Q, so its version must be part of the system server versions set. This fixes a regression on testDumpVersion_Q. Bug: 137328719 Test: atest NetworkStackTests:NetworkStackServiceTest on a Q device Change-Id: I86cb5af059fe81fe9f10555d57096164665205db Merged-In: I86cb5af059fe81fe9f10555d57096164665205db (cherry picked from commit 8b5cead3df4489a0fd8d9950761a387d2c8d02b4)
2020-05-15Log interface hash in NetworkStack dumpsys versionRemi NGUYEN VAN
The hash is logged similarly to how version code was logged, and will be used to verify that valid interfaces are used to communicate with NetworkStack. Bug: 137328719 Test: atest NetworkStackTests:NetworkStackServiceTest Original-Change: https://android-review.googlesource.com/1293755 Merged-In: I706e40dbe884ffa545f9127e29616a65d5f69c53 Change-Id: I706e40dbe884ffa545f9127e29616a65d5f69c53
2020-05-13Add test for NetworkStackService dumpsys versionRemi NGUYEN VAN
The test verifies that each method on INetworkStackConnector updates the version received from the remote, and that the output of dumpsys version matches the expected template. This logic will be changed in R to include interface hashes, so a test is important to verify that Q behavior remains the same to avoid breaking Q conformance tests. Test: atest NetworkStackTests:NetworkStackServiceTest Bug: 137328719 Original-Change: https://android-review.googlesource.com/1293754 Merged-In: Icaab91d2cb4c62930f969612545e369f09f1b0c7 Change-Id: Icaab91d2cb4c62930f969612545e369f09f1b0c7
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-06Add EvaluatingBandwidthState to evaluate network bandwidthLucas Lin
Add a new state between EvaluatingPrivateDnsState and ValidatedState to evaluate the network bandwidth. This state is optional, OEMs can overlay the resource file and set the related config to enable this feature. Bug: 133522566 Test: atest NetworkStackTests Change-Id: I4b43450ad7ed4284bf433b0daab8d0c00d4c284e Merged-In: Ia2d6e4b8e434c15e76bc9e58874c40b1647f97fb (cherry picked from commit 679809049207e48a63fde4f00f1084a3ea287dc1)
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
2020-04-23Ensure that the NAT64 prefix is removed when its lifetime expires.Lorenzo Colitti
Bug: 153694684 Test: new test coverage in IpClientIntegrationTest Change-Id: Ie207940d79abbc0d92dd15becee867e72f171786
2020-04-20Get the l2key and grouphint from the initial provisioning configuration.Xiao Ma
The purpose of processing CMD_UPDATE_L2INFO command in the Stopped State is just to update the initial l2key and grouphint which are used when starting DhcpClient (e.g. for INIT-REBOOT). We can get both of l2key and groupHint from the initial prov configuration parcelable instead, then be able to delete CMD_UPDATE_L2INFO from the StoppedState. Bug: 154441742 Test: atest FrameworksNetTests NetworkStackTests Test: atest NetworkStackIntegrationTests Change-Id: I760957017b18975be969a2f519ec09ee4495ebad
2020-04-20Listen for pref64 RA attributes in IpClientLinkObserver.Lorenzo Colitti
This allows IpClient to parse the pref64 RA option and put it in the LinkProperties to be sent to ConnectivityService. IpClientLinkObserver is a natural place for this because it is the part of IpClient that is already tasked with receiving netlink events and storing the results in IpClient's LinkProperties. Instead of using the path used by most attributes, which are parsed by NetlinkHandler, converted to a string array, then re-parsed and sent over binder call to the networkstack, simply open a netlink socket in the networkstack process and read the netlink messages from there. In the future, we can build on this to parse other netlink messages (e.g., IP addresses, routes, RDNSS, etc.) in the networkstack and entirely remove the dependency on netd's NetlinkHandler, which is crufty, hard to extend, and does not support interface indices. This means that the pref64 attribute will not be ordered with respect to other netlink events. This is acceptable because the pref64 attribute does not need to be ordered with any other information and its presence or absence does not cause provisioning to succeed or fail. Today the pref64 is learned through an entirely different codepath (DNS lookups) and that is not ordered in any way either. This CL does not change the threading model: the netlink updates are processed on the handler thread like all the other updates seen by IpClientLinkObserver, and all access to mLinkProperties is synchronized (this). This synchronization is no longer necessary because everything is on the handler thread anyway, but that will be cleaned up in a future CL. Because netlink events contain interface indices, but IpClient and netd deal with interface names, IpClientLinkObserver must be told what the interface index is. This is done when startProvisioning is called, because that is when IpClient fetches the interface parameters including the MAC address and interface index. It cannot be done when IpClientLinkObserver is started, because at that time the interface might not exist, or might exist with a previous interface index. The interface index is cleared when IpClient enters the stopped state and the LinkProperties are cleared. Bug: 153694684 Test: atest NetworkStackNextIntegrationTests:IpClientIntegrationTest#testPref64Option --iterations 100 Change-Id: I3f8d2fbf2e203c6f90029947fa55b5e0b3b06d94
2020-04-17Merge "Add a new field changePrefixOnDecline in DhcpServingParamsParcel." ↵TreeHugger Robot
into rvc-dev
2020-04-17Merge "Fix the incorrect behaviour when receiving a mismatched renew lease." ↵TreeHugger Robot
into rvc-dev
2020-04-17Merge "Renew previous IP address when roaming happens in certain specific ↵TreeHugger Robot
Wi-Fi networks." into rvc-dev
2020-04-16[MP04] Allow to run multiple HTTP and HTTPS probes in parallelChiachang Wang
In certain area, there is no single server that works well. It may result in the validation result varied. Thus, allow device manufacturers to configure these URLs to get expected network status. Bug: 139034276 Test: atest NetworkStackTests NetworkStackNextTests Test: manually test with resource configuration Change-Id: I5327db39b22bf9393e7a397e8f4de786075c841e Merged-In: I5327db39b22bf9393e7a397e8f4de786075c841e (cherry picked from commit 9ce129a8079cf0b0dc1b744738fc7b41fbd40bad)
2020-04-16Renew previous IP address when roaming happens in certain specific Wi-Fi ↵Xiao Ma
networks. Bug: 131797393 Test: atest NetworkStackTests NetworkStackIntegrationTests Test: atest FrameworksNetTests Merged-In: I65ebdd142a2bb402035c63cd282bc2574ddf3d8d Change-Id: I65ebdd142a2bb402035c63cd282bc2574ddf3d8d
2020-04-16Fix the incorrect behaviour when receiving a mismatched renew lease.Treehugger Robot
When the DHCP client is given a new IPv4 address which is not its previous network address to be extended durig RENEWING or REBINDING state, should roll back to INIT state and restart DHCP configuration. That's the intended behaviour with this fix (notify provisioning failure and then exit from receivePacket() immediately, DO NOT accept this renew lease). Otherwise, the new given network address will be accepted and noitfy IpClient to configure this new address on interface, which violates RFC2131#4.4.5. The incorect call graph will be: - receiving mismatched renew lease: - setDhcpLeaseExpiry - acceptDhcpResults - notifySuccess - transitionTo(mDhcpBoundState) - keep using this new address Bug: 131797393 Test: atest NetworkStackTests Merged-In: I6fd37e6af1f6bf3a8ce8de7b9a1ef4731de5db27 Change-Id: I6fd37e6af1f6bf3a8ce8de7b9a1ef4731de5db27
2020-04-16Add a new field changePrefixOnDecline in DhcpServingParamsParcel.Xiao Ma
A new boolean flag (changePrefixOnDecline) to be added in the DhcpServingParamsParcel, indicating whether or not the DHCP server should request a new prefix (e.g. a different subnet prefix) from IpServer when receiving DHCPDECLINE message. Bug: 130741856 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: I8cb0f844ef98a5f17d4e07e1812a1abf73aa4c07 Change-Id: I8cb0f844ef98a5f17d4e07e1812a1abf73aa4c07
2020-04-16Merge "Support decoding the new PREF64 RA option." into rvc-devLorenzo Colitti
2020-04-16Make a customized context when matching a record in MccMncOverrideInfoLucas Lin
MccMncOverrideInfo records the customized carrier id, visited mccmnc, home mccmnc. Once the carrier id and sim's mccmnc are matching a record in MccMncOverrideInfo, make a customized context by changing the mcc/mnc of configuration. Bug: 147075795 Test: atest NetworkStackTests:NetworkMonitorTest Change-Id: I75924f60c637eb93ac99b14b333608b6faeaa24a Merged-In: I20f3c291015a0a79d88e923438d39ff90e1f0752 (cherry picked from commit 6d0b27f8cb8f96eb427609eb03ff6e1a1d490771)
2020-04-16Support decoding the new PREF64 RA option.Lorenzo Colitti
Bug: 153694684 Test: new unit tests Merged-In: I94346939cda910b01ffee75cf8b62a23ec5314cc Change-Id: I94346939cda910b01ffee75cf8b62a23ec5314cc
2020-04-15[MP03] Refactor probing classChiachang Wang
Refactor probing class to allow sending probe via thread class in legacy send parallel probes function and also refactor for follow up commit to send multiple probes. Bug: 139034276 Test: atest NetworkStackTests NetworkStackNextTests Test: manually test with resource configuration Change-Id: Ia25bfe58b10b0a1a641a2be535ee0d602ffd8cd6 Merged-In: Ia25bfe58b10b0a1a641a2be535ee0d602ffd8cd6 (cherry picked from commit c17b3996f428ac80a2f8b2c4f361b0e18b0b50fa)
2020-04-10Merge "Support specific client address configuration" into rvc-devMark Chien
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-10Support specific client address configurationTreehugger Robot
If specific config "clientAddr" is set, the DHCP server will only offer "clientAddr". This is for peer-to-peer use case. If there are multiple clients for which "clientAddr" is already in use, dhcp server will not offer other addresses to clients. Bug: 141256482 Test: manual atest NetworkStackNextTests Merged-In: I96bc24a9c30bfc48dff38c3c4456085694fd381c Change-Id: I96bc24a9c30bfc48dff38c3c4456085694fd381c
2020-04-10Matches the URL content by regular expressionlucaslin
This patch provides a way to configure the regular expression which is used for matching the URL content. Once the result is matching, then NetworkMonitor will treat the validation result as fail or success. Bug: 141406258 Test: 1. Build pass 2. atest NetworkStackTests Merged-In: I77747b34fad895565d42ea4c017759c256d61489 Change-Id: I77747b34fad895565d42ea4c017759c256d61489
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-07Add tests for IpReachabilityMonitorRemi NGUYEN VAN
The first tests just verify that provisioning is lost if all IPv4/6 DNS servers or gateways are lost. Test: atest NetworkStackTests Bug: 152819907 Merged-In: I8da6a8f4f237ce963c0a1610432d310160fd3f20 Change-Id: I8da6a8f4f237ce963c0a1610432d310160fd3f20