summaryrefslogtreecommitdiff
path: root/src/android/net/ip/IpClient.java
AgeCommit message (Collapse)Author
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-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-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-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-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-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-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-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-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-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-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-03Merge "Add new method to update Layer2 information when L2 roaming happens." ↵Xiao Ma
into rvc-dev
2020-04-03Getting interface params in ClearingIpAddressState#enter.Xiao Ma
In case of wifi might stop IpClient and then restart prov immediately to avoid wifi disconnection especially when roaming happens, this might cause getting interface params with incorrect interface mtu when starting provisioning again before interface mtu hasn't been restored. Moving getting interface params to ClearingIpAddressState#enter ensures that interface parameters are fetched on the handler thread so they are properly ordered with other events, such as restoring the interface MTU on teardown. Bug: 152169857 Test: atest NetworkStackIntegrationTests NetworkStackTests Merged-In: Ifd06b8d18ce570b1aa424ad215111c80f094ca97 (cherry picked from commit a6aba532103a3258d09e6931106d6fb05368c130) Change-Id: I0c8c1ed1646ab12bc30da2b7f8e5819d2d9495ba
2020-04-02Add new method to update Layer2 information when L2 roaming happens.Xiao Ma
This change adds an new method updateLayer2Information in IIpClient.aidl to update layer2 info (e.g. bssid, l2key and grouphint) to detect whether L2 roaming happens or not. Bug: 131797393 Test: atest NetworkStackTests FrameworksNetTests Merged-In: I85eabccb6f5d5f322c8e3df556ceef6647616f5a (cherry picked from commit 3168e392320087c51a677b4d14e783c853ac652d) Change-Id: Ife93fd162803ae89fa85905b45a4bb1cfb5e7e43
2020-03-19Merge "Detect upstream hotspot device type by checking the vendor specific ↵TreeHugger Robot
IE." into rvc-dev
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-17Provide RRO to configure neighbor unreachable probes parameters.Automerger Merge Worker
Bug: 130871097 Test: atest FrameworksNetTests NetworkStackTests Merged-In: Idc2c4303640d4fd3fc29dd0957771088820030ff (cherry picked from commit f540206076ca0e55d685ef81e3e04da3e9a654cf) Change-Id: Icd69008635461aa24d976f9b9d2d0ef1d60e23d5
2020-03-11Make IpClient populate the DHCP server address in LinkPropertiesAutomerger Merge Worker
Bug: 134098566 Test: lunch arm_aosp-userdebug make -j32 Change-Id: Ide9610f9b17992eef83e1c42ac71b1b79c179f44 Merged-In: If86a6303671b03bb2ccf98de7e9d77020b013d2f (cherry picked from commit 10d243214ae933d063affdd2b4f6c1f837279586)
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-18Send the capport fields to the system server.Chalard Jean
The fields are behind a protection method to avoid inadvertently sending private data to apps. This is going to the system server which needs those fields. Test: NetworkStackTests Change-Id: I7c9a7a82efa364835164622d2e93977e0bcd3d8c
2020-01-29Add implementation of getInterfaceHash()Paul Trautrim
Exempt-From-Owner-Approval: cherry-pick from internal Bug: 136065010 Test: m Change-Id: Iaf682c850b7cf22980d6fb88d3d60e24c189b74c Merged-In: Iaf682c850b7cf22980d6fb88d3d60e24c189b74c
2019-12-20Add more integration test cases (timeout/abort/success) for DHCP FILS.Xiao Ma
- receiving CMD_TIMEOUT before aborting FILS process. - receiving CMD_TIMEOUT after aborting FILS process. - receiving CMD_TIMEOUT before success FILS process. - receiving CMD_TIMEOUT after success FILS process. Bug: 140223017 Test: atest NetworkStackTests NetworkStackIntegrationTests Change-Id: I519bf2fdda38cb9666f769868379a0c044356db0
2019-12-04Add DHCP Rapid Commit FILS support.Xiao Ma
Bug: 140223017 Test: atest FrameworksNetTests NetworkStackTests Test: atest NetworkStackIntegrationTests Test: manual Change-Id: Ibf200891c9742825a599a21b43f02927869f98ab
2019-12-02Add a ClearingIpAddressesState.Lorenzo Colitti
This simplifies StartedState a bit, and should have no impact on behaviour. Test: atest IpClientIntegrationTest Change-Id: Ie897307925a9af571a622c823d4c641956e607f3
2019-11-06Support dropping RDNSS options with a low lifetime.Lorenzo Colitti
Some routers have been known to use RDNSS lifetimes of 10 seconds(!). This causes APF filters to be set to very low lifetimes, which substantially impacts battery life. There are two parts to this: 1. Ignore low RDNSS option lifetimes for the purpose of calculating APF filter lifetimes. 2. Do not add DNS servers to the repository if their lifetimes are too low. If we do #1 without #2, the servers will expire because APF will drop the RAs that refresh them, potentially causing outages or disconnections. The behaviour is enabled by default starting from R and can be enabled on all builds using a flag. Bug: 66928272 Test: New unit test passes Change-Id: Ib2e2555026da3e81ea3d50767a30092413b4e4f5
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-09-25Add tests to verify whether IpClient crashes when wlan interface doesn't exist.Xiao Ma
Bug: 113350007 Test: atest NetworkStackIntegrationTests Change-Id: I60ba097997193d9150567dca7156750004425602
2019-09-03Refactor NetworkStackService for testabilityRemi NGUYEN VAN
Refactor some methods to allow integration testing between ConnectivityService and NetworkStack. The integration tests override some NetworkStack methods to mock permission checks or NetworkMonitor network requests. Test: atest NetworkStackTests Change-Id: Ib5b4458f0b4d1423759e1e4016ab961d3ced7b48
2019-08-18Restore the default interface MTU when disconnecting from Wi-Fi AP.Xiao Ma
Bug: 113350007 Test: atest FrameworksNetTests NetworkStackTests Test: atest NetworkStackIntegrationTests Test: manual test Change-Id: I709a504885033a330b946de402a261d341f78117
2019-08-13Fix avoidBadWifi behavior with IPv6 provisioningRemi NGUYEN VAN
IPv6 provisioning loss should be ignored when avoidBadWifi is false, not true. Bug: 139023420 Test: with avoidBadWifi=false, when connected to a mobile hotspot that loses connectivity, WiFi does not disconnect anymore Change-Id: I534df1595a123866df9ba9f6429331e7fb1c5251
2019-08-02Revert "Restore the default interface MTU when disconnecting from Wi-Fi AP."Xiao Ma
This reverts commit 98ed332579d20a8304b5cdbba761d49bcad75fd3. Reason for revert: prepare another CL to fix the possible NPE issue. Test: atest NetworkStackIntegrationTests Change-Id: I9237b31625299162dca1c2b3e012858413639081
2019-08-01Restore the default interface MTU when disconnecting from Wi-Fi AP.Xiao Ma
Bug: 113350007 Test: atest FrameworksNetTests NetworkStackTests Test: atest NetworkStackIntegrationTests Test: manual test Change-Id: I4b0ecdb63df567f0cbbb13d2b48bbfaaa7aee4d9
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-06-11Add DHCP INIT-REBOOT state in DHCP client.Xiao Ma
Bug: 122710829 Test: atest FrameworksNetTests NetworkStackTests Change-Id: I4d7f2f5e7303f34b6364109a545f60fc25b88058
2019-05-06Send message to add/remove NAT-T keepalive packet filter.Aaron Huang
Remove definition of TYPE_NATT and TYPE_TCP since the type can be identified by checking message.obj is an instance of NattKeepalivePacketData or TcpKeepalivePacketData. It's more simple and won't have dependency on KeepaliveInfo. Bug: 33530442 Test: atest FrameworksNetTests atest NetworkStackTests Change-Id: Ic97ffe9ff5781778efd264460809f5059f0f4230
2019-04-29Support adding NATT keepalive packet filterAaron Huang
Support adding NATT keepalive packet filter to APF filter. Generating APF program will be addressed in another CL. Bug: 33530442 Test: - atest NetworkStackTests - atest FrameworksNetTests Change-Id: I4961d5da343d8700600269632787c28112f0f9f1
2019-04-23Freeze the networkstack-aidl-interfaces interfaceRemi NGUYEN VAN
This freezes the interface as of the latest beta build, not the tip of tree. IIpClient#setL2KeyAndGroupHint is not in the frozen definition in particular. Generated with: m networkstack-aidl-interfaces-freeze-api \ ipmemorystore-aidl-interfaces-freeze-api Test: flashed, booted, WiFi and captive portal working Bug: 128803828 Change-Id: Ideabe73fc93bbefca2d624ee9ca190cf31419424
2019-04-05Add a mechanism to pass the L2Key and group hint to IpClientChalard Jean
Test: IpClientTest Change-Id: I399b20ce29a385a74971b7a7248a48cb4d66deb6
2019-04-01Merge "Fix ApfCapabilities, LinkAddress, RouteInfo, IpPrefix API issues."Paul Hu
2019-04-01Fix ApfCapabilities, LinkAddress, RouteInfo, IpPrefix API issues.paulhu
Fix: 129362082 Fix: 129361362 Fix: 129360330 Fix: 129362379 Test: atest FrameworksNetTests NetworkStackTests Change-Id: I05fbc6f98207d5cf002e3cbc5829040af7d6be52
2019-03-27Fix message names in dumpsys network_stackRemi NGUYEN VAN
Constants were stripped out by ProGuard, so MessageUtils.findMessageNames would fail to find them. Test: flashed, dumpsys network_stack shows message names Fixes: 124619824 Change-Id: I285ce2ab52cdff48f17b422285a635bd34243498
2019-03-25Fix API in CaptivePortal and ConnectivityManagerRemi NGUYEN VAN
- Remove CaptivePortal constructor from SystemApi. This constructor was added in Q timeframe and ends up being unnecessary since CaptivePortal creation was refactored to ConnectivityService because of visibility issues on ICaptivePortal. - Rename getAvoidBadWifi to shouldAvoidBadWifi - Add permission annotation for shouldAvoidBadWifi (already merged in internal as: I09545c00af3519dbf141dd5951b28f49e37b3e80) Test: flashed, WiFi and captive portal works Bug: 128935314 Bug: 128935673 Merged-In: I09545c00af3519dbf141dd5951b28f49e37b3e80 Change-Id: I7395d4a4db6a64398a827692aee1956c011873e5
2019-03-21Fix Automated API Review issues.paulhu
1. Some API's argument/return value must be marked either @NonNull or @Nullable. 2. Change some system APIs to public APIs. 3. Modify the method name Bug: 126700123 Bug: 126702339 Bug: 126699682 Bug: 118296575 Bug: 126699216 Bug: 126699675 Bug: 126699429 Bug: 126699193 Bug: 123586045 Test: atest FrameworksNetTests Change-Id: Iaa2832cdcf83758ed0fec81b954a0c63bc5a7bf6