Revert "[wpa_supplicant] Cumulative patch from b8491ae5a"

This reverts commit 878cf7bcbf2d7d8f08c3d060b8c5fbfcf0743eda.

Reason for revert: git_master/sdk_phone_armv7-sdk

Change-Id: I6070fc5c1f9c20867f6dfce90e529e35578d572e
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 8efc08d..198ac56 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -8,10 +8,10 @@
 
 #include "utils/includes.h"
 #ifdef CONFIG_TESTING_OPTIONS
+#include <net/ethernet.h>
 #include <netinet/ip.h>
 #endif /* CONFIG_TESTING_OPTIONS */
 
-#include <net/ethernet.h>
 #include "utils/common.h"
 #include "utils/eloop.h"
 #include "utils/uuid.h"
@@ -3129,49 +3129,6 @@
 	return wpas_mesh_peer_add(wpa_s, addr, duration);
 }
 
-
-static int wpa_supplicant_ctrl_iface_mesh_link_probe(
-	struct wpa_supplicant *wpa_s, char *cmd)
-{
-	struct ether_header *eth;
-	u8 addr[ETH_ALEN];
-	u8 *buf;
-	char *pos;
-	size_t payload_len = 0, len;
-	int ret = -1;
-
-	if (hwaddr_aton(cmd, addr))
-		return -1;
-
-	pos = os_strstr(cmd, " payload=");
-	if (pos) {
-		pos = pos + 9;
-		payload_len = os_strlen(pos);
-		if (payload_len & 1)
-			return -1;
-
-		payload_len /= 2;
-	}
-
-	len = ETH_HLEN + payload_len;
-	buf = os_malloc(len);
-	if (!buf)
-		return -1;
-
-	eth = (struct ether_header *) buf;
-	os_memcpy(eth->ether_dhost, addr, ETH_ALEN);
-	os_memcpy(eth->ether_shost, wpa_s->own_addr, ETH_ALEN);
-	eth->ether_type = htons(ETH_P_802_3);
-
-	if (payload_len && hexstr2bin(pos, buf + ETH_HLEN, payload_len) < 0)
-		goto fail;
-
-	ret = wpa_drv_mesh_link_probe(wpa_s, addr, buf, len);
-fail:
-	os_free(buf);
-	return -ret;
-}
-
 #endif /* CONFIG_MESH */
 
 
@@ -5591,17 +5548,17 @@
 	if (freq2 < 0)
 		return -1;
 	if (freq2)
-		return CHANWIDTH_80P80MHZ;
+		return VHT_CHANWIDTH_80P80MHZ;
 
 	switch (chwidth) {
 	case 0:
 	case 20:
 	case 40:
-		return CHANWIDTH_USE_HT;
+		return VHT_CHANWIDTH_USE_HT;
 	case 80:
-		return CHANWIDTH_80MHZ;
+		return VHT_CHANWIDTH_80MHZ;
 	case 160:
-		return CHANWIDTH_160MHZ;
+		return VHT_CHANWIDTH_160MHZ;
 	default:
 		wpa_printf(MSG_DEBUG, "Unknown max oper bandwidth: %d",
 			   chwidth);
@@ -9626,10 +9583,59 @@
 		return -1;
 	}
 
-	if (!enable)
-		return wpas_disable_mac_addr_randomization(wpa_s, type);
+	if (!enable) {
+		wpas_mac_addr_rand_scan_clear(wpa_s, type);
+		if (wpa_s->pno) {
+			if (type & MAC_ADDR_RAND_PNO) {
+				wpas_stop_pno(wpa_s);
+				wpas_start_pno(wpa_s);
+			}
+		} else if (wpa_s->sched_scanning &&
+			   (type & MAC_ADDR_RAND_SCHED_SCAN)) {
+			wpas_scan_restart_sched_scan(wpa_s);
+		}
+		return 0;
+	}
 
-	return wpas_enable_mac_addr_randomization(wpa_s, type, addr, mask);
+	if ((addr && !mask) || (!addr && mask)) {
+		wpa_printf(MSG_INFO,
+			   "CTRL: MAC_RAND_SCAN invalid addr/mask combination");
+		return -1;
+	}
+
+	if (addr && mask && (!(mask[0] & 0x01) || (addr[0] & 0x01))) {
+		wpa_printf(MSG_INFO,
+			   "CTRL: MAC_RAND_SCAN cannot allow multicast address");
+		return -1;
+	}
+
+	if (type & MAC_ADDR_RAND_SCAN) {
+		if (wpas_mac_addr_rand_scan_set(wpa_s, MAC_ADDR_RAND_SCAN,
+					    addr, mask))
+			return -1;
+	}
+
+	if (type & MAC_ADDR_RAND_SCHED_SCAN) {
+		if (wpas_mac_addr_rand_scan_set(wpa_s, MAC_ADDR_RAND_SCHED_SCAN,
+					    addr, mask))
+			return -1;
+
+		if (wpa_s->sched_scanning && !wpa_s->pno)
+			wpas_scan_restart_sched_scan(wpa_s);
+	}
+
+	if (type & MAC_ADDR_RAND_PNO) {
+		if (wpas_mac_addr_rand_scan_set(wpa_s, MAC_ADDR_RAND_PNO,
+					    addr, mask))
+			return -1;
+
+		if (wpa_s->pno) {
+			wpas_stop_pno(wpa_s);
+			wpas_start_pno(wpa_s);
+		}
+	}
+
+	return 0;
 }
 
 
@@ -10165,9 +10171,6 @@
 	} else if (os_strncmp(buf, "MESH_PEER_ADD ", 14) == 0) {
 		if (wpa_supplicant_ctrl_iface_mesh_peer_add(wpa_s, buf + 14))
 			reply_len = -1;
-	} else if (os_strncmp(buf, "MESH_LINK_PROBE ", 16) == 0) {
-		if (wpa_supplicant_ctrl_iface_mesh_link_probe(wpa_s, buf + 16))
-			reply_len = -1;
 #endif /* CONFIG_MESH */
 #ifdef CONFIG_P2P
 	} else if (os_strncmp(buf, "P2P_FIND ", 9) == 0) {
@@ -10742,16 +10745,6 @@
 	} else if (os_strncmp(buf, "DPP_PKEX_REMOVE ", 16) == 0) {
 		if (wpas_dpp_pkex_remove(wpa_s, buf + 16) < 0)
 			reply_len = -1;
-#ifdef CONFIG_DPP2
-	} else if (os_strncmp(buf, "DPP_CONTROLLER_START ", 21) == 0) {
-		if (wpas_dpp_controller_start(wpa_s, buf + 20) < 0)
-			reply_len = -1;
-	} else if (os_strcmp(buf, "DPP_CONTROLLER_START") == 0) {
-		if (wpas_dpp_controller_start(wpa_s, NULL) < 0)
-			reply_len = -1;
-	} else if (os_strcmp(buf, "DPP_CONTROLLER_STOP") == 0) {
-		dpp_controller_stop(wpa_s->dpp);
-#endif /* CONFIG_DPP2 */
 #endif /* CONFIG_DPP */
 	} else {
 		os_memcpy(reply, "UNKNOWN COMMAND\n", 16);