Improve logging when using ingress rate limits

Add some happy path logging that informs about active rate limits.

Test: TreeHugger
Bug: 218840346
Change-Id: Iddd50583ca2e90afe83a5c68611418fa794afb3f
This commit is contained in:
Patrick Rohr 2022-02-10 15:19:31 +01:00
commit 64592df482

View file

@ -1409,6 +1409,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
// converting rateInBytesPerSecond from long to int is safe here because the
// setting's range is limited to INT_MAX.
// TODO: add long/uint64 support to tcFilterAddDevIngressPolice.
Log.i(TAG,
"enableIngressRateLimit on " + iface + ": " + rateInBytesPerSecond + "B/s");
TcUtils.tcFilterAddDevIngressPolice(params.index, TC_PRIO_POLICE, (short) ETH_P_ALL,
(int) rateInBytesPerSecond, TC_POLICE_BPF_PROG_PATH);
} catch (IOException e) {
@ -1430,6 +1432,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
return;
}
try {
Log.i(TAG,
"disableIngressRateLimit on " + iface);
TcUtils.tcFilterDelDev(params.index, true, TC_PRIO_POLICE, (short) ETH_P_ALL);
} catch (IOException e) {
loge("TcUtils.tcFilterDelDev(ifaceIndex=" + params.index