aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2005-06-26 02:28:32 (GMT)
committerJouni Malinen <j@w1.fi>2005-06-26 02:28:32 (GMT)
commite7cc641aea2cf073d945651105b972ba5a3e34c9 (patch)
tree6cefeb259aa32146ba704a77f0352e22da9bc5ca
parent34ab43210848f74ff8254e6ee349c4401786e84f (diff)
downloadhostap-history-e7cc641aea2cf073d945651105b972ba5a3e34c9.zip
hostap-history-e7cc641aea2cf073d945651105b972ba5a3e34c9.tar.gz
hostap-history-e7cc641aea2cf073d945651105b972ba5a3e34c9.tar.bz2
Added support for testing AssocInfo event with driver_test by adding
use_associnfo=1 to the driver_param configuration variable.
-rw-r--r--wpa_supplicant/doc/testing_tools.doxygen9
-rw-r--r--wpa_supplicant/driver_test.c26
2 files changed, 31 insertions, 4 deletions
diff --git a/wpa_supplicant/doc/testing_tools.doxygen b/wpa_supplicant/doc/testing_tools.doxygen
index 511be7b..7430531 100644
--- a/wpa_supplicant/doc/testing_tools.doxygen
+++ b/wpa_supplicant/doc/testing_tools.doxygen
@@ -253,4 +253,13 @@ ap1: STA 02:2a:c4:18:5b:f3 WPA: pairwise key handshake completed (WPA)
ap1: STA 02:2a:c4:18:5b:f3 WPA: group key handshake completed (WPA)
\endverbatim
+By default, driver_param is simulating a driver that uses the WPA/RSN
+IE generated by %wpa_supplicant. Driver-generated IE and AssocInfo
+events can be tested by adding \a use_associnfo=1 to the \a driver_param
+line in the configuration file. For example:
+
+\verbatim
+driver_param=test_socket=/tmp/Test/ap1 use_associnfo=1
+\endverbatim
+
*/
diff --git a/wpa_supplicant/driver_test.c b/wpa_supplicant/driver_test.c
index 43f6f87..3d366be 100644
--- a/wpa_supplicant/driver_test.c
+++ b/wpa_supplicant/driver_test.c
@@ -39,6 +39,9 @@ struct wpa_driver_test_data {
size_t ssid_len;
struct wpa_scan_result scanres;
size_t num_scanres;
+ int use_associnfo;
+ u8 assoc_wpa_ie[80];
+ size_t assoc_wpa_ie_len;
};
@@ -126,7 +129,13 @@ static int wpa_driver_test_associate(
if (params->wpa_ie) {
wpa_hexdump(MSG_DEBUG, " wpa_ie",
params->wpa_ie, params->wpa_ie_len);
- }
+ drv->assoc_wpa_ie_len = params->wpa_ie_len;
+ if (drv->assoc_wpa_ie_len > sizeof(drv->assoc_wpa_ie))
+ drv->assoc_wpa_ie_len = sizeof(drv->assoc_wpa_ie);
+ memcpy(drv->assoc_wpa_ie, params->wpa_ie,
+ drv->assoc_wpa_ie_len);
+ } else
+ drv->assoc_wpa_ie_len = 0;
if (drv->test_socket >= 0) {
char cmd[200], *pos, *end;
@@ -292,6 +301,13 @@ static void wpa_driver_test_assocresp(struct wpa_driver_test_data *drv,
wpa_printf(MSG_DEBUG, "test_driver: invalid BSSID in "
"assocresp");
}
+ if (drv->use_associnfo) {
+ union wpa_event_data event;
+ memset(&event, 0, sizeof(event));
+ event.assoc_info.req_ies = drv->assoc_wpa_ie;
+ event.assoc_info.req_ies_len = drv->assoc_wpa_ie_len;
+ wpa_supplicant_event(drv->ctx, EVENT_ASSOCINFO, &event);
+ }
wpa_supplicant_event(drv->ctx, EVENT_ASSOC, NULL);
}
@@ -462,9 +478,6 @@ static int wpa_driver_test_set_param(void *priv, const char *param)
if (param == NULL)
return 0;
- /* TODO: create own socket, e.g.,
- * /tmp/wpa_supplicant-driver-test-cli-<PID>-<cnt>-<own_addr>
- * and attach to hostapd if test_socket=path is set in param. */
wpa_driver_test_close_test_socket(drv);
pos = strstr(param, "test_socket=");
if (pos) {
@@ -482,6 +495,11 @@ static int wpa_driver_test_set_param(void *priv, const char *param)
wpa_driver_test_attach(drv);
}
+ if (strstr(param, "use_associnfo=1")) {
+ wpa_printf(MSG_DEBUG, "test_driver: Use AssocInfo events");
+ drv->use_associnfo = 1;
+ }
+
return 0;
}