From f038c1120530edc4f8ad934b1d41d2faec9637c5 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Mon, 13 May 2019 14:29:25 -0700 Subject: [PATCH] test-runner: allow disabling of iftype/cipher Two new hardware configuration keys were added: [radX] iftype_disable=station,ap,adhoc,p2p_client,p2p_go,mesh_point cipher_disable=wep40,wep104,tkip,ccmp,bip Any of the above values are supported and can be disabled. --- tools/test-runner.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/tools/test-runner.c b/tools/test-runner.c index a7120f24..a64280d6 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -754,21 +754,35 @@ struct hwsim_radio_params { unsigned int channels; bool p2p_device; bool use_chanctx; + char *iftype_disable; + char *cipher_disable; }; static int create_hwsim_radio(const char *radio_name, struct hwsim_radio_params *params) { - char *argv[7]; + char *argv[10]; pid_t pid; + int idx = 0; /*TODO add the rest of params*/ - argv[0] = BIN_HWSIM; - argv[1] = "--create"; - argv[2] = "--name"; - argv[3] = (char *) radio_name; - argv[4] = "--nointerface"; - argv[5] = NULL; + argv[idx++] = BIN_HWSIM; + argv[idx++] = "--create"; + argv[idx++] = "--name"; + argv[idx++] = (char *) radio_name; + argv[idx++] = "--nointerface"; + + if (params->iftype_disable) { + argv[idx++] = "--iftype-disable"; + argv[idx++] = params->iftype_disable; + } + + if (params->cipher_disable) { + argv[idx++] = "--cipher-disable"; + argv[idx++] = params->cipher_disable; + } + + argv[idx] = NULL; pid = execute_program(argv, true, check_verbosity(BIN_HWSIM)); if (pid < 0) @@ -1085,6 +1099,8 @@ error_exit: #define HW_CONFIG_PHY_CHANNELS "channels" #define HW_CONFIG_PHY_CHANCTX "use_chanctx" #define HW_CONFIG_PHY_P2P "p2p_device" +#define HW_CONFIG_PHY_IFTYPE_DISABLE "iftype_disable" +#define HW_CONFIG_PHY_CIPHER_DISABLE "cipher_disable" #define HW_MIN_NUM_RADIOS 1 @@ -1143,6 +1159,13 @@ static bool configure_hw_radios(struct l_settings *hw_settings, ¶ms.use_chanctx)) params.use_chanctx = true; + params.iftype_disable = l_settings_get_string(hw_settings, + wiphy->name, + HW_CONFIG_PHY_IFTYPE_DISABLE); + params.cipher_disable = l_settings_get_string(hw_settings, + wiphy->name, + HW_CONFIG_PHY_CIPHER_DISABLE); + create: wiphy->id = create_hwsim_radio(wiphy->name, ¶ms); wiphy->can_ap = true;