diff options
author | Jouni Malinen <jouni@qca.qualcomm.com> | 2012-02-16 16:26:44 +0200 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2012-02-16 16:26:44 +0200 |
commit | 8b9d0bfa004cba666c5995e5fe0a42556765e073 (patch) | |
tree | f7007be743e6154bdf154e8fe088a9b47f4e605b | |
parent | 56c2588aa879f43aa8a208cf643f5786542ac7eb (diff) | |
download | external_wpa_supplicant_8_ti-8b9d0bfa004cba666c5995e5fe0a42556765e073.zip external_wpa_supplicant_8_ti-8b9d0bfa004cba666c5995e5fe0a42556765e073.tar.gz external_wpa_supplicant_8_ti-8b9d0bfa004cba666c5995e5fe0a42556765e073.tar.bz2 |
Add mechanism for disabling radio for testing purposes
"wpa_cli set radio_disabled 1/0" can be used to disable/enable
radio to simulate out-of-radio-range condition in a testbed
device.
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
-rw-r--r-- | src/drivers/driver.h | 12 | ||||
-rw-r--r-- | wpa_supplicant/ctrl_iface.c | 6 | ||||
-rw-r--r-- | wpa_supplicant/driver_i.h | 8 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 8db7a67..04aedcf 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2497,6 +2497,18 @@ struct wpa_driver_ops { */ void (*poll_client)(void *priv, const u8 *own_addr, const u8 *addr, int qos); + + /** + * radio_disable - Disable/enable radio + * @priv: Private driver interface data + * @disabled: 1=disable 0=enable radio + * Returns: 0 on success, -1 on failure + * + * This optional command is for testing purposes. It can be used to + * disable the radio on a testbed device to simulate out-of-radio-range + * conditions. + */ + int (*radio_disable)(void *priv, int disabled); }; diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 1489922..3602556 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -197,6 +197,12 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s, ret = pno_start(wpa_s); else ret = pno_stop(wpa_s); + } else if (os_strcasecmp(cmd, "radio_disabled") == 0) { + int disabled = atoi(value); + if (wpa_drv_radio_disable(wpa_s, disabled) < 0) + ret = -1; + else if (disabled) + wpa_supplicant_set_state(wpa_s, WPA_INACTIVE); } else { value[-1] = '='; ret = wpa_config_process_global(wpa_s->conf, cmd, -1); diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index ebbe17d..5b10540 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -657,4 +657,12 @@ static inline void wpa_drv_set_rekey_info(struct wpa_supplicant *wpa_s, wpa_s->driver->set_rekey_info(wpa_s->drv_priv, kek, kck, replay_ctr); } +static inline int wpa_drv_radio_disable(struct wpa_supplicant *wpa_s, + int disabled) +{ + if (!wpa_s->driver->radio_disable) + return -1; + return wpa_s->driver->radio_disable(wpa_s->drv_priv, disabled); +} + #endif /* DRIVER_I_H */ |