Add pointer to struct sigma_dut to get-ifname helper functions

This is needed to allow more dynamic generation of the interface name
for dual-radio cases.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
diff --git a/ap.c b/ap.c
index c4ce084..feb08d9 100644
--- a/ap.c
+++ b/ap.c
@@ -387,7 +387,7 @@
 {
 	char command[1000];
 	const char *bin;
-	enum driver_type drv = get_driver_type();
+	enum driver_type drv = get_driver_type(dut);
 	char *sigma_hapd_file = sigma_hapd_ctrl;
 
 	if (file_exists("hostapd_cli"))
@@ -447,7 +447,7 @@
 	if (dut->ap_countrycode[0]) {
 		snprintf(buf, sizeof(buf), "DRIVER COUNTRY %s",
 			 dut->ap_countrycode);
-		if (wpa_command(get_station_ifname(), buf) < 0)
+		if (wpa_command(get_station_ifname(dut), buf) < 0)
 			sigma_dut_print(dut, DUT_MSG_ERROR,
 					"Failed to set country code");
 		else
@@ -467,7 +467,7 @@
 	/* const char *ifname = get_param(cmd, "INTERFACE"); */
 	const char *val;
 	unsigned int wlan_tag = 1;
-	char *ifname = get_main_ifname();
+	const char *ifname = get_main_ifname(dut);
 	char buf[128];
 
 	/* Allow program to be overridden if specified in the ap_set_wireless
@@ -517,7 +517,7 @@
 		 * where wpa_supplicant is running on the device as well for
 		 * non-AP mode functionality.
 		 */
-		if (get_driver_type() == DRIVER_LINUX_WCN)
+		if (get_driver_type(dut) == DRIVER_LINUX_WCN)
 			set_ap_country_code(dut);
 	}
 
@@ -670,7 +670,7 @@
 
 	val = get_param(cmd, "RADIO");
 	if (val) {
-		enum driver_type drv = get_driver_type();
+		enum driver_type drv = get_driver_type(dut);
 
 		if (strcasecmp(val, "on") == 0) {
 			if (drv == DRIVER_OPENWRT)
@@ -988,7 +988,7 @@
 
 	val = get_param(cmd, "DYN_BW_SGNL");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_OPENWRT:
 			switch (get_openwrt_driver_type()) {
 			case OPENWRT_DRIVER_ATHEROS:
@@ -1056,7 +1056,7 @@
 
 	val = get_param(cmd, "RTS_FORCE");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_OPENWRT:
 			switch (get_openwrt_driver_type()) {
 			case OPENWRT_DRIVER_ATHEROS:
@@ -1077,7 +1077,7 @@
 
 	val = get_param(cmd, "Zero_crc");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_ATHEROS:
 			ath_set_zero_crc(dut, val);
 			break;
@@ -1125,7 +1125,7 @@
 
 	val = get_param(cmd, "GROUP_ID");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_OPENWRT:
 			switch (get_openwrt_driver_type()) {
 			case OPENWRT_DRIVER_ATHEROS:
@@ -1146,7 +1146,7 @@
 
 	val = get_param(cmd, "CTS_WIDTH");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_OPENWRT:
 			switch (get_openwrt_driver_type()) {
 			case OPENWRT_DRIVER_ATHEROS:
@@ -1532,7 +1532,7 @@
 		sigma_dut_print(dut, DUT_MSG_DEBUG,
 				"Setting amsdu_size to %d", mtu);
 		snprintf(buf, sizeof(buf), "ifconfig %s mtu %d",
-			 get_station_ifname(), mtu);
+			 get_station_ifname(dut), mtu);
 
 		if (system(buf) != 0) {
 			sigma_dut_print(dut, DUT_MSG_ERROR, "Failed to set %s",
@@ -1773,11 +1773,11 @@
 				 struct sigma_cmd *cmd)
 {
 	const char *val;
-	char *ifname;
+	const char *ifname;
 	char buf[256];
 	int tid = 0;
 
-	ifname = get_main_ifname();
+	ifname = get_main_ifname(dut);
 	val = get_param(cmd, "TID");
 	if (val) {
 		tid = atoi(val);
@@ -1889,7 +1889,7 @@
 	/* const char *ifname = get_param(cmd, "INTERFACE"); */
 	struct stat s;
 
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_ATHEROS:
 		return ath_ap_send_addba_req(dut, conn, cmd);
 #ifdef __linux__
@@ -2630,7 +2630,7 @@
 	}
 
 	if (dut->ap_oce == VALUE_ENABLED &&
-	    get_driver_type() == DRIVER_OPENWRT)
+	    get_driver_type(dut) == DRIVER_OPENWRT)
 		owrt_ap_set_radio(dut, radio_id[0], "bcnburst", "1");
 
 	if (dut->ap_mbssid == VALUE_ENABLED)
@@ -3020,7 +3020,7 @@
 	const char *ifname;
 	enum driver_type drv;
 
-	drv = get_driver_type();
+	drv = get_driver_type(dut);
 	if (dut->hostapd_ifname && if_nametoindex(dut->hostapd_ifname) > 0) {
 		ifname = dut->hostapd_ifname;
 	} else if (drv == DRIVER_ATHEROS) {
@@ -3040,7 +3040,7 @@
 		else
 			ifname = "ath0";
 	} else if (drv == DRIVER_WIL6210) {
-		ifname = get_main_ifname();
+		ifname = get_main_ifname(dut);
 	} else {
 		if ((dut->ap_mode == AP_11a || dut->ap_mode == AP_11na ||
 		     dut->ap_mode == AP_11ac) &&
@@ -3246,7 +3246,7 @@
 
 		/* Now set anqp_elem and ft_oa for wlan_tag = 1 */
 		if (dut->program == PROGRAM_MBO &&
-		    get_driver_type() == DRIVER_OPENWRT) {
+		    get_driver_type(dut) == DRIVER_OPENWRT) {
 			unsigned char self_mac[ETH_ALEN];
 			char mac_str[20];
 			char anqp_string[200];
@@ -3306,7 +3306,7 @@
 		}
 
 		if (dut->ap_oce == VALUE_ENABLED &&
-		    get_driver_type() == DRIVER_OPENWRT) {
+		    get_driver_type(dut) == DRIVER_OPENWRT) {
 			owrt_ap_set_vap(dut, vap_id, "oce", "1");
 			owrt_ap_set_vap(dut, vap_id, "qbssload", "1");
 			owrt_ap_set_vap(dut, vap_id, "bpr_enable", "1");
@@ -3379,7 +3379,7 @@
 		}
 
 		if (dut->ap_oce == VALUE_DISABLED &&
-		    get_driver_type() == DRIVER_OPENWRT) {
+		    get_driver_type(dut) == DRIVER_OPENWRT) {
 			owrt_ap_set_vap(dut, vap_id, "oce", "0");
 			owrt_ap_set_vap(dut, vap_id, "qbssload", "0");
 			owrt_ap_set_vap(dut, vap_id, "bpr_enable", "0");
@@ -4039,7 +4039,7 @@
 				     struct sigma_cmd *cmd)
 {
 	if (dut->program == PROGRAM_DPP &&
-	    get_driver_type() == DRIVER_OPENWRT) {
+	    get_driver_type(dut) == DRIVER_OPENWRT) {
 		wpa_command(dut->hostapd_ifname, "DPP_BOOTSTRAP_REMOVE *");
 		wpa_command(dut->hostapd_ifname, "DPP_PKEX_REMOVE *");
 	}
@@ -4164,7 +4164,7 @@
 					   struct sigma_conn *conn,
 					   struct sigma_cmd *cmd)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_ATHEROS:
 		run_system(dut, "apdown");
 		sleep(1);
@@ -5541,7 +5541,7 @@
 {
 	const char *basedev = "wifi0";
 	const char *basedev_radio = "wifi1";
-	char *ifname = get_main_ifname();
+	const char *ifname = get_main_ifname(dut);
 	char *ifname_dual = NULL;
 	int i;
 	char buf[300];
@@ -6946,7 +6946,7 @@
 static int ap_set_60g_ese(struct sigma_dut *dut, int count,
 			  struct sigma_ese_alloc *allocs)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 #ifdef __linux__
 	case DRIVER_WIL6210:
 		return wil6210_set_ese(dut, count, allocs);
@@ -6961,7 +6961,7 @@
 
 static int ap_set_force_mcs(struct sigma_dut *dut, int force, int mcs)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 #ifdef __linux__
 	case DRIVER_WIL6210:
 		return wil6210_set_force_mcs(dut, force, mcs);
@@ -6989,7 +6989,7 @@
 	struct group *gr;
 #endif /* ANDROID */
 
-	drv = get_driver_type();
+	drv = get_driver_type(dut);
 
 	if (dut->mode == SIGMA_MODE_STATION) {
 		stop_sta_mode(dut);
@@ -7051,12 +7051,12 @@
 			else
 				ifname = "wlan0";
 		} else {
-			ifname = get_main_ifname();
+			ifname = get_main_ifname(dut);
 		}
 		fprintf(f, "hw_mode=a\n");
 		break;
 	case AP_11ad:
-		ifname = get_main_ifname();
+		ifname = get_main_ifname(dut);
 		fprintf(f, "hw_mode=ad\n");
 		break;
 	default:
@@ -8299,7 +8299,7 @@
 		dut->ap_tag_key_mgmt[i] = AP2_OPEN;
 	}
 
-	drv = get_driver_type();
+	drv = get_driver_type(dut);
 
 	program = get_param(cmd, "program");
 	if (!program)
@@ -8486,7 +8486,7 @@
 		dut->ap_dyn_bw_sig = VALUE_ENABLED;
 		if (get_openwrt_driver_type() == OPENWRT_DRIVER_ATHEROS)
 			dut->ap_dfs_mode = AP_DFS_MODE_ENABLED;
-		if (get_driver_type() == DRIVER_ATHEROS)
+		if (get_driver_type(dut) == DRIVER_ATHEROS)
 			ath_reset_vht_defaults(dut);
 	}
 
@@ -8644,7 +8644,7 @@
 		sigma_dut_print(dut, DUT_MSG_DEBUG,
 				"Setting msdu_size to MAX: 7912");
 		snprintf(buf, sizeof(buf), "ifconfig %s mtu 7912",
-			 get_main_ifname());
+			 get_main_ifname(dut));
 
 		if (system(buf) != 0) {
 			sigma_dut_print(dut, DUT_MSG_ERROR, "Failed to set %s",
@@ -8658,7 +8658,7 @@
 			return ERROR_SEND_STATUS;
 		}
 
-		if (set_ps(get_main_ifname(), dut, 1)) {
+		if (set_ps(get_main_ifname(dut), dut, 1)) {
 			sigma_dut_print(dut, DUT_MSG_ERROR,
 					"Failed to enable power save");
 			return ERROR_SEND_STATUS;
@@ -8666,7 +8666,7 @@
 	}
 
 	if (dut->program == PROGRAM_WPS &&
-	    get_driver_type() == DRIVER_WIL6210) {
+	    get_driver_type(dut) == DRIVER_WIL6210) {
 		/*
 		 * In 60 GHz WPS tests, we configure the AP OOB to
 		 * secure connection with a random passphrase.
@@ -8736,7 +8736,7 @@
 	struct stat s;
 	char resp[200];
 	FILE *f;
-	enum driver_type drv = get_driver_type();
+	enum driver_type drv = get_driver_type(dut);
 	int res;
 
 	switch (drv) {
@@ -9111,7 +9111,7 @@
 				 struct sigma_cmd *cmd)
 {
 	const char *val;
-	char *ifname;
+	const char *ifname;
 	int chwidth, nss;
 
 	val = get_param(cmd, "FrameName");
@@ -9125,7 +9125,7 @@
 	 * Sequence of commands for Opmode notification on
 	 * Peregrine based products
 	 */
-	ifname = get_main_ifname();
+	ifname = get_main_ifname(dut);
 
 	/* Disable STBC */
 	run_iwpriv(dut, ifname, "tx_stbc 0");
@@ -9533,9 +9533,9 @@
 				 struct sigma_cmd *cmd)
 {
 	const char *val;
-	char *ifname;
+	const char *ifname;
 
-	ifname = get_main_ifname();
+	ifname = get_main_ifname(dut);
 
 	val = get_param(cmd, "FrameName");
 	if (!val)
@@ -9557,7 +9557,7 @@
 static int ap_send_frame_vht(struct sigma_dut *dut, struct sigma_conn *conn,
 			     struct sigma_cmd *cmd)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_ATHEROS:
 		return ath_ap_send_frame_vht(dut, conn, cmd);
 		break;
@@ -9581,7 +9581,7 @@
 static int ap_send_frame_loc(struct sigma_dut *dut, struct sigma_conn *conn,
 			     struct sigma_cmd *cmd)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_ATHEROS:
 		return ath_ap_send_frame_loc(dut, conn, cmd);
 	case DRIVER_OPENWRT:
@@ -9604,7 +9604,7 @@
 static int ap_send_frame_mbo(struct sigma_dut *dut, struct sigma_conn *conn,
 			     struct sigma_cmd *cmd)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_ATHEROS:
 		return ath_ap_send_frame_mbo(dut, conn, cmd);
 	case DRIVER_OPENWRT:
@@ -9628,7 +9628,7 @@
 			     struct sigma_conn *conn,
 			     struct sigma_cmd *cmd)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 #ifdef __linux__
 	case DRIVER_WIL6210:
 		return wil6210_send_frame_60g(dut, conn, cmd);
@@ -10516,7 +10516,7 @@
 		dut->wps_method = WFA_CS_WPS_PBC;
 
 	if (!intf)
-		intf = get_main_ifname();
+		intf = get_main_ifname(dut);
 
 	if (dut->wps_method == WFA_CS_WPS_NOT_READY) {
 		send_resp(dut, conn, SIGMA_ERROR,
@@ -10551,7 +10551,7 @@
 	const char *ifname = get_param(cmd, "Interface");
 
 	if (!ifname)
-		ifname = get_main_ifname();
+		ifname = get_main_ifname(dut);
 
 	if (!param) {
 		send_resp(dut, conn, SIGMA_ERROR,
@@ -11130,7 +11130,7 @@
 						 struct sigma_cmd *cmd)
 {
 	const char *val;
-	char *ifname;
+	const char *ifname;
 	enum sigma_cmd_result res;
 	const char *basedev = "wifi0";
 	int trigtype;
@@ -11145,7 +11145,7 @@
 
 	memset(mac_addr, 0x00, ETH_ALEN);
 
-	ifname = get_main_ifname();
+	ifname = get_main_ifname(dut);
 
 	if (sigma_radio_ifname[0])
 		basedev = sigma_radio_ifname[0];
@@ -11940,9 +11940,9 @@
 			       struct sigma_cmd *cmd)
 {
 	const char *val;
-	char *ifname;
+	const char *ifname;
 
-	ifname = get_main_ifname();
+	ifname = get_main_ifname(dut);
 
 	val = get_param(cmd, "chnum_band");
 	if (val && wcn_vht_chnum_band(dut, ifname, val) < 0)
@@ -12003,9 +12003,9 @@
 				    struct sigma_cmd *cmd)
 {
 	const char *val;
-	char *ifname;
+	const char *ifname;
 
-	ifname = get_main_ifname();
+	ifname = get_main_ifname(dut);
 	val = get_param(cmd, "chnum_band");
 	if (val && mac80211_vht_chnum_band(dut, ifname, val) < 0)
 		return -1;
@@ -12047,7 +12047,7 @@
 	/* const char *name = get_param(cmd, "NAME"); */
 	/* const char *type = get_param(cmd, "Type"); */
 
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_ATHEROS:
 		return ath_ap_set_rfeature(dut, conn, cmd);
 	case DRIVER_OPENWRT:
diff --git a/basic.c b/basic.c
index db5260b..dae9ec3 100644
--- a/basic.c
+++ b/basic.c
@@ -27,7 +27,7 @@
 	if (info) {
 		char buf[200];
 		snprintf(buf, sizeof(buf), "NOTE CAPI:TestInfo:%s", info);
-		wpa_command(get_main_ifname(), buf);
+		wpa_command(get_main_ifname(dut), buf);
 	}
 
 	send_resp(dut, conn, SIGMA_COMPLETE, "version,1.0");
@@ -97,14 +97,14 @@
 		char host_fw_ver[128];
 
 		snprintf(path, sizeof(path), "/sys/class/net/%s/phy80211",
-			 get_main_ifname());
+			 get_main_ifname(dut));
 		if (stat(path, &s) == 0) {
 			ssize_t res;
 			char *pos;
 
 			res = snprintf(fname, sizeof(fname),
 				       "/sys/class/net/%s/device/driver",
-				       get_main_ifname());
+				       get_main_ifname(dut));
 			if (res < 0 || res >= sizeof(fname)) {
 				model = "Linux/";
 			} else if ((res = readlink(fname, path,
@@ -154,11 +154,11 @@
 				sizeof(wpa_supplicant_ver));
 
 		host_fw_ver[0] = '\0';
-		if (get_driver_type() == DRIVER_WCN ||
-		    get_driver_type() == DRIVER_LINUX_WCN) {
+		if (get_driver_type(dut) == DRIVER_WCN ||
+		    get_driver_type(dut) == DRIVER_LINUX_WCN) {
 			get_ver("iwpriv wlan0 version", host_fw_ver,
 				sizeof(host_fw_ver));
-		} else if (get_driver_type() == DRIVER_WIL6210) {
+		} else if (get_driver_type(dut) == DRIVER_WIL6210) {
 			struct ethtool_drvinfo drvinfo;
 			struct ifreq ifr; /* ifreq suitable for ethtool ioctl */
 			int fd; /* socket suitable for ethtool ioctl */
@@ -167,7 +167,7 @@
 			drvinfo.cmd = ETHTOOL_GDRVINFO;
 
 			memset(&ifr, 0, sizeof(ifr));
-			strlcpy(ifr.ifr_name, get_main_ifname(),
+			strlcpy(ifr.ifr_name, get_main_ifname(dut),
 				sizeof(ifr.ifr_name));
 
 			fd = socket(AF_INET, SOCK_DGRAM, 0);
@@ -236,8 +236,8 @@
 	if (strcmp(type, "802.11") != 0)
 		return ERROR_SEND_STATUS;
 
-	snprintf(resp, sizeof(resp), "interfaceType,802.11,"
-		 "interfaceID,%s", get_main_ifname());
+	snprintf(resp, sizeof(resp), "interfaceType,802.11,interfaceID,%s",
+		 get_main_ifname(dut));
 	send_resp(dut, conn, SIGMA_COMPLETE, resp);
 	return STATUS_SENT;
 }
diff --git a/dev.c b/dev.c
index ea9c430..be759d7 100644
--- a/dev.c
+++ b/dev.c
@@ -125,7 +125,7 @@
 
 	snprintf(buf, sizeof(buf), "hash://server/sha256/%s",
 		 dut->server_cert_hash);
-	if (set_network_quoted(get_station_ifname(), dut->infra_network_id,
+	if (set_network_quoted(get_station_ifname(dut), dut->infra_network_id,
 			       "ca_cert", buf) < 0) {
 		strlcpy(resp,
 			"ServerCertTrustResult,OverrideNotAllowed,Reason,Could not configure server certificate hash for the network profile",
@@ -133,9 +133,9 @@
 		goto done;
 	}
 
-	if (set_network(get_station_ifname(), dut->infra_network_id,
+	if (set_network(get_station_ifname(dut), dut->infra_network_id,
 			"domain_match", "NULL") < 0 ||
-	    set_network(get_station_ifname(), dut->infra_network_id,
+	    set_network(get_station_ifname(dut), dut->infra_network_id,
 			"domain_suffix_match", "NULL") < 0) {
 		strlcpy(resp,
 			"ServerCertTrustResult,OverrideNotAllowed,Reason,Could not clear domain matching rules",
@@ -143,20 +143,20 @@
 		goto done;
 	}
 
-	wpa_command(get_station_ifname(), "DISCONNECT");
+	wpa_command(get_station_ifname(dut), "DISCONNECT");
 	snprintf(buf, sizeof(buf), "SELECT_NETWORK %d", dut->infra_network_id);
-	if (wpa_command(get_station_ifname(), buf) < 0) {
+	if (wpa_command(get_station_ifname(dut), buf) < 0) {
 		sigma_dut_print(dut, DUT_MSG_INFO, "Failed to select "
 				"network id %d on %s",
 				dut->infra_network_id,
-				get_station_ifname());
+				get_station_ifname(dut));
 		strlcpy(resp,
 			"ServerCertTrustResult,Accepted,Result,Could not request reconnection",
 			sizeof(resp));
 		goto done;
 	}
 
-	ctrl = open_wpa_mon(get_station_ifname());
+	ctrl = open_wpa_mon(get_station_ifname(dut));
 	if (!ctrl)
 		goto done;
 
diff --git a/dhcp.c b/dhcp.c
index a32e019..277af19 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -88,7 +88,7 @@
 	protocol = UDP_PROTOCOL;
 	port_no = DHCP_SERVER_PORT;
 
-	strlcpy(ifname, get_main_ifname(), sizeof(ifname));
+	strlcpy(ifname, get_main_ifname(dut), sizeof(ifname));
 
 	/* gives the network mask for ifname essential for applying filter */
 	pcap_lookupnet(ifname, &pcap_netp, &pcap_maskp, pcap_err);
diff --git a/dpp.c b/dpp.c
index ac84e44..b5b622e 100644
--- a/dpp.c
+++ b/dpp.c
@@ -68,7 +68,7 @@
 	const char *bs = get_param(cmd, "DPPBS");
 	const char *chan_list = get_param(cmd, "DPPChannelList");
 	char *pos, mac[50], buf[200], resp[1000], hex[2000];
-	const char *ifname = get_station_ifname();
+	const char *ifname = get_station_ifname(dut);
 	int res;
 
 	if (success)
@@ -735,7 +735,7 @@
 static int dpp_display_own_qrcode(struct sigma_dut *dut)
 {
 	char buf[200], resp[2000];
-	const char *ifname = get_station_ifname();
+	const char *ifname = get_station_ifname(dut);
 #ifdef ANDROID
 	FILE *fp;
 #else /* ANDROID */
@@ -886,7 +886,7 @@
 	int res;
 	unsigned int old_timeout;
 	int own_pkex_id = -1;
-	const char *ifname = get_station_ifname();
+	const char *ifname = get_station_ifname(dut);
 	const char *auth_events[] = {
 		"DPP-AUTH-SUCCESS",
 		"DPP-NOT-COMPATIBLE",
@@ -998,7 +998,7 @@
 					"Update hostapd operating channel to match listen needs");
 			dut->ap_channel = 6;
 
-			if (get_driver_type() == DRIVER_OPENWRT) {
+			if (get_driver_type(dut) == DRIVER_OPENWRT) {
 				snprintf(buf, sizeof(buf),
 					 "iwconfig %s channel %d",
 					 dut->hostapd_ifname, dut->ap_channel);
@@ -1458,7 +1458,7 @@
 		}
 
 		if (!(tcp && strcasecmp(tcp, "yes") == 0) &&
-		    get_driver_type() == DRIVER_OPENWRT) {
+		    get_driver_type(dut) == DRIVER_OPENWRT) {
 			snprintf(buf, sizeof(buf), "iwconfig %s channel %d",
 				 dut->hostapd_ifname, freq_to_channel(freq));
 			run_system(dut, buf);
diff --git a/ftm.c b/ftm.c
index f3f9aa4..794cc26 100644
--- a/ftm.c
+++ b/ftm.c
@@ -480,7 +480,7 @@
 	if (cmnd == LOWI_TST_ANQP_REQ) {
 		sigma_dut_print(dut, DUT_MSG_DEBUG, "%s - Executing command %s",
 				__func__, address3Cmnd);
-		if (wpa_command(get_station_ifname(), address3Cmnd) < 0) {
+		if (wpa_command(get_station_ifname(dut), address3Cmnd) < 0) {
 			send_resp(dut, conn, SIGMA_ERROR, NULL);
 			return -1;
 		}
@@ -645,8 +645,8 @@
 			sigma_dut_print(dut, DUT_MSG_INFO,
 					"%s - Disabling RM - FTMRR",
 					__func__);
-			if (wpa_command(get_station_ifname(), WPA_RM_DISABLE) <
-			    0) {
+			if (wpa_command(get_station_ifname(dut),
+					WPA_RM_DISABLE) < 0) {
 				send_resp(dut, conn, SIGMA_ERROR, NULL);
 				return -1;
 			}
@@ -654,8 +654,8 @@
 			sigma_dut_print(dut, DUT_MSG_INFO,
 					"%s - Enabling RM - FTMRR",
 					__func__);
-			if (wpa_command(get_station_ifname(), WPA_RM_ENABLE) <
-			    0) {
+			if (wpa_command(get_station_ifname(dut),
+					WPA_RM_ENABLE) < 0) {
 				send_resp(dut, conn, SIGMA_ERROR, NULL);
 				return 0;
 			}
@@ -674,10 +674,10 @@
 		sigma_dut_print(dut, DUT_MSG_INFO, "%s - interworking: %u",
 				__func__, interworking);
 		if (interworking)
-			wpa_command(get_station_ifname(),
+			wpa_command(get_station_ifname(dut),
 				    WPA_INTERWORKING_ENABLE);
 		else
-			wpa_command(get_station_ifname(),
+			wpa_command(get_station_ifname(dut),
 				    WPA_INTERWORKING_DISABLE);
 	}
 
diff --git a/miracast.c b/miracast.c
index 3068d3a..af819b8 100644
--- a/miracast.c
+++ b/miracast.c
@@ -193,7 +193,7 @@
 }
 
 
-static void miracast_stop_dhcp_client(struct sigma_dut *dut, char *ifname)
+static void miracast_stop_dhcp_client(struct sigma_dut *dut, const char *ifname)
 {
 #ifdef MIRACAST_DHCP_M
 	stop_dhcp(dut, ifname, 0);
@@ -859,10 +859,10 @@
 }
 
 
-static int get_p2p_peers(char *respbuf, size_t bufsize)
+static int get_p2p_peers(struct sigma_dut *dut, char *respbuf, size_t bufsize)
 {
 	char addr[1024], cmd[64];
-	char *intf = get_main_ifname();
+	const char *intf = get_main_ifname(dut);
 	int ret;
 	char *pos, *end;
 
@@ -911,7 +911,7 @@
 		int len = strlen("DeviceList,");
 
 		snprintf(resp_buf, sizeof(resp_buf), "DeviceList,");
-		get_p2p_peers(resp_buf + len, 1024 - len);
+		get_p2p_peers(dut, resp_buf + len, 1024 - len);
 	} else {
 		send_resp(dut, conn, SIGMA_ERROR, "Invalid Parameter");
 		return 0;
diff --git a/p2p.c b/p2p.c
index 177af4a..ff5c79b 100644
--- a/p2p.c
+++ b/p2p.c
@@ -420,8 +420,8 @@
 	printf("Trying to find suitable interface for group: go_dev_addr='%s' "
 	       "grpid='%s'\n", go_dev_addr, grpid);
 
-	if (wpa_command_resp(get_main_ifname(), "INTERFACES", buf, sizeof(buf))
-	    < 0)
+	if (wpa_command_resp(get_main_ifname(dut), "INTERFACES",
+			     buf, sizeof(buf)) < 0)
 		return NULL;
 	ifname = buf;
 	while (ifname && *ifname) {
@@ -489,7 +489,7 @@
 	}
 
 	/* Try to find a suitable group interface */
-	if (wpa_command_resp(get_main_ifname(), "INTERFACES",
+	if (wpa_command_resp(get_main_ifname(dut), "INTERFACES",
 			     buf, sizeof(buf)) < 0)
 		return ifname;
 
@@ -604,8 +604,8 @@
 
 void disconnect_station(struct sigma_dut *dut)
 {
-	wpa_command(get_station_ifname(), "DISCONNECT");
-	remove_wpa_networks(get_station_ifname());
+	wpa_command(get_station_ifname(dut), "DISCONNECT");
+	remove_wpa_networks(get_station_ifname(dut));
 	dut->infra_ssid[0] = '\0';
 #ifdef __linux__
 	{
@@ -613,7 +613,7 @@
 		char buf[200];
 		struct stat s;
 		snprintf(path, sizeof(path), "/var/run/dhclient-%s.pid",
-			 get_station_ifname());
+			 get_station_ifname(dut));
 		if (stat(path, &s) == 0) {
 			snprintf(buf, sizeof(buf),
 				 "kill `cat %s`", path);
@@ -623,7 +623,7 @@
 			unlink(path);
 		}
 		snprintf(buf, sizeof(buf),
-			 "ifconfig %s 0.0.0.0", get_station_ifname());
+			 "ifconfig %s 0.0.0.0", get_station_ifname(dut));
 		sigma_dut_print(dut, DUT_MSG_DEBUG,
 				"Clear infrastructure station IP address: %s",
 				buf);
@@ -656,7 +656,7 @@
 					     struct sigma_conn *conn,
 					     struct sigma_cmd *cmd)
 {
-	const char *intf = get_p2p_ifname(get_param(cmd, "Interface"));
+	const char *intf = get_p2p_ifname(dut, get_param(cmd, "Interface"));
 	char buf[256];
 	const char *val;
 	const char *noa_dur, *noa_int, *noa_count;
@@ -856,7 +856,7 @@
 cmd_sta_start_autonomous_go(struct sigma_dut *dut, struct sigma_conn *conn,
 			    struct sigma_cmd *cmd)
 {
-	const char *intf = get_p2p_ifname(get_param(cmd, "Interface"));
+	const char *intf = get_p2p_ifname(dut, get_param(cmd, "Interface"));
 	const char *oper_chn = get_param(cmd, "OPER_CHN");
 	const char *ssid_param = get_param(cmd, "SSID");
 #ifdef MIRACAST
@@ -1000,7 +1000,7 @@
 						 struct sigma_conn *conn,
 						 struct sigma_cmd *cmd)
 {
-	const char *intf = get_p2p_ifname(get_param(cmd, "Interface"));
+	const char *intf = get_p2p_ifname(dut, get_param(cmd, "Interface"));
 	const char *devid = get_param(cmd, "P2PDevID");
 	/* const char *grpid_param = get_param(cmd, "GroupID"); */
 	int res;
@@ -1125,7 +1125,7 @@
 				  struct sigma_conn *conn,
 				  struct sigma_cmd *cmd)
 {
-	const char *intf = get_p2p_ifname(get_param(cmd, "Interface"));
+	const char *intf = get_p2p_ifname(dut, get_param(cmd, "Interface"));
 	const char *devid = get_param(cmd, "P2PDevID");
 	const char *intent_val = get_param(cmd, "INTENT_VAL");
 	const char *init_go_neg = get_param(cmd, "INIT_GO_NEG");
@@ -1848,9 +1848,9 @@
 	wpa_command(intf, "SET p2p_go_intent 7");
 	wpa_command(intf, "P2P_SET client_apsd disable");
 	wpa_command(intf, "P2P_SET go_apsd disable");
-	wpa_command(get_station_ifname(), "P2P_SET ps 98");
-	wpa_command(get_station_ifname(), "P2P_SET ps 96");
-	wpa_command(get_station_ifname(), "P2P_SET ps 0");
+	wpa_command(get_station_ifname(dut), "P2P_SET ps 98");
+	wpa_command(get_station_ifname(dut), "P2P_SET ps 96");
+	wpa_command(get_station_ifname(dut), "P2P_SET ps 0");
 	wpa_command(intf, "P2P_SET ps 0");
 	wpa_command(intf, "SET persistent_reconnect 1");
 	wpa_command(intf, "SET ampdu 1");
@@ -1862,7 +1862,7 @@
 		dut->arp_ipaddr[0] = '\0';
 	}
 	snprintf(buf, sizeof(buf), "ip nei flush dev %s",
-		 get_station_ifname());
+		 get_station_ifname(dut));
 	run_system(dut, buf);
 	dut->p2p_mode = P2P_IDLE;
 	dut->client_uapsd = 0;
@@ -1990,7 +1990,7 @@
 {
 	/* const char *intf = get_param(cmd, "Interface"); */
 	struct wfa_cs_p2p_group *grp;
-	char *ifname;
+	const char *ifname;
 	const char *grpid = get_param(cmd, "GroupID");
 
 	if (dut->program == PROGRAM_60GHZ) {
@@ -2000,7 +2000,7 @@
 	}
 
 	if (grpid == NULL)
-		ifname = get_station_ifname();
+		ifname = get_station_ifname(dut);
 	else {
 		grp = p2p_group_get(dut, grpid);
 		if (grp == NULL) {
@@ -2106,7 +2106,7 @@
 			    struct sigma_cmd *cmd)
 {
 	char buf[256];
-	char *ifname;
+	const char *ifname;
 	const char *grpid, *ipaddr, *macaddr;
 
 	grpid = get_param(cmd, "GroupID");
@@ -2116,7 +2116,7 @@
 		return -1;
 
 	if (grpid == NULL)
-		ifname = get_station_ifname();
+		ifname = get_station_ifname(dut);
 	else {
 		struct wfa_cs_p2p_group *grp;
 		grp = p2p_group_get(dut, grpid);
@@ -2147,7 +2147,7 @@
 {
 	char buf[256];
 	struct wfa_cs_p2p_group *grp;
-	char *ifname;
+	const char *ifname;
 	const char *grpid, *ipaddr;
 
 	grpid = get_param(cmd, "GroupID");
@@ -2156,7 +2156,7 @@
 		return -1;
 
 	if (grpid == NULL)
-		ifname = get_station_ifname();
+		ifname = get_station_ifname(dut);
 	else {
 		grp = p2p_group_get(dut, grpid);
 		if (grp == NULL) {
diff --git a/sigma_dut.c b/sigma_dut.c
index 012b373..18408ea 100644
--- a/sigma_dut.c
+++ b/sigma_dut.c
@@ -26,7 +26,7 @@
 char *sigma_main_ifname = NULL;
 char *sigma_radio_ifname[MAX_RADIO] = {};
 char *sigma_station_ifname = NULL;
-char *sigma_p2p_ifname = NULL;
+const char *sigma_p2p_ifname = NULL;
 static char *sigma_p2p_ifname_buf = NULL;
 char *sigma_wpas_ctrl = "/var/run/wpa_supplicant/";
 char *sigma_hapd_ctrl = NULL;
@@ -400,7 +400,7 @@
 	sigma_dut_summary(dut, "CAPI cmd: %s", buf);
 	snprintf(txt, sizeof(txt), "NOTE CAPI:%s", buf);
 	txt[sizeof(txt) - 1] = '\0';
-	wpa_command(get_main_ifname(), txt);
+	wpa_command(get_main_ifname(dut), txt);
 
 	memset(&c, 0, sizeof(c));
 	cmd = buf;
@@ -753,7 +753,7 @@
 }
 
 
-static char * determine_sigma_p2p_ifname(void)
+static const char * determine_sigma_p2p_ifname(struct sigma_dut *dut)
 {
 	char buf[256];
 	struct wpa_ctrl *ctrl;
@@ -761,7 +761,7 @@
 	if (sigma_p2p_ifname)
 		return sigma_p2p_ifname;
 
-	snprintf(buf, sizeof(buf), "p2p-dev-%s", get_station_ifname());
+	snprintf(buf, sizeof(buf), "p2p-dev-%s", get_station_ifname(dut));
 	ctrl = open_wpa_mon(buf);
 	if (ctrl) {
 		wpa_ctrl_detach(ctrl);
@@ -771,9 +771,9 @@
 		sigma_dut_print(&sigma_dut, DUT_MSG_INFO,
 				"Using interface %s for P2P operations instead of interface %s",
 				sigma_p2p_ifname ? sigma_p2p_ifname : "NULL",
-				get_station_ifname());
+				get_station_ifname(dut));
 	} else {
-		sigma_p2p_ifname = get_station_ifname();
+		sigma_p2p_ifname = get_station_ifname(dut);
 	}
 
 	return sigma_p2p_ifname;
@@ -1156,7 +1156,7 @@
 		}
 	}
 
-	sigma_dut.p2p_ifname = determine_sigma_p2p_ifname();
+	sigma_dut.p2p_ifname = determine_sigma_p2p_ifname(&sigma_dut);
 #ifdef MIRACAST
 	miracast_init(&sigma_dut);
 #endif /* MIRACAST */
diff --git a/sigma_dut.h b/sigma_dut.h
index 4d4f1de..88b439c 100644
--- a/sigma_dut.h
+++ b/sigma_dut.h
@@ -387,7 +387,7 @@
 
 	int go;
 	int p2p_client;
-	char *p2p_ifname;
+	const char *p2p_ifname;
 
 	int client_uapsd;
 
@@ -981,7 +981,7 @@
 #define DRIVER_NAME_60G "wil6210"
 
 int set_wifi_chip(const char *chip_type);
-enum driver_type get_driver_type(void);
+enum driver_type get_driver_type(struct sigma_dut *dut);
 enum openwrt_driver_type get_openwrt_driver_type(void);
 int file_exists(const char *fname);
 
diff --git a/sta.c b/sta.c
index a583e81..e04be60 100644
--- a/sta.c
+++ b/sta.c
@@ -954,7 +954,7 @@
 		strlcpy(sec_dns, prop, sizeof(sec_dns));
 #else /* ANDROID */
 #ifdef __linux__
-	if (get_driver_type() == DRIVER_OPENWRT)
+	if (get_driver_type(dut) == DRIVER_OPENWRT)
 		str_ps = "ps -w";
 	else
 		str_ps = "ps ax";
@@ -1112,8 +1112,8 @@
 	if (intf == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -1387,8 +1387,8 @@
 	if (intf == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -1566,8 +1566,8 @@
 	if (dut->dev_role == DEVROLE_STA_CFON)
 		return sta_cfon_get_mac_address(dut, conn, cmd);
 
-	if (get_wpa_status(get_station_ifname(), "address", addr, sizeof(addr))
-	    < 0)
+	if (get_wpa_status(get_station_ifname(dut), "address",
+			   addr, sizeof(addr)) < 0)
 		return -2;
 
 	snprintf(resp, sizeof(resp), "mac,%s", addr);
@@ -1583,10 +1583,11 @@
 	/* const char *intf = get_param(cmd, "Interface"); */
 	int connected = 0;
 	char result[32];
-	if (get_wpa_status(get_station_ifname(), "wpa_state", result,
+	if (get_wpa_status(get_station_ifname(dut), "wpa_state", result,
 			   sizeof(result)) < 0) {
-		sigma_dut_print(dut, DUT_MSG_INFO, "Could not get interface "
-				"%s status", get_station_ifname());
+		sigma_dut_print(dut, DUT_MSG_INFO,
+				"Could not get interface %s status",
+				get_station_ifname(dut));
 		return -2;
 	}
 
@@ -1647,8 +1648,8 @@
 	/* const char *intf = get_param(cmd, "Interface"); */
 	char bssid[20], resp[50];
 
-	if (get_wpa_status(get_station_ifname(), "bssid", bssid, sizeof(bssid))
-	    < 0)
+	if (get_wpa_status(get_station_ifname(dut), "bssid",
+			   bssid, sizeof(bssid)) < 0)
 		strlcpy(bssid, "00:00:00:00:00:00", sizeof(bssid));
 
 	snprintf(resp, sizeof(resp), "bssid,%s", bssid);
@@ -1727,8 +1728,8 @@
 	if (intf == NULL || ssid == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -2057,8 +2058,8 @@
 	if (intf == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -2456,8 +2457,8 @@
 	if (intf == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -2576,8 +2577,8 @@
 	if (intf == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -2612,8 +2613,8 @@
 	if (intf == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -2640,8 +2641,8 @@
 	if (intf == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -2692,8 +2693,8 @@
 	if (intf == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -2752,8 +2753,8 @@
 	if (intf == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -2786,8 +2787,8 @@
 	if (intf == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -2810,8 +2811,8 @@
 	const char *ifname;
 	int id;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -2841,8 +2842,8 @@
 	if (intf == NULL)
 		return -1;
 
-	if (strcmp(intf, get_main_ifname()) == 0)
-		ifname = get_station_ifname();
+	if (strcmp(intf, get_main_ifname(dut)) == 0)
+		ifname = get_station_ifname(dut);
 	else
 		ifname = intf;
 
@@ -3247,7 +3248,7 @@
 
 	sigma_dut_print(dut, DUT_MSG_DEBUG,
 			"Search for profile based on SSID: '%s'", ssid);
-	if (wpa_command_resp(get_station_ifname(), "LIST_NETWORKS",
+	if (wpa_command_resp(get_station_ifname(dut), "LIST_NETWORKS",
 			     list, sizeof(list)) < 0)
 		return -1;
 	pos = strstr(list, ssid);
@@ -3326,14 +3327,14 @@
 
 	if (dut->rsne_override) {
 #ifdef NL80211_SUPPORT
-		if (get_driver_type() == DRIVER_WCN) {
+		if (get_driver_type(dut) == DRIVER_WCN) {
 			sta_config_rsnie(dut, 1);
 			dut->config_rsnie = 1;
 		}
 #endif /* NL80211_SUPPORT */
 		snprintf(buf, sizeof(buf), "TEST_ASSOC_IE %s",
 			 dut->rsne_override);
-		if (wpa_command(get_station_ifname(), buf) < 0) {
+		if (wpa_command(get_station_ifname(dut), buf) < 0) {
 			send_resp(dut, conn, SIGMA_ERROR,
 				  "ErrorCode,Failed to set DEV_CONFIGURE_IE RSNE override");
 			return 0;
@@ -3343,7 +3344,7 @@
 	if (dut->sae_commit_override) {
 		snprintf(buf, sizeof(buf), "SET sae_commit_override %s",
 			 dut->sae_commit_override);
-		if (wpa_command(get_station_ifname(), buf) < 0) {
+		if (wpa_command(get_station_ifname(dut), buf) < 0) {
 			send_resp(dut, conn, SIGMA_ERROR,
 				  "ErrorCode,Failed to set SAE commit override");
 			return 0;
@@ -3361,7 +3362,7 @@
 	if (wps) {
 		if (dut->program == PROGRAM_60GHZ && network_mode &&
 		    strcasecmp(network_mode, "PBSS") == 0 &&
-		    set_network(get_station_ifname(), dut->infra_network_id,
+		    set_network(get_station_ifname(dut), dut->infra_network_id,
 				"pbss", "1") < 0)
 			return -2;
 
@@ -3371,12 +3372,12 @@
 			return 0;
 		}
 		if (dut->wps_method == WFA_CS_WPS_PBC) {
-			if (wpa_command(get_station_ifname(), "WPS_PBC") < 0)
+			if (wpa_command(get_station_ifname(dut), "WPS_PBC") < 0)
 				return -2;
 		} else {
 			snprintf(buf, sizeof(buf), "WPS_PIN any %s",
 				 dut->wps_pin);
-			if (wpa_command(get_station_ifname(), buf) < 0)
+			if (wpa_command(get_station_ifname(dut), buf) < 0)
 				return -2;
 		}
 	} else {
@@ -3392,7 +3393,7 @@
 		}
 
 		if (bssid &&
-		    set_network(get_station_ifname(), dut->infra_network_id,
+		    set_network(get_station_ifname(dut), dut->infra_network_id,
 				"bssid", bssid) < 0) {
 			send_resp(dut, conn, SIGMA_ERROR, "ErrorCode,"
 				  "Invalid bssid argument");
@@ -3401,7 +3402,7 @@
 
 		if (dut->program == PROGRAM_WPA3 &&
 		    dut->sta_associate_wait_connect) {
-			ctrl = open_wpa_mon(get_station_ifname());
+			ctrl = open_wpa_mon(get_station_ifname(dut));
 			if (!ctrl)
 				return ERROR_SEND_STATUS;
 		}
@@ -3412,11 +3413,11 @@
 				 channel_to_freq(dut, atoi(chan)));
 		snprintf(buf, sizeof(buf), "SELECT_NETWORK %d%s",
 			 dut->infra_network_id, extra);
-		if (wpa_command(get_station_ifname(), buf) < 0) {
+		if (wpa_command(get_station_ifname(dut), buf) < 0) {
 			sigma_dut_print(dut, DUT_MSG_INFO, "Failed to select "
 					"network id %d on %s",
 					dut->infra_network_id,
-					get_station_ifname());
+					get_station_ifname(dut));
 			ret = ERROR_SEND_STATUS;
 			goto done;
 		}
@@ -3932,7 +3933,7 @@
 
 	val = get_param(cmd, "FILSHLP");
 	if (val && strcasecmp(val, "Enable") == 0) {
-		if (get_wpa_status(get_station_ifname(), "address", text,
+		if (get_wpa_status(get_station_ifname(dut), "address", text,
 				   sizeof(text)) < 0)
 			return -2;
 		hwaddr_aton(text, addr);
@@ -4743,7 +4744,7 @@
 
 	val = get_param(cmd, "RTS");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_ATHEROS:
 			ath_sta_set_rts(dut, intf, val);
 			break;
@@ -4849,7 +4850,7 @@
 
 	val = get_param(cmd, "wmm");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_ATHEROS:
 			ath_sta_set_wmm(dut, intf, val);
 			break;
@@ -4868,7 +4869,7 @@
 		char buf[60];
 
 		if (strcmp(val, "0") == 0 || strcasecmp(val, "off") == 0) {
-			if (get_driver_type() == DRIVER_WCN) {
+			if (get_driver_type(dut) == DRIVER_WCN) {
 				snprintf(buf, sizeof(buf),
 					 "iwpriv %s setPower 2", intf);
 				if (system(buf) != 0) {
@@ -4878,16 +4879,16 @@
 				}
 			}
 
-			if (wpa_command(get_station_ifname(),
+			if (wpa_command(get_station_ifname(dut),
 					"P2P_SET ps 0") < 0)
 				return -2;
 			/* Make sure test modes are disabled */
-			wpa_command(get_station_ifname(), "P2P_SET ps 98");
-			wpa_command(get_station_ifname(), "P2P_SET ps 96");
+			wpa_command(get_station_ifname(dut), "P2P_SET ps 98");
+			wpa_command(get_station_ifname(dut), "P2P_SET ps 96");
 		} else if (strcmp(val, "1") == 0 ||
 			   strcasecmp(val, "PSPoll") == 0 ||
 			   strcasecmp(val, "on") == 0) {
-			if (get_driver_type() == DRIVER_WCN) {
+			if (get_driver_type(dut) == DRIVER_WCN) {
 				snprintf(buf, sizeof(buf),
 					 "iwpriv %s setPower 1", intf);
 				if (system(buf) != 0) {
@@ -4897,11 +4898,11 @@
 				}
 			}
 			/* Disable default power save mode */
-			wpa_command(get_station_ifname(), "P2P_SET ps 0");
+			wpa_command(get_station_ifname(dut), "P2P_SET ps 0");
 			/* Enable PS-Poll test mode */
-			if (wpa_command(get_station_ifname(),
+			if (wpa_command(get_station_ifname(dut),
 					"P2P_SET ps 97") < 0 ||
-			    wpa_command(get_station_ifname(),
+			    wpa_command(get_station_ifname(dut),
 					"P2P_SET ps 99") < 0)
 				return -2;
 		} else if (strcmp(val, "2") == 0 ||
@@ -4913,11 +4914,11 @@
 		} else if (strcmp(val, "3") == 0 ||
 			   strcasecmp(val, "PSNonPoll") == 0) {
 			/* Make sure test modes are disabled */
-			wpa_command(get_station_ifname(), "P2P_SET ps 98");
-			wpa_command(get_station_ifname(), "P2P_SET ps 96");
+			wpa_command(get_station_ifname(dut), "P2P_SET ps 98");
+			wpa_command(get_station_ifname(dut), "P2P_SET ps 96");
 
 			/* Enable default power save mode */
-			if (wpa_command(get_station_ifname(),
+			if (wpa_command(get_station_ifname(dut),
 					"P2P_SET ps 1") < 0)
 				return -2;
 		} else
@@ -4926,7 +4927,7 @@
 
 	val = get_param(cmd, "NoAck");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_ATHEROS:
 			ath_sta_set_noack(dut, intf, val);
 			break;
@@ -5287,7 +5288,7 @@
 {
 	int ret;
 
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_WCN:
 		ret = nlvendor_sta_set_addba_reject(dut, intf, addbareject);
 		if (ret) {
@@ -5505,7 +5506,7 @@
 
 	val = get_param(cmd, "AMSDU");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_ATHEROS:
 		case DRIVER_WCN:
 			iwpriv_sta_set_amsdu(dut, intf, val);
@@ -5524,7 +5525,7 @@
 
 	val = get_param(cmd, "STBC_RX");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_ATHEROS:
 			ath_sta_set_stbc(dut, intf, val);
 			break;
@@ -5540,7 +5541,7 @@
 
 	val = get_param(cmd, "WIDTH");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_WCN:
 			if (wcn_sta_set_width(dut, intf, val) < 0) {
 				send_resp(dut, conn, SIGMA_ERROR,
@@ -5569,7 +5570,7 @@
 
 	val = get_param(cmd, "TXSP_STREAM");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_WCN:
 			if (wcn_sta_set_sp_stream(dut, intf, val) < 0) {
 				send_resp(dut, conn, SIGMA_ERROR,
@@ -5589,7 +5590,7 @@
 
 	val = get_param(cmd, "RXSP_STREAM");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_WCN:
 			if (wcn_sta_set_sp_stream(dut, intf, val) < 0) {
 				send_resp(dut, conn, SIGMA_ERROR,
@@ -5609,7 +5610,7 @@
 
 	val = get_param(cmd, "DYN_BW_SGNL");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_WCN:
 			if (strcasecmp(val, "enable") == 0) {
 				snprintf(buf, sizeof(buf),
@@ -5679,7 +5680,7 @@
 
 	val = get_param(cmd, "CTS_WIDTH");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_WCN:
 			if (wcn_sta_set_cts_width(dut, intf, val) < 0) {
 				send_resp(dut, conn, SIGMA_ERROR,
@@ -5723,7 +5724,7 @@
 
 	val = get_param(cmd, "zero_crc");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_ATHEROS:
 			ath_set_zero_crc(dut, val);
 			break;
@@ -5738,7 +5739,7 @@
 
 static int sta_set_force_mcs(struct sigma_dut *dut, int force, int mcs)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 #ifdef __linux__
 	case DRIVER_WIL6210:
 		return wil6210_set_force_mcs(dut, force, mcs);
@@ -5753,7 +5754,7 @@
 
 static int sta_60g_force_rsn_ie(struct sigma_dut *dut, int state)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 #ifdef __linux__
 	case DRIVER_WIL6210:
 		return wil6210_force_rsn_ie(dut, state);
@@ -5792,7 +5793,7 @@
 		sigma_dut_print(dut, DUT_MSG_DEBUG,
 				"Setting amsdu_size to %d", mtu);
 		snprintf(buf, sizeof(buf), "ifconfig %s mtu %d",
-			 get_station_ifname(), mtu);
+			 get_station_ifname(dut), mtu);
 
 		if (system(buf) != 0) {
 			sigma_dut_print(dut, DUT_MSG_ERROR, "Failed to set %s",
@@ -5832,12 +5833,12 @@
 			 struct sigma_cmd *cmd)
 {
 	int net_id;
-	char *ifname;
+	const char *ifname;
 	const char *val;
 	char buf[100];
 
 	dut->mode = SIGMA_MODE_STATION;
-	ifname = get_main_ifname();
+	ifname = get_main_ifname(dut);
 	if (wpa_command(ifname, "PING") != 0) {
 		sigma_dut_print(dut, DUT_MSG_ERROR, "Supplicant not running");
 		return ERROR_SEND_STATUS;
@@ -6006,7 +6007,7 @@
 int sta_set_60g_abft_len(struct sigma_dut *dut, struct sigma_conn *conn,
 			 int abft_len)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_WIL6210:
 		return wil6210_set_abft_len(dut, abft_len);
 	default:
@@ -6244,7 +6245,7 @@
 		return ERROR_SEND_STATUS;
 	}
 
-	if (get_wpa_status(get_station_ifname(), "wpa_state", result,
+	if (get_wpa_status(get_station_ifname(dut), "wpa_state", result,
 			   sizeof(result)) < 0 ||
 	    strncmp(result, "COMPLETED", 9) != 0) {
 		sigma_dut_print(dut, DUT_MSG_DEBUG,
@@ -6258,7 +6259,8 @@
 
 	if (dut->rsne_override) {
 #ifdef NL80211_SUPPORT
-		if (get_driver_type() == DRIVER_WCN && dut->config_rsnie == 0) {
+		if (get_driver_type(dut) == DRIVER_WCN &&
+		    dut->config_rsnie == 0) {
 			sta_config_rsnie(dut, 1);
 			dut->config_rsnie = 1;
 		}
@@ -6438,7 +6440,7 @@
 static int sta_get_aid_60g(struct sigma_dut *dut, const char *bssid,
 			   unsigned int *aid)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 #ifdef __linux__
 	case DRIVER_WIL6210:
 		return wil6210_get_aid(dut, bssid, aid);
@@ -6464,7 +6466,7 @@
 		unsigned int aid = 0;
 		char bssid[20];
 
-		if (get_wpa_status(get_station_ifname(), "bssid",
+		if (get_wpa_status(get_station_ifname(dut), "bssid",
 				   bssid, sizeof(bssid)) < 0) {
 			sigma_dut_print(dut, DUT_MSG_ERROR,
 					"could not get bssid");
@@ -6566,7 +6568,7 @@
 	if (strcasecmp(parameter, "RSSI") == 0) {
 		char rssi[10];
 
-		if (get_wpa_signal_poll(dut, get_station_ifname(), "RSSI",
+		if (get_wpa_signal_poll(dut, get_station_ifname(dut), "RSSI",
 					rssi, sizeof(rssi)) < 0) {
 			sigma_dut_print(dut, DUT_MSG_ERROR,
 					"Could not get RSSI");
@@ -7617,7 +7619,7 @@
 		wpa_command(intf, "SET tdls_disabled 0");
 		wpa_command(intf, "SET tdls_testing 0");
 		dut->no_tpk_expiration = 0;
-		if (get_driver_type() == DRIVER_WCN) {
+		if (get_driver_type(dut) == DRIVER_WCN) {
 			/* Enable the WCN driver in TDLS Explicit trigger mode
 			 */
 			wpa_command(intf, "SET tdls_external_control 0");
@@ -7631,7 +7633,7 @@
 		miracast_sta_reset_default(dut, conn, cmd);
 #endif /* MIRACAST */
 
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_ATHEROS:
 		sta_reset_default_ath(dut, intf, type);
 		break;
@@ -7708,7 +7710,7 @@
 		sigma_dut_print(dut, DUT_MSG_DEBUG,
 				"Setting msdu_size to MAX: 7912");
 		snprintf(buf, sizeof(buf), "ifconfig %s mtu 7912",
-			 get_station_ifname());
+			 get_station_ifname(dut));
 
 		if (system(buf) != 0) {
 			sigma_dut_print(dut, DUT_MSG_ERROR, "Failed to set %s",
@@ -7780,7 +7782,7 @@
 
 	if (dut->program == PROGRAM_LOC) {
 		/* Disable Interworking by default */
-		wpa_command(get_station_ifname(), "SET interworking 0");
+		wpa_command(get_station_ifname(dut), "SET interworking 0");
 	}
 
 	if (dut->program == PROGRAM_MBO) {
@@ -7829,7 +7831,7 @@
 	dut->sta_ft_ds = 0;
 
 #ifdef NL80211_SUPPORT
-	if (get_driver_type() == DRIVER_WCN &&
+	if (get_driver_type(dut) == DRIVER_WCN &&
 	    dut->config_rsnie == 1) {
 		dut->config_rsnie = 0;
 		sta_config_rsnie(dut, 0);
@@ -7976,7 +7978,7 @@
 
 	val = get_param(cmd, "SGI20");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_ATHEROS:
 			ath_sta_set_sgi(dut, intf, val);
 			break;
@@ -8000,7 +8002,7 @@
 			  "ErrorCode,MCS32 not supported");
 		return 0;
 	} else if (!mcs32 && rate) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_ATHEROS:
 			novap_reset(dut, intf, 1);
 			ath_sta_set_11nrates(dut, intf, rate);
@@ -8331,7 +8333,7 @@
 
 	val = get_param(cmd, "TxBF");
 	if (val && (strcmp(val, "1") == 0 || strcasecmp(val, "Enable") == 0)) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_WCN:
 			if (sta_set_tx_beamformee(dut, intf, 1)) {
 				send_resp(dut, conn, SIGMA_ERROR,
@@ -8360,7 +8362,7 @@
 
 	val = get_param(cmd, "MU_TxBF");
 	if (val && (strcmp(val, "1") == 0 || strcasecmp(val, "Enable") == 0)) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_ATHEROS:
 			ath_sta_set_txsp_stream(dut, intf, "1SS");
 			ath_sta_set_rxsp_stream(dut, intf, "1SS");
@@ -8677,7 +8679,7 @@
 
 	val = get_param(cmd, "txBandwidth");
 	if (val) {
-		switch (get_driver_type()) {
+		switch (get_driver_type(dut)) {
 		case DRIVER_WCN:
 			if (wcn_sta_set_width(dut, intf, val) < 0) {
 				send_resp(dut, conn, SIGMA_ERROR,
@@ -8798,7 +8800,7 @@
 			buf_size = 256;
 		else
 			buf_size = 64;
-		if (get_driver_type() == DRIVER_WCN &&
+		if (get_driver_type(dut) == DRIVER_WCN &&
 		    sta_set_addba_buf_size(dut, intf, buf_size)) {
 			send_resp(dut, conn, SIGMA_ERROR,
 				  "ErrorCode,set addbaresp_buff_size failed");
@@ -8814,7 +8816,7 @@
 			buf_size = 256;
 		else
 			buf_size = 64;
-		if (get_driver_type() == DRIVER_WCN &&
+		if (get_driver_type(dut) == DRIVER_WCN &&
 		    sta_set_addba_buf_size(dut, intf, buf_size)) {
 			send_resp(dut, conn, SIGMA_ERROR,
 				  "ErrorCode,set addbareq_buff_size failed");
@@ -9204,7 +9206,7 @@
 						struct sigma_conn *conn,
 						struct sigma_cmd *cmd)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_ATHEROS:
 		return ath_sta_send_addba(dut, conn, cmd);
 	case DRIVER_WCN:
@@ -9397,28 +9399,28 @@
 	char result[32], ssid[100];
 	size_t ssid_len;
 
-	if (get_wpa_status(get_station_ifname(), "wpa_state", result,
+	if (get_wpa_status(get_station_ifname(dut), "wpa_state", result,
 			   sizeof(result)) < 0 ||
 	    strncmp(result, "COMPLETED", 9) != 0) {
 		send_resp(dut, conn, SIGMA_ERROR, "errorCode,Not connected");
 		return 0;
 	}
 
-	if (get_wpa_status(get_station_ifname(), "bssid", bssid, sizeof(bssid))
-	    < 0) {
+	if (get_wpa_status(get_station_ifname(dut), "bssid",
+			   bssid, sizeof(bssid)) < 0) {
 		send_resp(dut, conn, SIGMA_ERROR, "errorCode,Could not get "
 			  "current BSSID");
 		return 0;
 	}
 
-	if (get_wpa_status(get_station_ifname(), "address", addr, sizeof(addr))
-	    < 0) {
+	if (get_wpa_status(get_station_ifname(dut), "address",
+			   addr, sizeof(addr)) < 0) {
 		send_resp(dut, conn, SIGMA_ERROR, "errorCode,Could not get "
 			  "own MAC address");
 		return 0;
 	}
 
-	if (get_wpa_status(get_station_ifname(), "ssid", ssid, sizeof(ssid))
+	if (get_wpa_status(get_station_ifname(dut), "ssid", ssid, sizeof(ssid))
 	    < 0) {
 		send_resp(dut, conn, SIGMA_ERROR, "errorCode,Could not get "
 			  "current SSID");
@@ -9965,7 +9967,7 @@
 	else
 		return -2;
 
-	if (get_wpa_status(get_station_ifname(), "address", addr,
+	if (get_wpa_status(get_station_ifname(dut), "address", addr,
 			   sizeof(addr)) < 0)
 		return -2;
 	hwaddr_aton(addr, (unsigned char *) src);
@@ -9988,7 +9990,7 @@
 	memcpy(pos, &taddr.sin_addr, 4);
 	pos += 4;
 
-	s = open_monitor(get_station_ifname());
+	s = open_monitor(get_station_ifname(dut));
 	if (s < 0) {
 		send_resp(dut, conn, SIGMA_ERROR, "errorCode,Failed to open "
 			  "monitor socket");
@@ -10019,7 +10021,7 @@
 	if (if_nametoindex("sigmadut") == 0) {
 		snprintf(buf, sizeof(buf),
 			 "iw dev %s interface add sigmadut type monitor",
-			 get_station_ifname());
+			 get_station_ifname(dut));
 		if (system(buf) != 0 ||
 		    if_nametoindex("sigmadut") == 0) {
 			sigma_dut_print(dut, DUT_MSG_ERROR, "Failed to add "
@@ -10270,7 +10272,7 @@
 				  struct sigma_cmd *cmd)
 {
 	const char *val;
-	char *ifname;
+	const char *ifname;
 	int chwidth, nss;
 
 	val = get_param(cmd, "framename");
@@ -10280,7 +10282,7 @@
 
 	/* Command sequence to generate Op mode notification */
 	if (val && strcasecmp(val, "Op_md_notif_frm") == 0) {
-		ifname = get_station_ifname();
+		ifname = get_station_ifname(dut);
 
 		/* Disable STBC */
 		run_iwpriv(dut, ifname, "tx_stbc 0");
@@ -10342,7 +10344,7 @@
 				  struct sigma_conn *conn,
 				  struct sigma_cmd *cmd)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_ATHEROS:
 		return ath_sta_send_frame_vht(dut, conn, cmd);
 	default:
@@ -10393,7 +10395,7 @@
 				 struct sigma_conn *conn,
 				 struct sigma_cmd *cmd)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_WCN:
 		return wcn_sta_send_frame_he(dut, conn, cmd);
 	default:
@@ -10475,7 +10477,7 @@
 		return -1;
 	}
 
-	if (get_wpa_status(get_station_ifname(), "address",
+	if (get_wpa_status(get_station_ifname(dut), "address",
 			   src_mac, sizeof(src_mac)) < 0 ||
 	    parse_mac_address(dut, src_mac, &hdr->addr2[0]) ||
 	    parse_mac_address(dut, dest_mac, &hdr->addr1[0]))
@@ -10639,7 +10641,7 @@
 				  struct sigma_conn *conn,
 				  struct sigma_cmd *cmd)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 #ifdef __linux__
 	case DRIVER_WIL6210:
 		return wil6210_send_frame_60g(dut, conn, cmd);
@@ -10892,7 +10894,7 @@
 	if (if_nametoindex("sigmadut") == 0) {
 		snprintf(buf, sizeof(buf),
 			 "iw dev %s interface add sigmadut type monitor",
-			 get_station_ifname());
+			 get_station_ifname(dut));
 		if (system(buf) != 0 ||
 		    if_nametoindex("sigmadut") == 0) {
 			sigma_dut_print(dut, DUT_MSG_ERROR, "Failed to add "
@@ -11223,8 +11225,8 @@
 		return 1;
 	}
 
-	if (strcmp(intf, get_main_ifname()) != 0 &&
-	    strcmp(intf, get_station_ifname()) != 0) {
+	if (strcmp(intf, get_main_ifname(dut)) != 0 &&
+	    strcmp(intf, get_station_ifname(dut)) != 0) {
 		send_resp(dut, conn, SIGMA_ERROR,
 			  "ErrorCode,Unknown interface");
 		return 0;
@@ -11355,7 +11357,7 @@
 				    struct sigma_conn *conn,
 				    struct sigma_cmd *cmd)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_ATHEROS:
 		return ath_sta_set_rfeature_vht(intf, dut, conn, cmd);
 	default:
@@ -11612,7 +11614,7 @@
 				   struct sigma_conn *conn,
 				   struct sigma_cmd *cmd)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 	case DRIVER_WCN:
 		return wcn_sta_set_rfeature_he(intf, dut, conn, cmd);
 	default:
@@ -11815,7 +11817,7 @@
 static int sta_set_60g_ese(struct sigma_dut *dut, int count,
 			   struct sigma_ese_alloc *allocs)
 {
-	switch (get_driver_type()) {
+	switch (get_driver_type(dut)) {
 #ifdef __linux__
 	case DRIVER_WIL6210:
 		if (wil6210_set_ese(dut, count, allocs))
@@ -11957,7 +11959,7 @@
 		 */
 		if (powersave && strcasecmp(powersave, "unscheduled") == 0)
 			res = set_ps(intf, dut, 1);
-	} else if (prog && get_driver_type() == DRIVER_WCN &&
+	} else if (prog && get_driver_type(dut) == DRIVER_WCN &&
 		   strcasecmp(prog, "HE") == 0) {
 		return cmd_sta_set_power_save_he(intf, dut, conn, cmd);
 	} else {
@@ -12639,7 +12641,7 @@
 
 	val = get_param(cmd, "GetParameter");
 	if (val && strcmp(val, "SSID_BSSID") == 0) {
-		if (get_wpa_ssid_bssid(dut, get_station_ifname(),
+		if (get_wpa_ssid_bssid(dut, get_station_ifname(dut),
 				       buf, sizeof(buf)) < 0) {
 			sigma_dut_print(dut, DUT_MSG_ERROR,
 					"Could not get ssid bssid");
@@ -12789,7 +12791,7 @@
 	const char *val;
 	int v;
 
-	wpa_command(get_station_ifname(), "PMKSA_FLUSH");
+	wpa_command(get_station_ifname(dut), "PMKSA_FLUSH");
 
 	memset(&tm, 0, sizeof(tm));
 	val = get_param(cmd, "seconds");
@@ -12995,7 +12997,7 @@
 	const char *keymgmt, *cipher;
 
 	if (intf == NULL)
-		intf = get_main_ifname();
+		intf = get_main_ifname(dut);
 
 	if (!bssid) {
 		send_resp(dut, conn, SIGMA_ERROR,
@@ -13130,7 +13132,7 @@
 
 	/* 60G WPS tests do not pass Interface parameter */
 	if (!intf)
-		intf = get_main_ifname();
+		intf = get_main_ifname(dut);
 
 	if (dut->mode == SIGMA_MODE_AP)
 		return ap_wps_registration(dut, conn, cmd);
@@ -13154,7 +13156,7 @@
 	    strcasecmp(network_mode, "PBSS") == 0) {
 		sigma_dut_print(dut, DUT_MSG_DEBUG,
 				"Set PBSS network mode, network id %d", id);
-		if (set_network(get_station_ifname(), id, "pbss", "1") < 0)
+		if (set_network(get_station_ifname(dut), id, "pbss", "1") < 0)
 			return -2;
 	}
 
diff --git a/traffic.c b/traffic.c
index d89b9ed..5ae38ba 100644
--- a/traffic.c
+++ b/traffic.c
@@ -119,7 +119,7 @@
 		snprintf(int_arg, sizeof(int_arg), " -i %f", interval);
 	if (!dut->ndp_enable && type == 2)
 		snprintf(intf_arg, sizeof(intf_arg), " -I %s",
-			 get_station_ifname());
+			 get_station_ifname(dut));
 	else
 		intf_arg[0] = '\0';
 	fprintf(f, "#!" SHELL "\n"
@@ -291,7 +291,7 @@
 	if (dut->ndpe)
 		ifname = "nan0";
 	else
-		ifname = get_station_ifname();
+		ifname = get_station_ifname(dut);
 
 	val = get_param(cmd, "duration");
 	if (val)
diff --git a/traffic_agent.c b/traffic_agent.c
index d9b499d..cb0c7a0 100644
--- a/traffic_agent.c
+++ b/traffic_agent.c
@@ -1205,7 +1205,7 @@
 		 */
 		s->dut = dut;
 		val = get_param(cmd, "Interface");
-		strlcpy(s->ifname, (val ? val : get_station_ifname()),
+		strlcpy(s->ifname, (val ? val : get_station_ifname(dut)),
 			sizeof(s->ifname));
 
 		sigma_dut_print(dut, DUT_MSG_DEBUG, "Traffic agent: start "
diff --git a/utils.c b/utils.c
index db6fc39..3fcb227 100644
--- a/utils.c
+++ b/utils.c
@@ -45,7 +45,7 @@
 }
 
 
-enum driver_type get_driver_type(void)
+enum driver_type get_driver_type(struct sigma_dut *dut)
 {
 	struct stat s;
 	if (wifi_chip_type == DRIVER_NOT_SET) {
@@ -53,7 +53,7 @@
 		ssize_t len;
 		char link[256];
 		char buf[256];
-		char *ifname = get_station_ifname();
+		const char *ifname = get_station_ifname(dut);
 
 		snprintf(buf, sizeof(buf), "/sys/class/net/%s/device/driver",
 			 ifname);
@@ -220,7 +220,7 @@
 {
 	return dut->program == PROGRAM_60GHZ ||
 		(dut->program == PROGRAM_WPS &&
-		 (get_driver_type() == DRIVER_WIL6210));
+		 (get_driver_type(dut) == DRIVER_WIL6210));
 }
 
 
diff --git a/wpa_helpers.c b/wpa_helpers.c
index cb7d117..3380cac 100644
--- a/wpa_helpers.c
+++ b/wpa_helpers.c
@@ -23,9 +23,9 @@
 extern char *sigma_hapd_ctrl;
 
 
-char * get_main_ifname(void)
+const char * get_main_ifname(struct sigma_dut *dut)
 {
-	enum driver_type drv = get_driver_type();
+	enum driver_type drv = get_driver_type(dut);
 	enum openwrt_driver_type openwrt_drv = get_openwrt_driver_type();
 
 	if (sigma_main_ifname)
@@ -61,7 +61,7 @@
 }
 
 
-char * get_station_ifname(void)
+const char * get_station_ifname(struct sigma_dut *dut)
 {
 	if (sigma_station_ifname)
 		return sigma_station_ifname;
@@ -81,22 +81,22 @@
 }
 
 
-const char * get_p2p_ifname(const char *primary_ifname)
+const char * get_p2p_ifname(struct sigma_dut *dut, const char *primary_ifname)
 {
-	if (strcmp(get_station_ifname(), primary_ifname) != 0)
+	if (strcmp(get_station_ifname(dut), primary_ifname) != 0)
 		return primary_ifname;
 
 	if (sigma_p2p_ifname)
 		return sigma_p2p_ifname;
 
-	return get_station_ifname();
+	return get_station_ifname(dut);
 }
 
 
 void dut_ifc_reset(struct sigma_dut *dut)
 {
 	char buf[256];
-	char *ifc = get_station_ifname();
+	const char *ifc = get_station_ifname(dut);
 
 	snprintf(buf, sizeof(buf), "ifconfig %s down", ifc);
 	run_system(dut, buf);
@@ -663,7 +663,7 @@
 {
 	FILE *f;
 	char buf[256];
-	char *ifname;
+	const char *ifname;
 	char *tmp, *pos;
 
 	if (dut->mode == SIGMA_MODE_STATION)
@@ -700,7 +700,7 @@
 
 	dut->mode = SIGMA_MODE_STATION;
 
-	ifname = get_main_ifname();
+	ifname = get_main_ifname(dut);
 	if (wpa_command(ifname, "PING") == 0)
 		return 0; /* wpa_supplicant is already running */
 
@@ -763,7 +763,7 @@
 void stop_sta_mode(struct sigma_dut *dut)
 {
 	if (is_60g_sigma_dut(dut)) {
-		wpa_command(get_main_ifname(), "TERMINATE");
+		wpa_command(get_main_ifname(dut), "TERMINATE");
 		return;
 	}
 
diff --git a/wpa_helpers.h b/wpa_helpers.h
index 021dccb..72c191c 100644
--- a/wpa_helpers.h
+++ b/wpa_helpers.h
@@ -10,9 +10,9 @@
 #ifndef WPA_HELPERS_H
 #define WPA_HELPERS_H
 
-char * get_main_ifname(void);
-char * get_station_ifname(void);
-const char * get_p2p_ifname(const char *primary_ifname);
+const char * get_main_ifname(struct sigma_dut *dut);
+const char * get_station_ifname(struct sigma_dut *dut);
+const char * get_p2p_ifname(struct sigma_dut *dut, const char *primary_ifname);
 void dut_ifc_reset(struct sigma_dut *dut);
 
 int wpa_command(const char *ifname, const char *cmd);