Merge "IPACM: fix downstream iface list add/del issue"
diff --git a/ipacm/inc/IPACM_OffloadManager.h b/ipacm/inc/IPACM_OffloadManager.h
index 72070dd..bade0aa 100644
--- a/ipacm/inc/IPACM_OffloadManager.h
+++ b/ipacm/inc/IPACM_OffloadManager.h
@@ -96,7 +96,7 @@
 
 private:
 
-	std::list<const char *> valid_ifaces;
+	std::list<std::string> valid_ifaces;
 
 	bool upstream_v4_up;
 
diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp
index 32606b9..616cf70 100644
--- a/ipacm/src/IPACM_OffloadManager.cpp
+++ b/ipacm/src/IPACM_OffloadManager.cpp
@@ -213,6 +213,14 @@
 		return FAIL_INPUT_CHECK;
 	}
 
+	/* Iface is valid, add to list if not present */
+	if (std::find(valid_ifaces.begin(), valid_ifaces.end(), std::string(downstream_name)) == valid_ifaces.end())
+	{
+		/* Iface is new, add it to the list */
+		valid_ifaces.push_back(downstream_name);
+		IPACMDBG_H("add iface(%s) to list\n", downstream_name);
+	}
+
 	/* check if downstream netdev driver finished its configuration on IPA-HW */
 	if (IPACM_Iface::ipacmcfg->CheckNatIfaces(downstream_name))
 	{
@@ -263,13 +271,6 @@
 		return SUCCESS;
 	}
 
-	/* Iface is valid, add to list if not present */
-	if (std::find(valid_ifaces.begin(), valid_ifaces.end(), downstream_name) == valid_ifaces.end())
-	{
-		/* Iface is new, add it to the list */
-		valid_ifaces.push_back(downstream_name);
-	}
-
 	evt_data = (ipacm_event_ipahal_stream*)malloc(sizeof(ipacm_event_ipahal_stream));
 	if(evt_data == NULL)
 	{
@@ -303,7 +304,7 @@
 		IPACMERR("iface length is 0.\n");
 		return FAIL_HARDWARE;
 	}
-	if (std::find(valid_ifaces.begin(), valid_ifaces.end(), downstream_name) == valid_ifaces.end())
+	if (std::find(valid_ifaces.begin(), valid_ifaces.end(), std::string(downstream_name)) == valid_ifaces.end())
 	{
 		IPACMERR("iface is not present in list.\n");
 		return FAIL_HARDWARE;
@@ -508,6 +509,7 @@
 	upstream_v6_up = false;
 	memset(event_cache, 0, MAX_EVENT_CACHE*sizeof(framework_event_cache));
 	latest_cache_index = 0;
+	valid_ifaces.clear();
 	return result;
 }