diff mbox series

[v2] Add support to configure SAE-H2E

Message ID 20230423171754.953386-1-krishna.t@nordicsemi.no
State Changes Requested
Headers show
Series [v2] Add support to configure SAE-H2E | expand

Commit Message

Krishna Chaitanya April 23, 2023, 5:17 p.m. UTC
From: krishna T <krishna.t@nordicsemi.no>

Before the control interface changes we had added a new command to set
the H2E in the WPA supplicant configuration, but this was removed, so,
add back the command that can be set through WPA cli.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
---
v2: Check and assign.
---
 wpa_supplicant/ctrl_iface.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Jouni Malinen April 28, 2023, 2:53 p.m. UTC | #1
On Sun, Apr 23, 2023 at 10:47:54PM +0530, Krishna wrote:
> Before the control interface changes we had added a new command to set
> the H2E in the WPA supplicant configuration, but this was removed, so,
> add back the command that can be set through WPA cli.

I'm not sure what that adding and removing is referring to, but why
would this new code be needed to handle the sae_pwe parameter when that
is already covered through the generic mechanism for the SET command to
set global configuration parameters?

> diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
> @@ -934,6 +934,17 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
>  #endif /* CONFIG_WNM */
>  	} else if (os_strcasecmp(cmd, "enable_dscp_policy_capa") == 0) {
>  		wpa_s->enable_dscp_policy_capa = !!atoi(value);
> +#ifdef CONFIG_SAE
> +	} else if (os_strcasecmp(cmd, "sae_pwe") == 0) {
> +		int pwe = atoi(value);
> +
> +		if (pwe < 0 || pwe > 2) {
> +			wpa_printf(MSG_ERROR,
> +				   "Invalid SAE PWE value %d", pwe);
> +			return -1;
> +		}
> +		wpa_s->conf->sae_pwe = pwe;
> +#endif /* CONFIG_SAE */

Why would this be needed?

>  	} else {
>  		value[-1] = '=';
>  		ret = wpa_config_process_global(wpa_s->conf, cmd, -1);

This ends up doing practically same based on the global_fields[]
array providing the global parameters, including sae_pwe.
Krishna Chaitanya April 29, 2023, 6:47 p.m. UTC | #2
On Fri, Apr 28, 2023 at 8:23 PM Jouni Malinen <j@w1.fi> wrote:
>
> On Sun, Apr 23, 2023 at 10:47:54PM +0530, Krishna wrote:
> > Before the control interface changes we had added a new command to set
> > the H2E in the WPA supplicant configuration, but this was removed, so,
> > add back the command that can be set through WPA cli.
>
> I'm not sure what that adding and removing is referring to, but why
> would this new code be needed to handle the sae_pwe parameter when that
> is already covered through the generic mechanism for the SET command to
> set global configuration parameters?
Sorry, that was internal commit log (downstream fork).
>
> > diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
> > @@ -934,6 +934,17 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
> >  #endif /* CONFIG_WNM */
> >       } else if (os_strcasecmp(cmd, "enable_dscp_policy_capa") == 0) {
> >               wpa_s->enable_dscp_policy_capa = !!atoi(value);
> > +#ifdef CONFIG_SAE
> > +     } else if (os_strcasecmp(cmd, "sae_pwe") == 0) {
> > +             int pwe = atoi(value);
> > +
> > +             if (pwe < 0 || pwe > 2) {
> > +                     wpa_printf(MSG_ERROR,
> > +                                "Invalid SAE PWE value %d", pwe);
> > +                     return -1;
> > +             }
> > +             wpa_s->conf->sae_pwe = pwe;
> > +#endif /* CONFIG_SAE */
>
> Why would this be needed?
>
> >       } else {
> >               value[-1] = '=';
> >               ret = wpa_config_process_global(wpa_s->conf, cmd, -1);
>
> This ends up doing practically same based on the global_fields[]
> array providing the global parameters, including sae_pwe.
Sorry, missed this, it works without this patch also, thanks.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
diff mbox series

Patch

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 9abfeb216..27a4ec7d6 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -934,6 +934,17 @@  static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
 #endif /* CONFIG_WNM */
 	} else if (os_strcasecmp(cmd, "enable_dscp_policy_capa") == 0) {
 		wpa_s->enable_dscp_policy_capa = !!atoi(value);
+#ifdef CONFIG_SAE
+	} else if (os_strcasecmp(cmd, "sae_pwe") == 0) {
+		int pwe = atoi(value);
+
+		if (pwe < 0 || pwe > 2) {
+			wpa_printf(MSG_ERROR,
+				   "Invalid SAE PWE value %d", pwe);
+			return -1;
+		}
+		wpa_s->conf->sae_pwe = pwe;
+#endif /* CONFIG_SAE */
 	} else {
 		value[-1] = '=';
 		ret = wpa_config_process_global(wpa_s->conf, cmd, -1);