[PATCH] Skip PSK re-calculation when psk/ssid is not modified

Jouni Malinen j
Sat Nov 9 08:34:21 PST 2013


On Mon, Oct 28, 2013 at 04:18:31PM +0900, Masashi Honma wrote:
> diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c

> +    if (os_strcmp(name, "psk") == 0 && value[0] == '"' && ssid->ssid_len) {
> +        if (ssid->passphrase) {
> +            if (os_strlen(ssid->passphrase) !=
> +                os_strlen(value) - 2 ||
> +                os_memcmp(ssid->passphrase, &value[1],
> +                os_strlen(ssid->passphrase)) != 0)
> +                update_psk = 1;
> +        } else {
> +            update_psk = 1;
> +        }
> +    }
...

> -    if ((os_strcmp(name, "psk") == 0 &&
> -         value[0] == '"' && ssid->ssid_len) ||
> -        (os_strcmp(name, "ssid") == 0 && ssid->passphrase))
> +    if (update_psk)
>          wpa_config_update_psk(ssid);


Could you please clarify what is the use case that this is addressing?
If I understood the implementation correctly, this skips
wpa_config_update_psk() call in case someone tries to set psk or ssid to
the existing value of the field. Why would such corner cases need to be
handled? Wouldn't it be better to fix whatever is sending such pointless
commands to not do that? In other words, I would need to get quite a bit
better justification for this type of extra complexity in
wpa_supplicant.


PS.

The patch was severely whitespace damaged and as such, would require
manual editing from me to get it applied..

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list