ipacm:clear event cache if ipacm receives stopOffload
Currently if NAT iface is not added, IPACM cache setupstream
events but default gw index will be set only after adding
NAT iface. If IPACM receives stopOffload in between, then
it is returning input check error to framework. Add check and
clear event cache in case of stopOffload.
Change-Id: I1e49a37bfba64458f8966c9894bf48f749f0bbd7
diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp
index c0378de..5efe20f 100644
--- a/ipacm/src/IPACM_OffloadManager.cpp
+++ b/ipacm/src/IPACM_OffloadManager.cpp
@@ -366,6 +366,14 @@
if(upstream_name == NULL)
{
if (default_gw_index == INVALID_IFACE) {
+ for (index = 0; index < MAX_EVENT_CACHE; index++) {
+ if (event_cache[index].valid == true &&
+ event_cache[index ].event == IPA_WAN_UPSTREAM_ROUTE_ADD_EVENT) {
+ event_cache[index].valid = false;
+ memset(event_cache, 0, MAX_EVENT_CACHE*sizeof(framework_event_cache));
+ return SUCCESS;
+ }
+ }
IPACMERR("no previous upstream set before\n");
return FAIL_INPUT_CHECK;
}