Re: [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]

 



On Mon, Feb 03, 2025 at 12:11:32PM +0100, Quentin Feraboli wrote:
> Allow runtime reconfiguration for skip_cred_build and extra_cred.

> diff --git 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)

This is whitespace damaged (i.e., tabs converted to spaces) and does not
apply cleanly.

> +               if (os_strcasecmp(cmd, "skip_cred_build") == 0 || os_strcasecmp(cmd, "extra_cred") == 0) {
> +                       hostapd_update_wps(hapd);
> +               }

This needs to be within #ifdef CONFIG_WPS to avoid compilation issues
for builds that do not include WPS functionality.

> diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
> +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;
> +       }

No need for that if check for not-NULL.

> +       if (skip_cred_build && extra_cred == NULL) {

!extra_cred is preferred style for checking that a pointer is not NULL.

> +               reg->skip_cred_build = 0;
> +               return -1;

This is something that is not currently enforced for the initial
configuration. Why is this used here?

> +       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;
> +}

What about reg->disable_auto_conf? It is set based on skip_cred_build
and clearing skip_cred_build might imply having to clear
disable_auto_conf as well.

-- 
Jouni Malinen                                            PGP id EFC895FA

_______________________________________________
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