APF: add debug code.
1. Store additional debug information when RA filtering. 2. Add a toString method for RA packets. 3. Make "adb shell dumpsys connectivity apf" dump APF filter state. Bug: 26238573 Change-Id: I1441ff7bc90e63624f8b10a220b2ac97f4d390a5
This commit is contained in:
@@ -1784,20 +1784,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
|
||||
if (mContext.checkCallingOrSelfPermission(
|
||||
android.Manifest.permission.DUMP)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
pw.println("Permission Denial: can't dump ConnectivityService " +
|
||||
"from from pid=" + Binder.getCallingPid() + ", uid=" +
|
||||
Binder.getCallingUid());
|
||||
return;
|
||||
}
|
||||
|
||||
private void dumpNetworkDiagnostics(IndentingPrintWriter pw) {
|
||||
final List<NetworkDiagnostics> netDiags = new ArrayList<NetworkDiagnostics>();
|
||||
if (argsContain(args, "--diag")) {
|
||||
final long DIAG_TIME_MS = 5000;
|
||||
for (NetworkAgentInfo nai : mNetworkAgentInfos.values()) {
|
||||
// Start gathering diagnostic information.
|
||||
@@ -1812,7 +1800,41 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
netDiag.waitForMeasurements();
|
||||
netDiag.dump(pw);
|
||||
}
|
||||
}
|
||||
|
||||
private void dumpApf(IndentingPrintWriter pw) {
|
||||
pw.println("APF filters:");
|
||||
pw.increaseIndent();
|
||||
for (NetworkAgentInfo nai : mNetworkAgentInfos.values()) {
|
||||
if (nai.apfFilter != null) {
|
||||
pw.println(nai.name() + ":");
|
||||
pw.increaseIndent();
|
||||
nai.apfFilter.dump(pw);
|
||||
pw.decreaseIndent();
|
||||
}
|
||||
}
|
||||
pw.decreaseIndent();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
|
||||
if (mContext.checkCallingOrSelfPermission(
|
||||
android.Manifest.permission.DUMP)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
pw.println("Permission Denial: can't dump ConnectivityService " +
|
||||
"from from pid=" + Binder.getCallingPid() + ", uid=" +
|
||||
Binder.getCallingUid());
|
||||
return;
|
||||
}
|
||||
|
||||
if (argsContain(args, "--diag")) {
|
||||
dumpNetworkDiagnostics(pw);
|
||||
return;
|
||||
}
|
||||
|
||||
if (argsContain(args, "apf")) {
|
||||
dumpApf(pw);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1878,6 +1900,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
pw.println();
|
||||
mKeepaliveTracker.dump(pw);
|
||||
|
||||
pw.println();
|
||||
dumpApf(pw);
|
||||
|
||||
if (mInetLog != null && mInetLog.size() > 0) {
|
||||
pw.println();
|
||||
pw.println("Inet condition reports:");
|
||||
|
||||
Reference in New Issue
Block a user