From f1089bfa95e43f6d763c273e7f20a28a222d391b Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Tue, 24 Apr 2018 01:25:42 +0900 Subject: [PATCH] apf: Add counters for dropped / passed packets ApfFilter maintains separate counters for each reason why a packet was passed or dropped by the filter logic. There's also a total which should match the individual counters, *unless* the APF interpreter aborted execution early due to an illegal instruction or an out-of-bounds access. Test: both on APFv2 and APFv4-capable device: runtest -x tests/net/java/android/net/ip/IpClientTest.java runtest -x tests/net/java/android/net/apf/ApfTest.java manual tests connected to an AP Bug: 73804303 Change-Id: I54b17fcbb95dfaea5db975d282314ce73d79d6ec --- services/net/java/android/net/apf/ApfCapabilities.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/net/java/android/net/apf/ApfCapabilities.java b/services/net/java/android/net/apf/ApfCapabilities.java index 703b415602..dec8ca2073 100644 --- a/services/net/java/android/net/apf/ApfCapabilities.java +++ b/services/net/java/android/net/apf/ApfCapabilities.java @@ -49,4 +49,14 @@ public class ApfCapabilities { return String.format("%s{version: %d, maxSize: %d, format: %d}", getClass().getSimpleName(), apfVersionSupported, maximumApfProgramSize, apfPacketFormat); } + + /** + * Returns true if the APF interpreter advertises support for the data buffer access opcodes + * LDDW and STDW. + * + * Full LDDW and STDW support is present from APFv4 on. + */ + public boolean hasDataAccess() { + return apfVersionSupported >= 4; + } }