Re: [PATCH 7/7] netdev: Simplify FILS handling in netdev_connect_common

James Prestwood
2024-08-05T14:21:04Z

Hi Denis,

On 8/5/24 7:07 AM, Denis Kenzior wrote:
> ---
> src/netdev.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/src/netdev.c b/src/netdev.c
> index fb095fdca561..494e46a59de2 100644
> --- a/src/netdev.c
> +++ b/src/netdev.c
> @@ -3833,6 +3833,14 @@ static void netdev_connect_common(struct netdev *netdev,
> goto build_cmd_connect;
> }
>
> + if (IE_AKM_IS_FILS(hs->akm_suite)) {
> + netdev->ap = fils_sm_new(hs, netdev_fils_tx_authenticate,
> + netdev_fils_tx_associate,
> + netdev_get_oci,
> + netdev);
> + goto done;
> + }
> +
> if (nhs->type != CONNECTION_TYPE_SOFTMAC)
> goto build_cmd_connect;
>
> @@ -3855,15 +3863,6 @@ static void netdev_connect_common(struct netdev *netdev,
> }
>
> break;
> - case IE_RSN_AKM_SUITE_FILS_SHA256:
> - case IE_RSN_AKM_SUITE_FILS_SHA384:
> - case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256:
> - case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384:
> - netdev->ap = fils_sm_new(hs, netdev_fils_tx_authenticate,
> - netdev_fils_tx_associate,
> - netdev_get_oci,
> - netdev);
> - break;
> default:
> build_cmd_connect:
> cmd_connect = netdev_build_cmd_connect(netdev, hs, prev_bssid);
> @@ -3876,6 +3875,7 @@ build_cmd_connect:
> }
> }
>
> +done:
> netdev->connect_cmd = cmd_connect;
> netdev->event_filter = event_filter;
> netdev->connect_cb = cb;

Mostly just an observation, but the switch block is pretty much just
checks for SAE now, and the default build_cmd_connect case. It may look
nicer to just have if/else if's for:

IE_AKM_IS_FILS()
IE_AKM_IS_OWE()
IE_AKM_IS_SAE()

But I'm also fine leaving it how you have it.