sta_associate: Add channel argument to speed up the process

This is not officially defined in the CAPI spec, but for testing
purposes, it can be significantly faster to skip the full scan for each
association. If the channel argument is present, wpa_supplicant is
requested to use a single channel scan.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
diff --git a/sta.c b/sta.c
index 7ab055f..6d68505 100644
--- a/sta.c
+++ b/sta.c
@@ -2248,8 +2248,9 @@
 	const char *ssid = get_param(cmd, "ssid");
 	const char *wps_param = get_param(cmd, "WPS");
 	const char *bssid = get_param(cmd, "bssid");
+	const char *chan = get_param(cmd, "channel");
 	int wps = 0;
-	char buf[100];
+	char buf[100], extra[50];
 
 	if (ssid == NULL)
 		return -1;
@@ -2290,8 +2291,12 @@
 			return 0;
 		}
 
-		snprintf(buf, sizeof(buf), "SELECT_NETWORK %d",
-			 dut->infra_network_id);
+		extra[0] = '\0';
+		if (chan)
+			snprintf(extra, sizeof(extra), " freq=%u",
+				 channel_to_freq(atoi(chan)));
+		snprintf(buf, sizeof(buf), "SELECT_NETWORK %d%s",
+			 dut->infra_network_id, extra);
 		if (wpa_command(get_station_ifname(), buf) < 0) {
 			sigma_dut_print(dut, DUT_MSG_INFO, "Failed to select "
 					"network id %d on %s",