DPP: Determine own DPPConfEnrolleeRole if needed
DPPSelfConfigure,yes may be used without explicitly specifying
DPPConfEnrolleeRole. For that to work on the AP side, figure out the
suitable role based on last use {ap,sta}_reset_default instead of
assuming STA role.
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
diff --git a/dpp.c b/dpp.c
index 56ad9d6..4a3d4de 100644
--- a/dpp.c
+++ b/dpp.c
@@ -574,6 +574,7 @@
const char *groups_override = NULL;
const char *result;
int check_mutual = 0;
+ int enrollee_ap;
if (!wait_conn)
wait_conn = "no";
@@ -592,6 +593,12 @@
return 0;
}
+ val = get_param(cmd, "DPPConfEnrolleeRole");
+ if (val)
+ enrollee_ap = strcasecmp(val, "AP") == 0;
+ else
+ enrollee_ap = sigma_dut_is_ap(dut);
+
if ((step || frametype) && (!step || !frametype)) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Invalid DPPStep,DPPFrameType,DPPIEAttribute combination");
@@ -699,7 +706,6 @@
val = get_param(cmd, "DPPConfIndex");
if (val)
conf_index = atoi(val);
- val = get_param(cmd, "DPPConfEnrolleeRole");
switch (conf_index) {
case -1:
conf_role = NULL;
@@ -707,7 +713,7 @@
case 1:
ascii2hexstr("DPPNET01", buf);
snprintf(conf_ssid, sizeof(conf_ssid), "ssid=%s", buf);
- if (val && strcasecmp(val, "AP") == 0) {
+ if (enrollee_ap) {
conf_role = "ap-dpp";
groups_override = "[{\"groupId\":\"DPPGROUP_DPP_INFRA\",\"netRole\":\"ap\"}]";
} else {
@@ -720,7 +726,7 @@
snprintf(conf_ssid, sizeof(conf_ssid), "ssid=%s", buf);
snprintf(conf_pass, sizeof(conf_pass),
"psk=10506e102ad1e7f95112f6b127675bb8344dacacea60403f3fa4055aec85b0fc");
- if (val && strcasecmp(val, "AP") == 0)
+ if (enrollee_ap)
conf_role = "ap-psk";
else
conf_role = "sta-psk";
@@ -730,7 +736,7 @@
snprintf(conf_ssid, sizeof(conf_ssid), "ssid=%s", buf);
ascii2hexstr("ThisIsDppPassphrase", buf);
snprintf(conf_pass, sizeof(conf_pass), "pass=%s", buf);
- if (val && strcasecmp(val, "AP") == 0)
+ if (enrollee_ap)
conf_role = "ap-psk";
else
conf_role = "sta-psk";
@@ -738,7 +744,7 @@
case 4:
ascii2hexstr("DPPNET01", buf);
snprintf(conf_ssid, sizeof(conf_ssid), "ssid=%s", buf);
- if (val && strcasecmp(val, "AP") == 0) {
+ if (enrollee_ap) {
conf_role = "ap-dpp";
groups_override = "[{\"groupId\":\"DPPGROUP_DPP_INFRA2\",\"netRole\":\"ap\"}]";
} else {