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
This commit is contained in:
Bernie Innocenti
2018-04-24 01:25:42 +09:00
parent 9d64b6e6b2
commit f1089bfa95

View File

@@ -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;
}
}