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.
This commit is contained in:
James Prestwood 2019-05-13 14:29:25 -07:00 committed by Denis Kenzior
parent 2d173e5f24
commit f038c11205
1 changed files with 30 additions and 7 deletions

View File

@ -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,
&params.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, &params);
wiphy->can_ap = true;