DPP: Start unconfigured AP without beaconing
This allows hostapd to perform DPP Initiator operations to provision the
AP without having to depend on the driver supporting offchannel
operations while beaconing. This applies only for the initial
provisioning step and being able to act as an Initiator/Configurator for
additional DPP exchanges may still need support for offchannel
operations. If a DPP Responder operation is requested, start beaconing
to get the AP listening on its operating channel.
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
diff --git a/ap.c b/ap.c
index 07a3cad..9487bbc 100644
--- a/ap.c
+++ b/ap.c
@@ -7628,6 +7628,8 @@
fprintf(f, "ssid=QCA AP OOB\n");
if (dut->ap_bcnint)
fprintf(f, "beacon_int=%d\n", dut->ap_bcnint);
+ if (dut->ap_start_disabled)
+ fprintf(f, "start_disabled=1\n");
if (dut->ap_akm_values) {
struct {
@@ -9219,6 +9221,7 @@
dut->ap_dpp_conf_addr = NULL;
free(dut->ap_dpp_conf_pkhash);
dut->ap_dpp_conf_pkhash = NULL;
+ dut->ap_start_disabled = 0;
if (is_60g_sigma_dut(dut)) {
dut->ap_mode = AP_11ad;
diff --git a/dpp.c b/dpp.c
index 5006bd6..7d99b91 100644
--- a/dpp.c
+++ b/dpp.c
@@ -38,10 +38,30 @@
dut->ap_mode = dut->ap_channel <= 14 ? AP_11ng : AP_11na;
dut->ap_key_mgmt = AP_OPEN;
dut->ap_cipher = AP_PLAIN;
+ if (!dut->ap_dpp_conf_addr || !dut->ap_dpp_conf_pkhash)
+ dut->ap_start_disabled = 1;
return cmd_ap_config_commit(dut, NULL, NULL) == 1 ? 0 : -1;
}
+static int dpp_hostapd_beacon(struct sigma_dut *dut)
+{
+ const char *ifname = dut->hostapd_ifname;
+
+ if (!dut->ap_start_disabled)
+ return 0;
+
+ if (!ifname ||
+ wpa_command(ifname, "SET start_disabled 0") < 0 ||
+ wpa_command(ifname, "DISABLE") < 0 ||
+ wpa_command(ifname, "ENABLE") < 0)
+ return -1;
+
+ dut->ap_start_disabled = 0;
+ return 0;
+}
+
+
static const char * dpp_get_curve(struct sigma_cmd *cmd, const char *arg)
{
const char *val = get_param(cmd, arg);
@@ -425,6 +445,14 @@
}
}
+ if (wpa_command(ifname, "SET start_disabled 0") < 0 &&
+ dut->ap_start_disabled) {
+ send_resp(dut, conn, SIGMA_ERROR,
+ "errorCode,Failed to update AP security parameters");
+ goto out;
+ }
+ dut->ap_start_disabled = 0;
+
/* Wait for a possible Configuration Result to be sent */
old_timeout = dut->default_timeout;
dut->default_timeout = 1;
@@ -1605,6 +1633,12 @@
dut->ap_oper_chn)
freq = channel_to_freq(dut, dut->ap_channel);
+ if (sigma_dut_is_ap(dut) && dpp_hostapd_beacon(dut) < 0) {
+ send_resp(dut, conn, SIGMA_ERROR,
+ "errorCode,Failed to start AP mode listen");
+ goto out;
+ }
+
if (strcasecmp(bs, "PKEX") == 0) {
/* default: channel 6 for PKEX */
freq = 2437;
diff --git a/sigma_dut.h b/sigma_dut.h
index f62ee3b..517f4f0 100644
--- a/sigma_dut.h
+++ b/sigma_dut.h
@@ -452,6 +452,7 @@
int ap_rts;
int ap_frgmnt;
int ap_bcnint;
+ int ap_start_disabled;
struct qos_params {
int ac;
int cwmin;