[rdkb][common][hal][Refactor GetInterfaceName]

[Description]
Refactor GetInterfaceName.
1. Use a new function name wifi_GetInterfaceName and remain old method from rdkb, because wifi agent of colgin platform need to use old method.
2. remove dead code.

[Release-log]
N/A

Change-Id: I6d2664ff22b833adfd515ac9bab35d7fc7c312aa
diff --git a/src/wifi/wifi_hal.c b/src/wifi/wifi_hal.c
index 6c462dd..f141d60 100644
--- a/src/wifi/wifi_hal.c
+++ b/src/wifi/wifi_hal.c
@@ -558,7 +558,7 @@
 }
 
 //For Getting Current Interface Name from corresponding hostapd configuration
-static int GetInterfaceName(int apIndex, char *interface_name)
+static int wifi_GetInterfaceName(int apIndex, char *interface_name)
 {
     char config_file[128] = {0};
 
@@ -576,6 +576,14 @@
     return RETURN_OK;
 }
 
+// wifi agent will call this function, do not change the parameter
+void GetInterfaceName(char *interface_name, char *conf_file)
+{
+    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
+    wifi_hostapdRead(conf_file,"interface",interface_name, IF_NAME_SIZE);
+    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
+}
+
 static int wifi_hostapdProcessUpdate(int apIndex, struct params *list, int item_count)
 {
     char interface_name[16] = {0};
@@ -585,7 +593,7 @@
     FILE *fp;
     int i;
     //NOTE RELOAD should be done in ApplySSIDSettings
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     for(i=0; i<item_count; i++, list++)
     {
@@ -614,7 +622,7 @@
     char cmd[MAX_CMD_SIZE]="";
     char buf[MAX_BUF_SIZE]="";
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd), "hostapd_cli -i %s reload", interface_name);
     if (_syscmd(cmd, buf, sizeof(buf)) == RETURN_ERR)
@@ -1035,7 +1043,7 @@
     //macfilter_init();
 
     system("/usr/sbin/iw reg set US");
-    system("systemctl start hostapd.service");
+    // system("systemctl start hostapd.service");
     sleep(2);//sleep to wait for hostapd to start
 
     WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
@@ -1134,7 +1142,7 @@
     if(!output_string || (radioIndex >= MAX_NUM_RADIOS))
         return RETURN_ERR;
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd,"hostapd_cli -i %s status driver | grep country | cut -d '=' -f2", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -1196,7 +1204,7 @@
 
     WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd), "iw %s scan | grep signal | awk '{print $2}' | sort -n | tail -n1", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -1311,7 +1319,7 @@
 	fclose(fp);
     //TODO: check if hostapd with config is running
 	char buf[MAX_BUF_SIZE] = {0}, cmd[MAX_CMD_SIZE] = {0};
-	if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+	if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
 		return RETURN_ERR;
 	sprintf(cmd, "hostapd_cli -i %s status | grep state | cut -d '=' -f2", interface_name);
 	_syscmd(cmd, buf, sizeof(buf));
@@ -1337,7 +1345,7 @@
 
     wifi_getMaxRadioNumber(&max_radio_num);
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     if(enable==FALSE)
     {
@@ -2212,7 +2220,7 @@
     if (NULL == output_string)
         return RETURN_ERR;
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "iw %s info | grep channel | sed -e 's/[^0-9 ]//g'", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -2667,7 +2675,7 @@
     if (radio_enable != TRUE)
         return RETURN_OK;
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd),"iw dev %s info | grep 'width' | cut -d  ' ' -f6", interface_name);
     ret = _syscmd(cmd, buf, sizeof(buf));
@@ -2998,7 +3006,7 @@
     if(output_ulong == NULL)
         return RETURN_ERR;
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd),  "iw %s info | grep txpower | awk '{print $2}' | cut -d '.' -f1 | tr -d '\\n'", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -3024,7 +3032,7 @@
 
     WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd),  "hostapd_cli -i %s status | grep max_txpower | cut -d '=' -f2 | tr -d '\n'", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -3146,7 +3154,7 @@
     if(output == NULL)
         return RETURN_ERR;
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd),  "hostapd_cli -i %s status | grep beacon_int | cut -d '=' -f2 | tr -d '\n'", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -3325,7 +3333,7 @@
 }
 
 //passing the hostapd configuration file and get the virtual interface of xfinity(2g)
-INT GetInterfaceName_virtualInterfaceName_2G(char interface_name[50])
+INT wifi_GetInterfaceName_virtualInterfaceName_2G(char interface_name[50])
 {
     WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n", __func__, __LINE__);
     FILE *fp = NULL;
@@ -3488,7 +3496,7 @@
     if (NULL == output_struct)
         return RETURN_ERR;
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     wifi_getApEnable(radioIndex, &iface_status);
@@ -3717,7 +3725,7 @@
      * after calling setApEnable to false readd all enabled vaps */
     for(int i=0; i < MAX_APS/max_radio_num; i++) {
         apIndex = max_radio_num*i+radioIndex;
-        if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+        if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
             return RETURN_ERR;
         snprintf(cmd, sizeof(cmd), "cat %s | grep %s | cut -d'=' -f2", VAP_STATUS_FILE, interface_name);
         _syscmd(cmd, buf, sizeof(buf));
@@ -3744,7 +3752,7 @@
     ssize_t read = 0;
     int tmp = 0, arr_index = -1;
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "iw dev %s survey dump | grep 'frequency\\|noise' | awk '{print $2}'", interface_name);
 
@@ -3795,7 +3803,7 @@
 
     WIFI_ENTRY_EXIT_DEBUG("Inside %s: %d\n", __func__, __LINE__);
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     snprintf(file_name, sizeof(file_name), "%s%d.txt", ESSID_FILE, radioIndex);
@@ -4010,7 +4018,7 @@
     if (NULL == output_struct)
         return RETURN_ERR;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     memset(output_struct, 0, sizeof(wifi_basicTrafficStats_t));
@@ -4059,11 +4067,11 @@
     {
         if(apIndex == 0) //private_wifi for 2.4G
         {
-            GetInterfaceName(interface_name,"/nvram/hostapd0.conf");
+            wifi_GetInterfaceName(interface_name,"/nvram/hostapd0.conf");
         }
         else if(apIndex == 1) //private_wifi for 5G
         {
-            GetInterfaceName(interface_name,"/nvram/hostapd1.conf");
+            wifi_GetInterfaceName(interface_name,"/nvram/hostapd1.conf");
         }
         else if(apIndex == 4) //public_wifi for 2.4G
         {
@@ -4073,13 +4081,13 @@
                 return RETURN_ERR;
             }
             if(buf[0] == '#')//tp-link
-                GetInterfaceName(interface_name,"/nvram/hostapd4.conf");
+                wifi_GetInterfaceName(interface_name,"/nvram/hostapd4.conf");
             else//tenda
-                GetInterfaceName_virtualInterfaceName_2G(interface_name);
+                wifi_GetInterfaceName_virtualInterfaceName_2G(interface_name);
         }
         else if(apIndex == 5) //public_wifi for 5G
         {
-            GetInterfaceName(interface_name,"/nvram/hostapd5.conf");
+            wifi_GetInterfaceName(interface_name,"/nvram/hostapd5.conf");
         }
 
         GetIfacestatus(interface_name, interface_status);
@@ -4139,7 +4147,7 @@
 
     memset(output_struct, 0, sizeof(wifi_trafficStats_t));
 
-    if (GetInterfaceName(apIndex,interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex,interface_name) != RETURN_OK)
         return RETURN_ERR;
     GetIfacestatus(interface_name, interface_status);
 
@@ -4333,7 +4341,7 @@
     wifi_device_info_t info = {0};
     info.wifi_devIndex = devIndex;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     snprintf(if_name,sizeof(if_name),"%s", interface_name);
@@ -4389,7 +4397,7 @@
     char interface_name[16] = {0};
     int count = 0, device = 0;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     snprintf(if_name,sizeof(if_name),"%s", interface_name);
@@ -4641,7 +4649,7 @@
 
     WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "mt76-vendor %s set ap_wireless amsdu=%d", interface_name, amsduEnable);
     _syscmd(cmd, buf, sizeof(buf));
@@ -4844,7 +4852,7 @@
     if (strncmp(buf, "1", 1) == 0)
         bridge = TRUE;
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd),  "cat /sys/devices/virtual/net/%s/brif/%s/multicast_to_unicast", BRIDGE_NAME, interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -4874,7 +4882,7 @@
     wifi_getMaxRadioNumber(&max_num_radios);
     // mac80211
     for (int i = 0; i < max_num_radios; i++) {
-        if (GetInterfaceName(i, interface_name) != RETURN_OK)
+        if (wifi_GetInterfaceName(i, interface_name) != RETURN_OK)
             return RETURN_ERR;
         snprintf(cmd, sizeof(cmd),  "echo %d > /sys/devices/virtual/net/%s/brif/%s/multicast_to_unicast", enable, BRIDGE_NAME, interface_name);
         _syscmd(cmd, buf, sizeof(buf));
@@ -4911,7 +4919,7 @@
     if (NULL == essid)
         return RETURN_ERR;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     phyId = radio_index_to_phy(radioIndex);
@@ -4936,7 +4944,7 @@
     char buf[1024];
     char cmd[128];
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd,sizeof(cmd),  "wlanconfig %s destroy", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -4953,7 +4961,7 @@
     if(NULL == output_string)
         return RETURN_ERR;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         snprintf(output_string, 16, "%s%d", AP_PREFIX, apIndex);    // For wifiagent generating data model.
     else
         snprintf(output_string, 16, "%s", interface_name);
@@ -4966,20 +4974,15 @@
     char cmd [128] = {0};
     char buf[32] = {0};
     char *apIndex_str = NULL;
-    INT apIndex = 0;
     bool enable = FALSE;
 
     snprintf(cmd, sizeof(cmd), "grep -rn ^interface=%s$ /nvram/hostapd*.conf | cut -d '.' -f1 | cut -d 'd' -f2 | tr -d '\\n'", inputSsidString);
     _syscmd(cmd, buf, sizeof(buf));
 
-    apIndex_str = strtok(buf, "\n");
-    while (apIndex_str != NULL) {
-        apIndex = strtoul(apIndex_str, NULL, 10);
-        if (enable == TRUE) {
-            *output_int = apIndex;
-            return RETURN_OK;
-        }
-        apIndex_str = strtok(NULL, "\n");
+    if (strlen(buf) != 0) {
+        apIndex_str = strtok(buf, "\n");
+        *output_int = strtoul(apIndex_str, NULL, 10);
+        return RETURN_OK;
     }
 
     // If interface name is not in hostapd config, the caller maybe wifi agent to generate data model.
@@ -5096,7 +5099,7 @@
         return RETURN_ERR;
     }
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(config_file, sizeof(config_file), "%s.conf", interface_name);
     snprintf(buf, sizeof(buf), "%u", threshold);
@@ -5346,7 +5349,7 @@
         return RETURN_OK;
 
     //sprintf(cmd, "iw dev %s station dump | grep Station | wc -l", interface_name);//alternate method
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "hostapd_cli -i %s list_sta | wc -l", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -5361,7 +5364,7 @@
     char interface_name[16] = {0};
     char buf[126]={'\0'};
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(buf,"hostapd_cli -i%s disassociate %s", interface_name, client_mac);
     system(buf);
@@ -5394,7 +5397,7 @@
     char cmd[MAX_CMD_SIZE]={'\0'};
     int ret = 0;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "hostapd_cli -i %s accept_acl SHOW | awk '{print $1}'", interface_name);
     ret = _syscmd(cmd,macArray,buf_size);
@@ -5410,7 +5413,7 @@
     char cmd[MAX_CMD_SIZE]={'\0'};
     int ret = 0;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "hostapd_cli -i %s deny_acl SHOW | awk '{print $1}'", interface_name);
     ret = _syscmd(cmd,macArray,buf_size);
@@ -5429,7 +5432,7 @@
 
     if(apIndex > 3) //Currently supporting apIndex upto 3
         return RETURN_ERR;
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "hostapd_cli -i %s list_sta", interface_name);
     //sprintf(buf,"iw dev %s station dump | grep Station  | cut -d ' ' -f2", interface_name);//alternate method
@@ -5656,7 +5659,7 @@
         list[0].value = buf;
 
         char cmd[128], rtn[128];
-        if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+        if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
             return RETURN_ERR;
         snprintf(cmd, sizeof(cmd), "hostapd_cli -i %s deny_acl CLEAR", interface_name);
         _syscmd(cmd, rtn, sizeof(rtn));
@@ -5876,7 +5879,7 @@
     if (enable == status)
         return RETURN_OK;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     if (enable == TRUE) {
@@ -5916,7 +5919,7 @@
 
     if((apIndex >= 0) && (apIndex < MAX_APS))//Handling 6 APs
     {
-        if (GetInterfaceName(apIndex, interface_name) != RETURN_OK) {
+        if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK) {
             *output_bool = FALSE;
             return RETURN_OK;
         }
@@ -6154,7 +6157,7 @@
     fprintf(f, "%hu", bitmap);
     fclose(f);
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd), "iw dev %s set noack_map 0x%04x\n", interface_name, bitmap);
     _syscmd(cmd, buf, sizeof(buf));
@@ -6787,7 +6790,7 @@
     char buf[MAX_BUF_SIZE] = {0}, cmd[MAX_CMD_SIZE] = {0}, *value;
     if(!output_bool)
         return RETURN_ERR;
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd,"hostapd_cli -i %s get_config | grep wps_state | cut -d '=' -f2", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -6945,7 +6948,7 @@
         return RETURN_ERR;
     WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
     snprintf(output_string, 32, "Not configured");
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd), "hostapd_cli -i %s get_config | grep wps_state | cut -d'=' -f2", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -6972,7 +6975,7 @@
     if (!enable)
         return RETURN_ERR;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, 64, "hostapd_cli -i%s wps_pin any %s", interface_name, pin);
     _syscmd(cmd, buf, sizeof(buf));
@@ -6998,7 +7001,7 @@
     if (!enable)
         return RETURN_ERR;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     snprintf(cmd, sizeof(cmd), "hostapd_cli -i%s wps_cancel; hostapd_cli -i%s wps_pbc", interface_name, interface_name);
@@ -7016,7 +7019,7 @@
     char cmd[MAX_CMD_SIZE];
     char buf[MAX_BUF_SIZE]={0};
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd), "hostapd_cli -i%s wps_cancel", interface_name);
     _syscmd(cmd,buf, sizeof(buf));
@@ -7041,7 +7044,7 @@
 
     WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
     *associated_dev_array = NULL;
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "hostapd_cli -i%s all_sta | grep AUTHORIZED | wc -l", interface_name);
     _syscmd(cmd,buf,sizeof(buf));
@@ -7681,7 +7684,7 @@
     {
         sprintf(hostapdconf, "/nvram/hostapd%d.conf", apIndex);
 
-        GetInterfaceName(interface_name, hostapdconf);
+        wifi_GetInterfaceName(interface_name, hostapdconf);
 
         if(strlen(interface_name) > 1)
         {
@@ -7975,7 +7978,7 @@
     char cmd[128];
     char buf[1024];
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd), "ifconfig %s up 2>/dev/null", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -7996,7 +7999,7 @@
     wifi_getApBridgeInfo(apIndex,bridge,ip,subnet);
     wifi_getApVlanID(apIndex,&vlanId);
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd), "cfgVlan %s %s %d %s ", interface_name, bridge, vlanId, ip);
     _syscmd(cmd,buf, sizeof(buf));
@@ -8012,7 +8015,7 @@
     int  apIndex;
 
     apIndex=(radioIndex==0)?0:1;	
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd), "iwconfig %s freq %d",interface_name,channel);
     _syscmd(cmd,buf, sizeof(buf));
@@ -8609,7 +8612,7 @@
 
     snprintf(config_file, sizeof(config_file), "%s%d.conf", CONFIG_PREFIX, radioIndex);
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
@@ -8739,7 +8742,7 @@
         fclose(f);
     }
 
-    if (GetInterfaceName(radio_index, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radio_index, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     phyId = radio_index_to_phy(radio_index);
@@ -8986,7 +8989,7 @@
     if (NULL == output_string)
         return RETURN_ERR;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     snprintf(cmd, sizeof(cmd), "hostapd_cli  -i %s get_config | grep ^ssid | cut -d '=' -f2 | tr -d '\n'", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -9226,7 +9229,7 @@
         return RETURN_ERR;
 
     memset(out, 0, sizeof(wifi_ssidTrafficStats2_t));
-    if (GetInterfaceName(ssidIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(ssidIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(pipeCmd, "cat /proc/net/dev | grep %s", interface_name);
 
@@ -9489,7 +9492,7 @@
     char  if_name[10];
     char interface_name[16] = {0};
 
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     snprintf(if_name, sizeof(if_name), "%s", interface_name);
@@ -9538,7 +9541,7 @@
     int lines,tid_index=0;
     char mac_addr[20] = {'\0'};
 
-    if (GetInterfaceName(radioIndex, if_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, if_name) != RETURN_OK)
         return RETURN_ERR;
 
     wifi_associated_dev_tid_entry_t *stats_entry;
@@ -9615,7 +9618,7 @@
     if (scan_mode != WIFI_RADIO_SCAN_MODE_FULL)
         ieee80211_channel_to_frequency(chan_list[0], &freq);
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     if (freq)
@@ -9788,7 +9791,7 @@
 #ifdef HAL_NETLINK_IMPL
     Netlink nl;
     char if_name[32];
-    if (GetInterfaceName(radioIndex, if_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, if_name) != RETURN_OK)
         return RETURN_ERR;
 
     *output_array_size = sizeof(wifi_associated_dev_rate_info_rx_stats_t);
@@ -9932,7 +9935,7 @@
     Netlink nl;
     char if_name[10];
     char interface_name[16] = {0};
-    if (GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     *output_array_size = sizeof(wifi_associated_dev_rate_info_tx_stats_t);
@@ -10197,7 +10200,7 @@
 
     local[0].array_size = array_size;
 
-    if (GetInterfaceName(radioIndex, if_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(radioIndex, if_name) != RETURN_OK)
         return RETURN_ERR;
 
     nl.id = initSock80211(&nl);
@@ -10816,7 +10819,7 @@
     if(txpwr_pcntg == NULL)
         return RETURN_ERR;
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     // Get the maximum tx power of the device
@@ -11166,7 +11169,7 @@
     char cmd[256];
     char interface_name[16] = {0};
 
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
 
     sprintf(cmd, "hostapd_cli -i %s sta %x:%x:%x:%x:%x:%x |grep '^keyid' | cut -f 2 -d = | tr -d '\n'",
@@ -11208,7 +11211,7 @@
     fclose(fd);
 
     //reload file
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "hostapd_cli -i%s raw RELOAD_WPA_PSK", interface_name);
     _syscmd(cmd, out, 64);
@@ -11296,7 +11299,7 @@
 
     /*rmeove all neighbors*/
     wifi_dbg_printf("\n[%s]: removing all neighbors from %s\n", __func__, interface_name);
-    if (GetInterfaceName(apIndex, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "hostapd_cli show_neighbor -i %s | awk '{print $1 \" \" $2}' | xargs -n2 -r hostapd_cli remove_neighbor -i %s",interface_name,interface_name);
     system(cmd);
@@ -12299,7 +12302,7 @@
     char buf[128] = {0};
 
     *enable = FALSE;
-    if (GetInterfaceName(apIndex, if_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(apIndex, if_name) != RETURN_OK)
         return;
 
     snprintf(cmd, sizeof(cmd), "cat %s | grep ^%s=1", VAP_STATUS_FILE, if_name);
@@ -13050,7 +13053,7 @@
     if (status == FALSE)
         return RETURN_OK;
 
-    if (GetInterfaceName(ap_index, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(ap_index, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "hostapd_cli -i %s list_sta", interface_name);
     _syscmd(cmd, buf, sizeof(buf));
@@ -13082,7 +13085,7 @@
     if (!status)
         return RETURN_OK;
 
-    if (GetInterfaceName(ap_index, interface_name) != RETURN_OK)
+    if (wifi_GetInterfaceName(ap_index, interface_name) != RETURN_OK)
         return RETURN_ERR;
     sprintf(cmd, "hostapd_cli -i %s list_sta | tr '\\n' ',' | sed 's/.$//'", interface_name);
     _syscmd(cmd, output_buf, output_buf_size);