ipacm: fix the VTS error
On VTS IPACM_HAL unit-test, since wlan
tethering devive won't up, therefore the
addDownsream events are all cached in
IPACM_HAL and keep accumulated until
reaching IPACM's max cached and seeing
test-case starts failing. The fix is
to clean up the cache on Stopoffload.
Bug: 65612227
Change-Id: I24f410f5c5ae3a6cad0e14293f266b067f643389
diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp
index c923e2d..762b56d 100644
--- a/ipacm/src/IPACM_OffloadManager.cpp
+++ b/ipacm/src/IPACM_OffloadManager.cpp
@@ -477,12 +477,22 @@
RET IPACM_OffloadManager::stopAllOffload()
{
Prefix v4gw, v6gw;
+ RET result = SUCCESS;
+
memset(&v4gw, 0, sizeof(v4gw));
memset(&v6gw, 0, sizeof(v6gw));
v4gw.fam = V4;
v6gw.fam = V6;
IPACMDBG_H("posting setUpstream(NULL), ipv4-fam(%d) ipv6-fam(%d)\n", v4gw.fam, v6gw.fam);
- return setUpstream(NULL, v4gw, v6gw);
+ result = setUpstream(NULL, v4gw, v6gw);
+
+ /* reset the event cache */
+ default_gw_index = INVALID_IFACE;
+ upstream_v4_up = false;
+ upstream_v6_up = false;
+ memset(event_cache, 0, MAX_EVENT_CACHE*sizeof(framework_event_cache));
+ latest_cache_index = 0;
+ return result;
}
RET IPACM_OffloadManager::setQuota(const char * upstream_name /* upstream */, uint64_t mb/* limit */)