summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2020-06-19Retry networkAddInterface on EBUSY errorCodeTreehugger Robot
If wifi and softAp shared with same interface and switching from wifi to sotAp, there is race that tethering fail to set LCAL_NETID to softAp interface because ConnectivityService do not release wifi netid from that interface yet. Bug: 158269544 Test: atest TetheringCoverageTests atest NetworkStackTests Merged-In: I1dcf0a64190106820a93854b2eb53040341a97e6 Change-Id: I1dcf0a64190106820a93854b2eb53040341a97e6
2020-06-17Fix the potential NPE when calling IPMS API and ExecutionException is thrown.Xiao Ma
Listener callback argument is marked as @Nullable in some APIs, means client isn't interested in learning about return value, in these cases should check if it's null or not before using this callback. Bug: 147922038 Test: atest NetworkStackTests FrameworksNetTests Merged-In: Ib46624c76c2c1e50c73ccfbb295a0e90e6fa1c88 Change-Id: Ib46624c76c2c1e50c73ccfbb295a0e90e6fa1c88
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-04Merge "Adjust the timeout parameters in DHCP client." into rvc-devTreeHugger Robot
2020-06-01Validate test wifi/eth/bluetooth/mobile networksRemi NGUYEN VAN
While not all test networks created by TestNetworkManager should be validated (because they can be used in self-contained tests that should not see unexpected traffic, such as data usage tests), allowing NetworkMonitor to validate test networks that intend to replicate actual network management on the device is valuable for proper testing. This change considers that a network that has both TRANSPORT_TEST and another major transport type (wifi, ethernet, bluetooth, mobile) is attempting to replicate actual network management on the device: this is currently the case with EthernetManager#setIncludeTestInterfaces. In such cases, have the system perform validation even if the network does not have CAPABILITY_INTERNET. Because TRANSPORT_TEST networks do not have CAPABILITY_INTERNET (as expected from the network agent and enforced by ConnectivityService), they still cannot become default networks, even if they gain CAPABILITY_VALIDATED. Bug: 156319532 Test: atest NetworkStackTests FrameworksNetTests CaptivePortalApiTest Original-Change: https://android-review.googlesource.com/1317682 Merged-In: Ib5810dc3b589ffddc06507fb8be3066e09063a3c Change-Id: Ib5810dc3b589ffddc06507fb8be3066e09063a3c
2020-05-29Implement delete methodsChalard Jean
Test: New tests in this patch, IpMemoryStore*Tests Bug: 146460486 Change-Id: Ibda8eeb917c05876e06e78ae600acd626ca94749 Merged-In: I8680164cf34bae2fac1f5431c03a3369dd6318ab (cherry picked from commit 4f81f357bce66c9fca13242d83267ae89cd43f1d, aosp/1311637)
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-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-07Merge "Fix the potential NPE when starting provisioning with FILS." into rvc-devXiao Ma
2020-05-07Fix the potential NPE when starting provisioning with FILS.Xiao Ma
Starting provisioning with enabled FILS is unlike the normal case that always happens after L2 connection has been established, at this point we already know the current bssid. However, for FILS connection, the current bssid is still null when starting prov. Bug: 155696520 Test: atest NetworkStackTests NetworkStackIntegrationTests Merged-In: I3c29c6ad95c23cea2b3f374fb9dc35a8f54a6427 Change-Id: I3c29c6ad95c23cea2b3f374fb9dc35a8f54a6427
2020-05-07Use stable networkstack-aidl-interfacesJeongik Cha
Test: m nothing Bug: 133526962 Original-Change: https://android-review.googlesource.com/1301076 Merged-In: If2dc208e55700ab715e466dbd55ba10a74dd9f40 Change-Id: If2dc208e55700ab715e466dbd55ba10a74dd9f40
2020-05-06Add apex_available field in networkstack-aidl-interfacesJeongik Cha
Instaed of updating the whitelist, add explicit apex_available field. Bug: 133526962 Test: m nothing Change-Id: Ia3c568d5af6c3949f40125193bc8a49b47868128
2020-05-01Merge "Freeze Networkstack AIDL API as V6" into rvc-devTreeHugger Robot
2020-05-01Merge "Do not stop FdEventsReader on handlePacket error" into rvc-devTreeHugger Robot
2020-05-01Freeze Networkstack AIDL API as V6Lorenzo Colitti
This APIs needs to be frozen before release, because unstable version in REL will be disallowed. Bug: 133526962 Test: m Original-Change: https://android-review.googlesource.com/1277432 Merged-In: I01096d4fb9f60b675aae5c3fe5d5a49d9ae0775c Change-Id: I01096d4fb9f60b675aae5c3fe5d5a49d9ae0775c
2020-05-01Merge "Add default and nullable annotations to NetworkStack AIDLs." into rvc-devLorenzo Colitti
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-01Add default and nullable annotations to NetworkStack AIDLs.Treehugger Robot
All new fields should have defaults. Do that for fields added in v6 before we freeze v6. Fields added in v5 can no longer be changed because v5 is frozen. Test: m Bug: 133526962 Original-Change: https://android-review.googlesource.com/1299381 Merged-In: Ie2ecd84919a59adf89d0c56e4fdf2b2258fa1448 Change-Id: Ie2ecd84919a59adf89d0c56e4fdf2b2258fa1448
2020-04-30Merge changes I9d38c696,I8da6a8f4 into rvc-devRemi NGUYEN VAN
* changes: Fix IpReachabilityMonitorTest flakes/Q failures Add tests for IpReachabilityMonitor
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-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-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-20Merge "Mark StructNdOptPref64#prefix @NonNull." into rvc-devLorenzo Colitti
2020-04-20Mark StructNdOptPref64#prefix @NonNull.Lorenzo Colitti
The prefix can never be null. Mark it as such to make it clearer that no null checks for it are needed. Bug: 153694684 Test: atest NetworkStackTests:NduseroptMessageTest NetworkStackTests:StructNdOptPref64Test Merged-In: Ica4f6f7545e63e0665c2a4ae4de8323f3fd93e1c Change-Id: Ica4f6f7545e63e0665c2a4ae4de8323f3fd93e1c
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-18Support constructing a StructNdOptPref64 from data.Lorenzo Colitti
This is mostly useful in tests at the moment. Also address a review comment from a previous CL. Bug: 152723363 Test: atest NetworkStackTests:NduseroptMessageTest NetworkStackTests:StructNdOptPref64Test Merged-In: I29c3967200e1353972503739b9ba4d1194ce162b Change-Id: I29c3967200e1353972503739b9ba4d1194ce162b
2020-04-18Support serializing a StructNdOptPref64 to a ByteBuffer.Lorenzo Colitti
Bug: 153694684 Test: new unit tests Merged-In: I82a3239a532fe4141627d146f9d47ba99d1622dd Change-Id: I82a3239a532fe4141627d146f9d47ba99d1622dd
2020-04-17Fix parsing a NduseroptMessage inside a NetlinkMessage.Treehugger Robot
The parsing code inside NduseroptMessage assumed that the message started at the beginning of the buffer. Fix this, and also restore the original endianness and limit of the buffer after parsing. Add tests for this, and make the existing tests a bit more readable. Bug: 153694684 Test: new unit tests Merged-In: Id0b4dc18dd219b4d35846e161022a37c8de3e3bb Change-Id: Id0b4dc18dd219b4d35846e161022a37c8de3e3bb
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 "Refactor a new NetlinkMonitor class out of IpNeighborMonitor." into ↵Lorenzo Colitti
rvc-dev
2020-04-16Support parsing ND option messages.Lorenzo Colitti
Define a new StructNduseroptmsg class that is a rough equivalent of the "struct nduseroptmsg" used to pass RA options from the kernel to userspace. Also define a new NdOption class and make the existing pref64 option subclass it. Bug: 153694684 Test: new unit tests Change-Id: I3b71e63ee2cdaa40d095e889188943c5b0cd13af Merged-In: I3b71e63ee2cdaa40d095e889188943c5b0cd13af (cherry picked from commit 48d23146bf3e6e272538f120f1d4af0fef441710)
2020-04-16Refactor a new NetlinkMonitor class out of IpNeighborMonitor.Lorenzo Colitti
This CL adds a new NetlinkMonitor that is a subclass of PacketReader and a superclass of IpNeighborMonitor. The class can be used to implement other simple "listen to netlink broadcasts and take action on them" classes without requiring much new code to be written. Bug: 153694684 Test: atest NetworkStackTests:IpReachabilityMonitorTest Merged-In: Ia7ffb0fab4b116f4e238ccc5f5da92a04c4c86e2 Change-Id: Ia7ffb0fab4b116f4e238ccc5f5da92a04c4c86e2
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-14Merge "ipmemorystore-aidl-interfaces is marked as available to platform" ↵TreeHugger Robot
into rvc-dev
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-10ipmemorystore-aidl-interfaces is marked as available to platformJiyong Park
The lib is depended on by NetworkStackNext which is part of the platform. With b/153073816, we will be checking the availability to the platform, i.e. platform-available module depending on platform-unavailable module causes a build error. Prepare for the change by correctly marking that this interface lib is available to the platform. Bug: 153073816 Test: m Change-Id: I946c9c874b381a8679071f87060d4e4739875f82
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-07Merge "Add bssid field in the ScanResultInfo class." into rvc-devXiao Ma
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
2020-04-07Add bssid field in the ScanResultInfo class.Xiao Ma
This change adds a new filed: bssid in the ScanResultInfo class which are encapsulated by WiFi when connecting to AP successfully, using current connected AP's bssid as a hint to determine whether L2 roaming happened or not. Also adding @NonNull annotation for fields, methods and constructor params. Bug: 131797393 Test: atest NetworkStackIntegrationTests NetworkStackTests Test: atest FrameworksNetTests Change-Id: Ia11f1954124f45f9586495f6be7fb7fb3430ae97
2020-04-07Rename IDhcpLeaseCallbacks to IDhcpEventCallbacks for more generic.Xiao Ma
This change renames IDhcpLeaseCallbacks, easier to expand in the future and adds a new method onNewPrefixRequest which will be called on DHCP server receives DHCPDECLINE message and request a new IPv4 prefix from IpServer. Bug: 130741856 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: Ia7b08bb1e7feda08ffe9fbb8885dbc8b7bdd66c9 Change-Id: Ia7b08bb1e7feda08ffe9fbb8885dbc8b7bdd66c9
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-25Move TapPacketReader into its own utility class.Automerger Merge Worker
This class is generally useful for tests that manipulate packets using a TestNetworkInterface. It will be used in upcoming tethering tests. Also make it take a FileDescriptor instead of a ParcelFileDescriptor, since that is more generally more useful. As part of this change, create a filegroup of files that the test utilities can depend on. Bug: 150644681 Test: atest NetworkStackIntegrationTests:IpClientIntegrationTest Change-Id: I73e9c1919956aa665a8cccec11d3444e486426ec Merged-In: I73e9c1919956aa665a8cccec11d3444e486426ec (cherry picked from commit f5e20cdc22dd017adec10efff5346ddf67628230)
2020-03-23Fix the potential BufferUnderflowException when parsing ByteBuffer.Xiao Ma
Miss catching BufferUnderflowException when converting ByteBuffer to bytes array for InformationElement member of ScanResultInfo, it might throw BufferUnderflowException when calling ByteBuffer.get() method. Reset the position of copied ByteBuffer before calling get() method should prevent BufferUnderflowException to be thrown. Bug: 137835398 Test: atest NetworkStackIntegrationTests FrameworksNetTests Merged-In: Ibec0991c1f7158f503f8808bf34d9049984099e0 (cherry picked from commit ffc469e1e710c5d22accb551baaf4c4c40c7c752) Change-Id: I69928103d8cd2c9066d1f5886d43fbcf21eb5818
2020-03-23Add API dump for the current versionJiyong Park
created by invoking 'm <module_name>-update-api' Exempt-From-Owner-Approval: cherry-pick from AOSP Bug: 147433177 Test: m Merged-In: I591200ed6ee89a398ad5e85258aaf1201703b14d (cherry picked from commit b4431687efc3e847b2503adccba097a92db5cc9f) Change-Id: I591200ed6ee89a398ad5e85258aaf1201703b14d
2020-03-19Merge "Use NetworkStack.getService in NetworkStackClient" into rvc-devRemi NGUYEN VAN