sta_set_rfeature: Add support to override OCI channel information
When STA is being used as a testbed device, the OCI channel information
needs to be configured to the specified value to test AP behavior while
parsing the OCI elements. Add support to configure testbed STA to use
the specified channel information in the OCI element.
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
diff --git a/sta.c b/sta.c
index dd7f967..6ba53a2 100644
--- a/sta.c
+++ b/sta.c
@@ -12070,7 +12070,7 @@
struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
- const char *val;
+ const char *val, *oci_chan, *oci_frametype;
val = get_param(cmd, "ReassocReq_RSNXE_Used");
if (val && atoi(val) == 1) {
@@ -12081,6 +12081,43 @@
}
return SUCCESS_SEND_STATUS;
}
+
+ oci_chan = get_param(cmd, "OCIChannel");
+ oci_frametype = get_param(cmd, "OCIFrameType");
+ if (oci_chan && oci_frametype) {
+ unsigned int oci_freq = channel_to_freq(dut, atoi(oci_chan));
+ char buf[100];
+
+ if (!oci_freq) {
+ send_resp(dut, conn, SIGMA_ERROR,
+ "errorCode,Invalid OCIChannel number");
+ return STATUS_SENT_ERROR;
+ }
+
+ if (strcasecmp(oci_frametype, "eapolM2") == 0) {
+ snprintf(buf, sizeof(buf),
+ "SET oci_freq_override_eapol %d", oci_freq);
+ } else if (strcasecmp(oci_frametype, "SAQueryReq") == 0) {
+ snprintf(buf, sizeof(buf),
+ "SET oci_freq_override_saquery_req %d",
+ oci_freq);
+ } else if (strcasecmp(oci_frametype, "SAQueryResp") == 0) {
+ snprintf(buf, sizeof(buf),
+ "SET oci_freq_override_saquery_resp %d",
+ oci_freq);
+ } else {
+ send_resp(dut, conn, SIGMA_ERROR,
+ "errorCode,Unsupported OCIFrameType");
+ return STATUS_SENT_ERROR;
+ }
+ if (wpa_command(intf, buf) < 0) {
+ send_resp(dut, conn, SIGMA_ERROR,
+ "errorCode,Failed to set oci_freq_override");
+ return STATUS_SENT_ERROR;
+ }
+ return SUCCESS_SEND_STATUS;
+ }
+
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported WPA3 rfeature");
return STATUS_SENT_ERROR;