summaryrefslogtreecommitdiff
path: root/src/android/net/apf
AgeCommit message (Collapse)Author
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-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-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-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-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-06-26Remove unnecessary castsNeil Fuller
makePacketSocketAddress() takes an int parameter. Bug: 130787951 Test: build Test: atest NetworkStackIntegrationTests Change-Id: Ied5df7955ba3598b6a8050854648fc5f354bd006
2019-05-14apf: Remove IPv6 NAT-T keepalive related codes and ApfTest improvementAaron Huang
Remove IPv6 related codes since we don't support IPv6 NAT-T keepalive as the kernel doesn't support IPv6 UDP encapsulation. Renaming keepaliveAck to keepaliveResponce since NAT-T keeaplive response is not an ack. Also, add generateV4NattKeepaliveFilters() if multicast filter is disabled. Verify incoming packet contains 1 byte payload but it is not 0xff will pass NAT-T keepalive filter. Bug: 33530442 Test: atest FrameworksNetTests atest NetworkStackTests Change-Id: Ifb9e088c0c8d71c763ebd9ad122103d0f97ca278
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-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-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-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-03-06Fix SocketUtils APIRemi NGUYEN VAN
- connect, sendTo, bind were added as public API, so do not need to be maintained as SystemApi in SocketUtils. These APIs were added in Q timeframe. - Add @Nullable/@NonNull annotations. Bug: 126699304 Bug: 126477266 Test: booted, WiFi works Change-Id: I3f086ac8952cfd6a4d8f861d2e1c7aa1ca8be999
2019-02-06[KA07] Drop TCP keepalive ack packetsAaron Huang
To support TCP keepalive offload, APF filter needs to add program for dropping keepalive ack packets when offload is starting. Bug: 114151147 Test: runtest frameworks-net -c android.net.apf.ApfTest Change-Id: If16a9bc04eb29dfedb950b6e4c85fe9ad4cf259f
2019-02-06[KA04] Expose TCP socket keepalive APIjunyulai
The new set of API allows applications to request keepalives offload for established TCP sockets over wifi. However, the application must not write to or read from the socket after calling this method, until specific callbacks are called. Bug: 114151147 Test: atest FrameworksNetTests FrameworksWifiTests NetworkStackTests Change-Id: I3880505dbc35fefa34ef6c79555458ecf5d296a4
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
2019-01-28Add hidden utils and constants to NetworkStackRemi NGUYEN VAN
Test: atest FrameworksNetTests NetworkStackTests Bug: 112869080 Change-Id: I1a803f7954ab760294436226d6c1cffb934e98f9
2019-01-23Move IpClient to NetworkStackRemi NGUYEN VAN
Test: atest FrameworksNetTests NetworkStackTests Bug: b/112869080 Change-Id: I7d00848c052382cd1b6ce458868bed6a1e9e8ec5