[PATCH] WPS: Reconfigure WPS when skip_cred_build or extra_cred parameters are set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow runtime reconfiguration for skip_cred_build and extra_cred.

Signed-off-by: Quentin Feraboli <quentin.feraboli@xxxxxxxxxxxxxx>
---
 hostapd/ctrl_iface.c    |  3 +++
 src/ap/wps_hostapd.c    | 12 ++++++++++++
 src/wps/wps.h           |  4 ++++
 src/wps/wps_registrar.c | 28 ++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+)

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index e282faacc..a37bdb97b 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1305,6 +1305,9 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
                if (ret)
                        return ret;

+               if (os_strcasecmp(cmd, "skip_cred_build") == 0 || os_strcasecmp(cmd, "extra_cred") == 0) {
+                       hostapd_update_wps(hapd);
+               }
                if (os_strcasecmp(cmd, "deny_mac_file") == 0) {
                        hostapd_disassoc_deny_mac(hapd);
                } else if (os_strcasecmp(cmd, "accept_mac_file") == 0) {
diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
index 82d4d5fdd..28cd7e90f 100644
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -1425,6 +1425,17 @@ static int hostapd_wps_update_multi_ap(struct hostapd_data *hapd,
        return ret;
 }

+static int hostapd_wps_update_extra_cred(struct hostapd_data *hapd,
+                                      struct wps_registrar *reg)
+{
+       struct hostapd_bss_config *conf = hapd->conf;
+
+       return wps_registrar_update_extra_cred(
+               reg, conf->skip_cred_build,
+               conf->extra_cred,
+               conf->extra_cred_len
+               );
+}

 void hostapd_deinit_wps(struct hostapd_data *hapd)
 {
@@ -1501,6 +1512,7 @@ void hostapd_update_wps(struct hostapd_data *hapd)
        }

        hostapd_wps_update_multi_ap(hapd, wps->registrar);
+       hostapd_wps_update_extra_cred(hapd, wps->registrar);

        hostapd_wps_set_vendor_ext(hapd, wps);
        hostapd_wps_set_application_ext(hapd, wps);
diff --git a/src/wps/wps.h b/src/wps/wps.h
index b99ae9499..1e32db4b2 100644
--- a/src/wps/wps.h
+++ b/src/wps/wps.h
@@ -887,6 +887,10 @@ int wps_registrar_update_multi_ap(struct wps_registrar *reg,
                                  size_t multi_ap_backhaul_ssid_len,
                                  const u8 *multi_ap_backhaul_network_key,
                                  size_t multi_ap_backhaul_network_key_len);
+int wps_registrar_update_extra_cred(struct wps_registrar *reg,
+                                 int skip_cred_build,
+                                 const u8 *extra_cred,
+                                 size_t extra_cred_len);

 int wps_build_credential_wrap(struct wpabuf *msg,
                              const struct wps_credential *cred);
diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
index f49784f95..f27577176 100644
--- a/src/wps/wps_registrar.c
+++ b/src/wps/wps_registrar.c
@@ -3686,6 +3686,34 @@ int wps_registrar_update_multi_ap(struct wps_registrar *reg,
        return 0;
 }

+int wps_registrar_update_extra_cred(struct wps_registrar *reg,
+                                 int skip_cred_build,
+                                 const u8 *extra_cred,
+                                 size_t extra_cred_len)
+{
+       if (reg->extra_cred != NULL) {
+               wpabuf_clear_free(reg->extra_cred);
+               reg->extra_cred = NULL;
+       }
+
+       if (skip_cred_build && extra_cred == NULL) {
+               reg->skip_cred_build = 0;
+               return -1;
+       }
+
+       if (skip_cred_build) {
+               reg->extra_cred = wpabuf_alloc_copy(extra_cred,
+                                           extra_cred_len);
+               if (reg->extra_cred == NULL) {
+                       reg->skip_cred_build = 0;
+                       return -1;
+               }
+       }
+
+       reg->skip_cred_build = skip_cred_build;
+
+       return 0;
+}

 #ifdef CONFIG_WPS_NFC

--
2.34.1

-- This message and any attachments herein are, unless otherwise stated, confidential, intended solely for the addressees and are SoftAtHome’s ownership. Any unauthorized use, reproduction or dissemination is prohibited unless formaly agreed beforehand by the sender. If you are not the intended addressee of this message, please immediately delete it and all its attachments from your computer system and notify the sender. SoftAtHome reserves the right to monitor all email communications through its networks. Any views or opinions presented are solely those of its author and do not necessarily represent those of SoftAtHome. The internet cannot guarantee the integrity of this message. SoftAtHome not shall be liable for the message if altered, changed or falsified. While we take all reasonable precautions to ensure that viruses are not transmitted via emails, we recommend that you take your own measures to prevent viruses from entering your computer system. SoftAtHome is a French Société Anonyme with a Board of Directors, having a capital of 6 450 699 Euros having its registered office located at 9-11 rue du débarcadère – 92700 – Colombes – France – Tel + 33 (0)1 57 66 88 88 – Fax + 33 (0)1 57 66 88 89 - RCS Nanterre B 500 440 813 – Intra-Community VAT: FR 04500440813 -- Ce message et toutes les pièces jointes qui y sont incluses sont, sauf indication contraire, confidentiels, destinés uniquement aux destinataires et sont la propriété de SoftAtHome. Toute utilisation non autorisée, reproduction ou diffusion est interdite, sauf accord formel préalable de l'expéditeur. Si vous n'êtes pas le destinataire prévu de ce message, veuillez le supprimer immédiatement ainsi que toutes ses pièces jointes de votre système informatique et en informer l'expéditeur. SoftAtHome se réserve le droit de surveiller toutes les communications par e-mail via ses réseaux. Les opinions exprimées dans ce message sont celles de leur auteur et ne représentent pas nécessairement celles de SoftAtHome. L’Intern
et ne permettant pas d’assurer l’intégrité de ce message, SoftAtHome décline toute responsabilité à ce titre, dans l’hypothèse où il aurait été altéré, déformé ou falsifié. Par ailleurs et malgré toutes les précautions prises pour éviter la présence de virus dans nos envois, nous vous recommandons de prendre, de votre côté, les mesures permettant d'assurer la non-introduction de virus dans votre système informatique. SoftAtHome est une Société Anonyme française à Conseil d’Administration ayant un capital de 6 450 699 euros, dont le siège social est situé au 9-11 rue du débarcadère - 92700 - Colombes - France - Tel + 33 (0)1 57 66 88 88 - Fax + 33 (0)1 57 66 88 89 RCS Nanterre B 500 440 813 - TVA intracommunautaire : FR 04500440813

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux