diff options
| author | 2016-03-22 17:36:16 +0000 | |
|---|---|---|
| committer | 2016-03-22 17:36:17 +0000 | |
| commit | 5ec323aea2f08ba34911962fdf2b7cad5e801b9f (patch) | |
| tree | 78ea202d70a3c478aab1aadef64ee4fca2784d8d | |
| parent | 71432a08c61d4f0305e43a219e5a03940a7d46f4 (diff) | |
| parent | 39c0d42f8120eae5f8c56a6acd223998a1debc3e (diff) | |
Merge "Also dump the last APF program to be installed." into nyc-dev
| -rw-r--r-- | services/core/java/com/android/server/connectivity/ApfFilter.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/connectivity/ApfFilter.java b/services/core/java/com/android/server/connectivity/ApfFilter.java index d62a0b3fb090..001466515c17 100644 --- a/services/core/java/com/android/server/connectivity/ApfFilter.java +++ b/services/core/java/com/android/server/connectivity/ApfFilter.java @@ -90,6 +90,7 @@ public class ApfFilter { } private static final String TAG = "ApfFilter"; + private static final boolean DBG = true; private static final boolean VDBG = false; private final ConnectivityService mConnectivityService; @@ -205,6 +206,10 @@ public class ApfFilter { // For debugging only. How many times this RA was seen. int seenCount = 0; + // For debugging only. Returns the hex representation of the last matching packet. + String getLastMatchingPacket() { + return HexDump.toHexString(mPacket.array(), 0, mPacket.capacity(), false /* lowercase */); + } private String IPv6AddresstoString(int pos) { try { @@ -454,7 +459,7 @@ public class ApfFilter { private long mLastInstalledProgramMinLifetime; // For debugging only. The length in bytes of the last program. - private long mLastInstalledProgramLength; + private byte[] mLastInstalledProgram; private void installNewProgram() { if (mRas.size() == 0) return; @@ -495,7 +500,7 @@ public class ApfFilter { } mLastTimeInstalledProgram = curTime(); mLastInstalledProgramMinLifetime = programMinLifetime; - mLastInstalledProgramLength = program.length; + mLastInstalledProgram = program; if (VDBG) { hexDump("Installing filter: ", program, program.length); } else { @@ -515,7 +520,7 @@ public class ApfFilter { } private void hexDump(String msg, byte[] packet, int length) { - log(msg + HexDump.toHexString(packet, 0, length)); + log(msg + HexDump.toHexString(packet, 0, length, false /* lowercase */)); } private void processRa(byte[] packet, int length) { @@ -608,7 +613,7 @@ public class ApfFilter { pw.println(String.format( "Last program length %d, installed %ds ago, lifetime %d", - mLastInstalledProgramLength, curTime() - mLastTimeInstalledProgram, + mLastInstalledProgram.length, curTime() - mLastTimeInstalledProgram, mLastInstalledProgramMinLifetime)); pw.println("RA filters:"); @@ -618,8 +623,22 @@ public class ApfFilter { pw.increaseIndent(); pw.println(String.format( "Seen: %d, last %ds ago", ra.seenCount, curTime() - ra.mLastSeen)); + if (DBG) { + pw.println("Last match:"); + pw.increaseIndent(); + pw.println(ra.getLastMatchingPacket()); + pw.decreaseIndent(); + } pw.decreaseIndent(); } + + if (DBG) { + pw.println("Last program:"); + pw.increaseIndent(); + pw.println(HexDump.toHexString(mLastInstalledProgram, false /* lowercase */)); + pw.decreaseIndent(); + } + pw.decreaseIndent(); } } |