]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Add DPP_LISTEN and DPP_STOP_LISTEN to hostapd
authorJouni Malinen <jouni@qca.qualcomm.com>
Sat, 4 Nov 2017 09:27:00 +0000 (11:27 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 4 Nov 2017 10:33:03 +0000 (12:33 +0200)
This is an initial step in allowing non-operating channel operations
with DPP when hostapd is the Responder. For now, this is only used for
specifying role=configurator/enrollee and qr=mutual cases similarly to
the wpa_supplicant configuration for in Responder role. Request to use a
non-operating channel will be rejected.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
hostapd/ctrl_iface.c
src/ap/dpp_hostapd.c
src/ap/dpp_hostapd.h

index 2e9c4c735e11407588864dff853ab37da27fb8b6..181760c21c92ec2b6fe11ef44450d7308c5a41d8 100644 (file)
@@ -3018,6 +3018,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
        } else if (os_strncmp(buf, "DPP_AUTH_INIT ", 14) == 0) {
                if (hostapd_dpp_auth_init(hapd, buf + 13) < 0)
                        reply_len = -1;
+       } else if (os_strncmp(buf, "DPP_LISTEN ", 11) == 0) {
+               if (hostapd_dpp_listen(hapd, buf + 11) < 0)
+                       reply_len = -1;
+       } else if (os_strcmp(buf, "DPP_STOP_LISTEN") == 0) {
+               hostapd_dpp_listen_stop(hapd);
        } else if (os_strncmp(buf, "DPP_CONFIGURATOR_ADD", 20) == 0) {
                res = hostapd_dpp_configurator_add(hapd, buf + 20);
                if (res < 0) {
index 45495f3b86e9c9a6a606e32d437b4a1f3d3ec616..f715e1578c266f0996ca281ef08dd9242316d6e9 100644 (file)
@@ -543,6 +543,41 @@ fail:
 }
 
 
+int hostapd_dpp_listen(struct hostapd_data *hapd, const char *cmd)
+{
+       int freq;
+
+       freq = atoi(cmd);
+       if (freq <= 0)
+               return -1;
+
+       if (os_strstr(cmd, " role=configurator"))
+               hapd->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR;
+       else if (os_strstr(cmd, " role=enrollee"))
+               hapd->dpp_allowed_roles = DPP_CAPAB_ENROLLEE;
+       else
+               hapd->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR |
+                       DPP_CAPAB_ENROLLEE;
+       hapd->dpp_qr_mutual = os_strstr(cmd, " qr=mutual") != NULL;
+
+       if (freq != hapd->iface->freq && hapd->iface->freq > 0) {
+               /* TODO: Listen operation on non-operating channel */
+               wpa_printf(MSG_INFO,
+                          "DPP: Listen operation on non-operating channel (%d MHz) is not yet supported (operating channel: %d MHz)",
+                          freq, hapd->iface->freq);
+               return -1;
+       }
+
+       return 0;
+}
+
+
+void hostapd_dpp_listen_stop(struct hostapd_data *hapd)
+{
+       /* TODO: Stop listen operation on non-operating channel */
+}
+
+
 static void hostapd_dpp_rx_auth_req(struct hostapd_data *hapd, const u8 *src,
                                    const u8 *hdr, const u8 *buf, size_t len,
                                    unsigned int freq)
index d870b205118a38a856108e8b5dd1b0c62280cd79..f9d0efec2120fd98d58bffd210bca2c0d5b3a487 100644 (file)
@@ -17,6 +17,8 @@ const char * hostapd_dpp_bootstrap_get_uri(struct hostapd_data *hapd,
 int hostapd_dpp_bootstrap_info(struct hostapd_data *hapd, int id,
                               char *reply, int reply_size);
 int hostapd_dpp_auth_init(struct hostapd_data *hapd, const char *cmd);
+int hostapd_dpp_listen(struct hostapd_data *hapd, const char *cmd);
+void hostapd_dpp_listen_stop(struct hostapd_data *hapd);
 void hostapd_dpp_rx_action(struct hostapd_data *hapd, const u8 *src,
                           const u8 *buf, size_t len, unsigned int freq);
 void hostapd_dpp_tx_status(struct hostapd_data *hapd, const u8 *dst,