Do not enable ingress rate limit until clsact qdisc exists

The tc police filter attaches to the clsact qdisc, so the rate limit
cannot be enabled before the qdisc is added to the interface.
The clsact qdisc is added as part of INetd#networkAddInterface, which is
called from inside updateLinkProperties.

Test: atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I0713605ff3684f8271eb3f0e29ab7116561963f1
This commit is contained in:
Patrick Rohr
2022-03-02 15:14:07 +01:00
parent 8039c85336
commit f1fe8ee928
2 changed files with 19 additions and 14 deletions

View File

@@ -1998,6 +1998,13 @@ public class ConnectivityServiceTest {
// updated. Check that this happened.
assertEquals(-1L, (long) mActiveRateLimit.getOrDefault(iface, -1L));
mActiveRateLimit.put(iface, rateInBytesPerSecond);
// verify that clsact qdisc has already been created, otherwise attaching a tc police
// filter will fail.
try {
verify(mMockNetd).networkAddInterface(anyInt(), eq(iface));
} catch (RemoteException e) {
fail(e.getMessage());
}
}
@Override