From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH v2 5/6] netdev: add SAE offload support
Date: Mon, 22 Mar 2021 09:01:55 -0700 [thread overview]
Message-ID: <20210322160156.392256-5-prestwoj@gmail.com> (raw)
In-Reply-To: <20210322160156.392256-1-prestwoj@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3559 bytes --]
SAE offload support requires some minor tweaks to CMD_CONNECT
as well as special checks once the connect event comes in. Since
at this point we are fully connected.
---
src/netdev.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
v2:
* More comments explaining things.
diff --git a/src/netdev.c b/src/netdev.c
index 66a781bc..0cd139c2 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -1212,6 +1212,11 @@ static void netdev_connect_ok(struct netdev *netdev)
netdev->fw_roam_bss = NULL;
}
+ /* Allow station to sync the PSK to disk */
+ if (netdev->handshake->offload)
+ handshake_event(netdev->handshake,
+ HANDSHAKE_EVENT_SETTING_KEYS);
+
if (netdev->connect_cb) {
netdev->connect_cb(netdev, NETDEV_RESULT_OK, NULL,
netdev->user_data);
@@ -1979,6 +1984,14 @@ process_resp_ies:
netdev_send_qos_map_set(netdev, qos_set, qos_len);
}
+ /*
+ * TODO: Only SAE/WPA3-personal offload is supported. In this case IWD
+ * is 'done'. In the case of 8021x offload EAP still needs to take
+ * place, so this must be updated accordingly when that is implemented.
+ */
+ if (netdev->handshake->offload)
+ goto done;
+
if (netdev->sm) {
/*
* Let station know about the roam so a state change can occur.
@@ -2002,6 +2015,7 @@ process_resp_ies:
return;
}
+done:
netdev_connect_ok(netdev);
return;
@@ -2601,7 +2615,9 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
const struct iovec *vendor_ies,
size_t num_vendor_ies)
{
- uint32_t auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM;
+ uint32_t auth_type = IE_AKM_IS_SAE(hs->akm_suite) ?
+ NL80211_AUTHTYPE_SAE :
+ NL80211_AUTHTYPE_OPEN_SYSTEM;
struct l_genl_msg *msg;
struct iovec iov[4 + num_vendor_ies];
int iov_elems = 0;
@@ -2618,6 +2634,12 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
bss->ssid_len, bss->ssid);
l_genl_msg_append_attr(msg, NL80211_ATTR_AUTH_TYPE, 4, &auth_type);
+ if (hs->offload) {
+ if (IE_AKM_IS_SAE(hs->akm_suite))
+ l_genl_msg_append_attr(msg, NL80211_ATTR_SAE_PASSWORD,
+ strlen(hs->passphrase), hs->passphrase);
+ }
+
if (prev_bssid)
l_genl_msg_append_attr(msg, NL80211_ATTR_PREV_BSSID, ETH_ALEN,
prev_bssid);
@@ -2659,7 +2681,9 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
l_genl_msg_append_attr(msg, NL80211_ATTR_AKM_SUITES,
4, &nl_akm);
- if (hs->wpa_ie)
+ if (IE_AKM_IS_SAE(hs->akm_suite))
+ wpa_version = NL80211_WPA_VERSION_3;
+ else if (hs->wpa_ie)
wpa_version = NL80211_WPA_VERSION_1;
else
wpa_version = NL80211_WPA_VERSION_2;
@@ -3020,6 +3044,9 @@ int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
switch (hs->akm_suite) {
case IE_RSN_AKM_SUITE_SAE_SHA256:
case IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256:
+ if (hs->offload)
+ goto build_cmd_connect;
+
netdev->ap = sae_sm_new(hs, netdev_sae_tx_authenticate,
netdev_sae_tx_associate,
netdev);
@@ -3038,13 +3065,14 @@ int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
netdev);
break;
default:
+build_cmd_connect:
cmd_connect = netdev_build_cmd_connect(netdev, bss, hs,
NULL, vendor_ies, num_vendor_ies);
if (!cmd_connect)
return -EINVAL;
- if (is_rsn || hs->settings_8021x)
+ if (!hs->offload && (is_rsn || hs->settings_8021x))
sm = eapol_sm_new(hs);
}
--
2.26.2
next prev parent reply other threads:[~2021-03-22 16:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-22 16:01 [PATCH v2 1/6] wiphy: add getter for 'supports_cmds_auth_assoc' James Prestwood
2021-03-22 16:01 ` [PATCH v2 2/6] wiphy: check SAE offload in wiphy_select_akm James Prestwood
2021-03-22 16:01 ` [PATCH v2 3/6] wiphy: check SAE offload in wiphy_can_connect James Prestwood
2021-03-22 16:01 ` [PATCH v2 4/6] handshake: add offload flag James Prestwood
2021-03-22 16:01 ` James Prestwood [this message]
2021-03-22 16:01 ` [PATCH v2 6/6] station: set handshake offload if required James Prestwood
2021-03-22 19:17 ` [PATCH v2 1/6] wiphy: add getter for 'supports_cmds_auth_assoc' Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210322160156.392256-5-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox