summaryrefslogtreecommitdiff
path: root/src/android/net
AgeCommit message (Collapse)Author
2019-11-12Merge "Revert "Revert "Fix sll_protocol in DhcpClient packet socket"""Remi NGUYEN VAN
2019-11-08Revert "Revert "Fix sll_protocol in DhcpClient packet socket""Remi NGUYEN VAN
Fix sll_protocol in DhcpClient packet socket The broadcast socket address was created with a deprecated API that does not set sll_protocol. This causes packets to be filtered incorrectly in packet capture, typically with tcpdump. This change only affects device with API > Q, since Q does not have the proper API to set the protocol. Also includes fixing the build path that was referencing apishim/current (which does not exist) instead of apishim/30 (the correct directory). SocketUtilsShim can be used on the system_current target with that fix. See change: I07887b82e0e32aadb0cbb9f930f2b2fa3e277ca9 Bug: 133196453 Test: manual; on AOSP with the new build, packet capture has the right protocol. When installed on a Q release build, behavior is unchanged. This reverts commit 5ad0944d24e8dabc7fa56c3325e9200669889641. Reason for revert: Roll forward the previous change, as the build breakage has been addressed. The stable build target is now used to build the NetworkStack mainline module, which allows this change to be merged. Change-Id: Ie933050ef269ce2159f3f44ac4db1f9aae134faf
2019-11-06Merge "Revert "Fix sll_protocol in DhcpClient packet socket""Remi NGUYEN VAN
2019-11-06Revert "Fix sll_protocol in DhcpClient packet socket"Remi NGUYEN VAN
This reverts commit 0c5e74000546a6c148e79985ee5fbf53dc454453. Reason for revert: Broke build in qt-qpr1-dev-plus-aosp Change-Id: I2e5738e776881f8c4f3cf459398a250560a43559
2019-11-06Merge "Fix sll_protocol in DhcpClient packet socket"Remi NGUYEN VAN
2019-11-06Fix sll_protocol in DhcpClient packet socketRemi NGUYEN VAN
The broadcast socket address was created with a deprecated API that does not set sll_protocol. This causes packets to be filtered incorrectly in packet capture, typically with tcpdump. This change only affects device with API > Q, since Q does not have the proper API to set the protocol. Also includes fixing the build path that was referencing apishim/current (which does not exist) instead of apishim/30 (the correct directory). SocketUtilsShim can be used on the system_current target with that fix. See change: I07887b82e0e32aadb0cbb9f930f2b2fa3e277ca9 Bug: 133196453 Test: manual; on AOSP with the new build, packet capture has the right protocol. When installed on a Q release build, behavior is unchanged. Change-Id: Iaafd0b3935473b1cfab61b49b2f107e71e01de2d
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-11-04Merge "Fix RAs with different retansmission timer would be dropped by apf"Lorenzo Colitti
2019-11-04Merge changes Icf6893ef,I7d788724Lorenzo Colitti
* changes: Always expire servers when receiving a zero-lifetime RDNSS option Add a test for IPv6 provisioning and RDNSS.
2019-11-04Fix RAs with different retansmission timer would be dropped by apfAaron Huang
When firmware receives RAs with different retransmission timer, it is expected the RAs should be accepted by apf filter. However, they are currently dropped since missing fields which should be added into match section. It causes to apf filter treats those RAs as the same and then drops. This change adds the remaining fields to match section to compare reachable time and retransmission timer with incoming RAs. Also, add test to check that RIOs differing only in the first 4 bytes are different should be passed. Bug: 143186590 Test: sent RAs with different rtt and check RAs are accepted Change-Id: I7e2de29740f96b212634b5aeffe709d57afafc68
2019-11-04Always expire servers when receiving a zero-lifetime RDNSS optionLorenzo Colitti
When receiving a zero-lifetime RDNSS option for DNS servers that is already configured, the code first sets the lifetime of the servers to zero, and then runs code that prunes expired servers. Because expired servers are pruned only if "expiry < now", if the pruning happens in the same millisecond as the update, the servers aren't actually pruned. This can happen multiple times, so if the code runs fast enough, the server will never expire. Fix this by using <= instead of <. Fix: 143806550 Test: makes the new IpClientIntegrationTest#testRaRdnss not flaky Change-Id: Icf6893efdc028859b178eb234f6f1a42b24e2936
2019-10-31Merge "Remove hidden annotation usage from NetworkStack"Remi NGUYEN VAN
2019-10-31Merge "Separate the timeout behavior from PacketRetransmittingState class."Treehugger Robot
2019-10-30Separate the timeout behavior from PacketRetransmittingState class.Xiao Ma
The purpose is to make subclass that only requires timeout method could extend from TimeoutState instead of PacketRetransmittingState, avoiding the anti-pattern of using inheritance for code reuse only. After refactoring, class inheritance relationship looks like: LoggingState <-- TimeoutState <-- PacketRetransmittingState <-- DhcpInitState Bug: 140223017 Test: atest FrameworksNetTests NetworkStackTests Test: atest NetworkStackIntegrationTests Change-Id: I1fed3ff3ef8b0bdf3645188949e38c3a332f9d6e
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-21Merge "Refactor the ReceiveThread with PacketReader in DhcpClient."Xiao Ma
2019-10-20Merge "Refactor RA parsing code for simplicity."Treehugger Robot
2019-10-18Refactor the ReceiveThread with PacketReader in DhcpClient.Xiao Ma
To implement the IP address conflict detection, we need another ReceiveThread to listen ARP packets as well. Ideally, we should listen both of DHCP packets and ARP packets in the same thread with DhcpClient state machine handler. This CL replaces the ReceiveThread with PacketReader to listen DHCP packets. After refactoring, DHCP packets are read from the same handler thread instead of a separate receiving thread. Then we can also leverage the same handler thread to listen the ARP packets simultaneously via another raw socket. Bug: 130775067 Test: atest NetworkStackTests NetworkStackIntegrationTests Change-Id: I23e91a6c2d99cf8053e62f2ae9d78481ece6384d
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-10-16Refactor RA parsing code for simplicity.Lorenzo Colitti
Currently, the RA parsing code keeps track of byte ranges in the packet using pairs of integers called "non-lifetimes". Replace this with a PacketSection class that also stores some information about the range including whether the range should be matched or not, what ICMP option the section was a part of, and so on. This makes the code easier to read and will make it easier to change the behaviour based on the information contained in the sections. Bug: 66928272 Test: refactoring covered by existing unit tests Change-Id: Iab8b04aafce8d8992e835a6448a75b950296bec5
2019-09-28Merge changes Ieed58e27,I61212a80Lorenzo Colitti
* changes: Make the APF tests a bit more realistic. Add more RA tests to ApfTest.
2019-09-27Merge "Add tests to verify whether IpClient crashes when wlan interface ↵Treehugger Robot
doesn't exist."
2019-09-27Make the APF tests a bit more realistic.Lorenzo Colitti
Currently the APF tests include empty options, and manually assemble the packets. Fix this by using helper methods. Also increase the memory size of the APF interpreter used by the test. This is because future CLs in this series add enough RAs to hit the limit. Also add a log line to the interpreter when the filter hits the maximum size. Bug: 66928272 Test: test-only change Change-Id: Ieed58e278b8a9e7d7f1bdac44aadf56d658df50f
2019-09-27Add more RA tests to ApfTest.Lorenzo Colitti
Bug: 66928272 Test: new tests pass Change-Id: I61212a8012ce2f4f2727d8531d116975352a45e2
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-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-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-09-05Merge "DO NOT MERGE - Merge Android 10 into master"Xin Li
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-26Restore the default interface MTU when disconnecting from Wi-Fi AP.Xiao Ma
am: 1ef8fd8741 Change-Id: Ib472de0f7a45b81b84eacaea2ce7a979e80dd371
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
am: c80a667b36 Change-Id: I17e6d5ecea63abd0b5727a0685db8a9fc7b43e26
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-05Merge "Revert "Restore the default interface MTU when disconnecting from ↵Xiao Ma
Wi-Fi AP."" am: e27aa0f91b Change-Id: I00442bce3f72843865d0f0edd4d34c8050f0b49f
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
am: 98ed332579 Change-Id: I233bb0a636711ea2772f2b4ea140ce3bc7af3197
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-12IpNeighbourMonitor - no longer require PortId = 0Maciej enczykowski
am: 168d1cd3c0 Change-Id: I83b455ae2f33d486beb944b20ebbf06dffddb32d
2019-07-12IpNeighbourMonitor - no longer require PortId = 0Maciej Żenczykowski
This is required to support Linux kernel 4.11+ due to: commit 7b8f7a402d4cfc3a1361a2766066127f9bccadc4 [v4.11-rc2-661-g7b8f7a402d4c] Author: Roopa Prabhu <roopa@cumulusnetworks.com> Date: Sun Mar 19 22:01:28 2017 -0700 neighbour: fix nlmsg_pid in notifications neigh notifications today carry pid 0 for nlmsg_pid in all cases. This patch fixes it to carry calling process pid when available. Applications (eg. quagga) rely on nlmsg_pid to ignore notifications generated by their own netlink operations. This patch follows the routing subsystem which already sets this correctly. Reported-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net> Test: builds Bug: 137234834 Change-Id: I33244d4ab5aff9305600a68a19ea86609b2d4b5a Signed-off-by: Maciej Żenczykowski <maze@google.com>
2019-07-08Merge "Add integration test to verify different DHCP handshake process."Xiao Ma
am: b237ae9944 Change-Id: I5ebe6ed8090dfe5700a065ab1f7eb28de53b06e9
2019-07-06Add integration test to verify different DHCP handshake process.Xiao Ma
Bug: 122710829 Test: atest NetworkStackIntegrationTests Test: atest NetworkStackTests Change-Id: If605a5688827b376866b68289b76c452e8366d0c
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-06-26Merge "Remove unnecessary casts" am: 6c22b3fd3eNeil Fuller
am: 51b4202ea5 Change-Id: I361808bf8556b5e0dab50ec8c7556544d534a253
2019-06-26Remove unnecessary castsNeil Fuller
makePacketSocketAddress() takes an int parameter. Bug: 130787951 Test: build Test: atest NetworkStackIntegrationTests Change-Id: Ied5df7955ba3598b6a8050854648fc5f354bd006
2019-06-11Merge "Add DHCP INIT-REBOOT state in DHCP client." am: 670a869a13Xiao Ma
am: 02434dace7 Change-Id: I5866c84a4f4bbcb32e7349d3fe0a52cb927b7aa1
2019-06-11Add DHCP INIT-REBOOT state in DHCP client.Xiao Ma
Bug: 122710829 Test: atest FrameworksNetTests NetworkStackTests Change-Id: I4d7f2f5e7303f34b6364109a545f60fc25b88058
2019-06-09Merge "Add an IpClientIntegrationTest" am: 67be1d71aaXiao Ma
am: 7b2e7f6a1d Change-Id: I6db9bd839077abd2363c45f6a8ce8cafb53d0654
2019-06-10Add an IpClientIntegrationTestXiao Ma
The test sets up a tap interface and starts IpClient on it. It currently only tests that DhcpClient starts sending discover packets. Test: atest NetworkStackIntegrationTests Test: atest NetworkStackTests Change-Id: I99b135974af758ad5255f06bef6121e85ab62ffe