Revert "[wpa_supplicant] Cumulative patch from c4e90da6d"

This reverts commit 39bc25d3a79c1375de430a7918d949c1a86f70c6.

Test: Compilation
Change-Id: Iae7670429466958911b5296cb1359bceecc0b03e
Exempt-From-Owner-Approval: Revert since it's breaking the build
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 9881021..05e3ebf 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant - command line interface for wpa_supplicant daemon
- * Copyright (c) 2004-2019, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2017, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -29,7 +29,7 @@
 
 static const char *const wpa_cli_version =
 "wpa_cli v" VERSION_STR "\n"
-"Copyright (c) 2004-2019, Jouni Malinen <j@w1.fi> and contributors";
+"Copyright (c) 2004-2017, Jouni Malinen <j@w1.fi> and contributors";
 
 #define VENDOR_ELEM_FRAME_ID \
 	"  0: Probe Req (P2P), 1: Probe Resp (P2P) , 2: Probe Resp (GO), " \
@@ -49,7 +49,6 @@
 static const char *ctrl_iface_dir = CONFIG_CTRL_IFACE_DIR;
 static const char *client_socket_dir = NULL;
 static char *ctrl_ifname = NULL;
-static const char *global = NULL;
 static const char *pid_file = NULL;
 static const char *action_file = NULL;
 static int ping_interval = 5;
@@ -75,7 +74,6 @@
 static void update_creds(struct wpa_ctrl *ctrl);
 static void update_networks(struct wpa_ctrl *ctrl);
 static void update_stations(struct wpa_ctrl *ctrl);
-static void update_ifnames(struct wpa_ctrl *ctrl);
 
 
 static void usage(void)
@@ -1205,39 +1203,6 @@
 }
 
 
-static int wpa_cli_cmd_psk_passphrase(struct wpa_ctrl *ctrl, int argc,
-				      char *argv[])
-{
-	char cmd[256], *pos, *end;
-	int i, ret;
-
-	if (argc < 2) {
-		printf("Invalid PSK_PASSPHRASE command: needs two arguments (network id and PSK/passphrase)\n");
-		return -1;
-	}
-
-	end = cmd + sizeof(cmd);
-	pos = cmd;
-	ret = os_snprintf(pos, end - pos, WPA_CTRL_RSP "PSK_PASSPHRASE-%s:%s",
-			  argv[0], argv[1]);
-	if (os_snprintf_error(end - pos, ret)) {
-		printf("Too long PSK_PASSPHRASE command.\n");
-		return -1;
-	}
-	pos += ret;
-	for (i = 2; i < argc; i++) {
-		ret = os_snprintf(pos, end - pos, " %s", argv[i]);
-		if (os_snprintf_error(end - pos, ret)) {
-			printf("Too long PSK_PASSPHRASE command.\n");
-			return -1;
-		}
-		pos += ret;
-	}
-
-	return wpa_ctrl_command(ctrl, cmd);
-}
-
-
 static int wpa_cli_cmd_passphrase(struct wpa_ctrl *ctrl, int argc,
 				  char *argv[])
 {
@@ -1447,7 +1412,7 @@
 #ifdef CONFIG_HT_OVERRIDES
 	"disable_ht", "disable_ht40", "disable_sgi", "disable_ldpc",
 	"ht40_intolerant", "disable_max_amsdu", "ampdu_factor",
-	"ampdu_density", "ht_mcs", "rx_stbc", "tx_stbc",
+	"ampdu_density", "ht_mcs",
 #endif /* CONFIG_HT_OVERRIDES */
 #ifdef CONFIG_VHT_OVERRIDES
 	"disable_vht", "vht_capa", "vht_capa_mask", "vht_rx_mcs_nss_1",
@@ -1461,8 +1426,6 @@
 #ifdef CONFIG_MACSEC
 	"macsec_policy",
 	"macsec_integ_only",
-	"macsec_replay_protect",
-	"macsec_replay_window",
 	"macsec_port",
 	"mka_priority",
 #endif /* CONFIG_MACSEC */
@@ -2992,13 +2955,6 @@
 }
 
 
-static int wpa_cli_cmd_dpp_configurator_sign(struct wpa_ctrl *ctrl, int argc,
-					     char *argv[])
-{
-	return wpa_cli_cmd(ctrl, "DPP_CONFIGURATOR_SIGN", 1, argc, argv);
-}
-
-
 static int wpa_cli_cmd_dpp_pkex_add(struct wpa_ctrl *ctrl, int argc,
 				    char *argv[])
 {
@@ -3128,9 +3084,6 @@
 	  cli_cmd_flag_sensitive,
 	  "<network id> <password> = configure one-time-password for an SSID"
 	},
-	{ "psk_passphrase", wpa_cli_cmd_psk_passphrase,
-	  wpa_cli_complete_network_id, cli_cmd_flag_sensitive,
-	  "<network id> <PSK/passphrase> = configure PSK/passphrase for an SSID" },
 	{ "passphrase", wpa_cli_cmd_passphrase, wpa_cli_complete_network_id,
 	  cli_cmd_flag_sensitive,
 	  "<network id> <passphrase> = configure private key passphrase\n"
@@ -3661,9 +3614,6 @@
 	{ "dpp_configurator_get_key", wpa_cli_cmd_dpp_configurator_get_key,
 	  NULL, cli_cmd_flag_none,
 	  "<id> = Get DPP configurator's private key" },
-	{ "dpp_configurator_sign", wpa_cli_cmd_dpp_configurator_sign, NULL,
-	  cli_cmd_flag_none,
-	  "conf=<role> configurator=<id> = generate self DPP configuration" },
 	{ "dpp_pkex_add", wpa_cli_cmd_dpp_pkex_add, NULL,
 	  cli_cmd_flag_sensitive,
 	  "add PKEX code" },
@@ -4022,46 +3972,10 @@
 #endif /* CONFIG_ANSI_C_EXTRA */
 
 
-static int wpa_cli_open_global_ctrl(void)
-{
-#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE
-	ctrl_conn = wpa_ctrl_open(NULL);
-#else /* CONFIG_CTRL_IFACE_NAMED_PIPE */
-	ctrl_conn = wpa_ctrl_open(global);
-#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
-	if (!ctrl_conn) {
-		fprintf(stderr,
-			"Failed to connect to wpa_supplicant global interface: %s  error: %s\n",
-			global, strerror(errno));
-		return -1;
-	}
-
-	if (interactive) {
-		update_ifnames(ctrl_conn);
-		mon_conn = wpa_ctrl_open(global);
-		if (mon_conn) {
-			if (wpa_ctrl_attach(mon_conn) == 0) {
-				wpa_cli_attached = 1;
-				eloop_register_read_sock(
-					wpa_ctrl_get_fd(mon_conn),
-					wpa_cli_mon_receive,
-					NULL, NULL);
-			} else {
-				printf("Failed to open monitor connection through global control interface\n");
-			}
-		}
-		update_stations(ctrl_conn);
-	}
-
-	return 0;
-}
-
-
 static void wpa_cli_reconnect(void)
 {
 	wpa_cli_close_connection();
-	if ((global && wpa_cli_open_global_ctrl() < 0) ||
-	    (!global && wpa_cli_open_connection(ctrl_ifname, 1) < 0))
+	if (wpa_cli_open_connection(ctrl_ifname, 1) < 0)
 		return;
 
 	if (interactive) {
@@ -4620,6 +4534,7 @@
 	int c;
 	int daemonize = 0;
 	int ret = 0;
+	const char *global = NULL;
 
 	if (os_program_init())
 		return -1;
@@ -4674,8 +4589,38 @@
 	if (eloop_init())
 		return -1;
 
-	if (global && wpa_cli_open_global_ctrl() < 0)
-		return -1;
+	if (global) {
+#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE
+		ctrl_conn = wpa_ctrl_open(NULL);
+#else /* CONFIG_CTRL_IFACE_NAMED_PIPE */
+		ctrl_conn = wpa_ctrl_open(global);
+#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
+		if (ctrl_conn == NULL) {
+			fprintf(stderr, "Failed to connect to wpa_supplicant "
+				"global interface: %s  error: %s\n",
+				global, strerror(errno));
+			return -1;
+		}
+
+		if (interactive) {
+			update_ifnames(ctrl_conn);
+			mon_conn = wpa_ctrl_open(global);
+			if (mon_conn) {
+				if (wpa_ctrl_attach(mon_conn) == 0) {
+					wpa_cli_attached = 1;
+					eloop_register_read_sock(
+						wpa_ctrl_get_fd(mon_conn),
+						wpa_cli_mon_receive,
+						NULL, NULL);
+				} else {
+					printf("Failed to open monitor "
+					       "connection through global "
+					       "control interface\n");
+				}
+			}
+			update_stations(ctrl_conn);
+		}
+	}
 
 	eloop_register_signal_terminate(wpa_cli_terminate, NULL);