Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 4/4] netdev: offload handshake when requested
Date: Wed, 03 Mar 2021 09:47:30 -0800	[thread overview]
Message-ID: <20210303174730.6738-4-prestwoj@gmail.com> (raw)
In-Reply-To: <20210303174730.6738-1-prestwoj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1562 bytes --]

Set the PMK attribute if offloading the handshake is requested.
Since station relies on handshake events the key setting event
must be simulated in order to sync the PSK. As of now, no other
handshake events are required explicitly.
---
 src/netdev.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/netdev.c b/src/netdev.c
index 1f2aa51c..2c96d611 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -1958,6 +1958,16 @@ process_resp_ies:
 		return;
 	}
 
+	/*
+	 * In the offload case this handshake is completed, simulate setting
+	 * the keys so station sync's PSK and treats this the same as a
+	 * non-offload connection
+	 */
+	if (netdev->handshake->offload_psk) {
+		handshake_event(netdev->handshake,
+					HANDSHAKE_EVENT_SETTING_KEYS);
+	}
+
 	netdev_connect_ok(netdev);
 
 	return;
@@ -2635,6 +2645,10 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
 				NL80211_ATTR_CONTROL_PORT_OVER_NL80211,
 				0, NULL);
 
+	if (hs->offload_psk)
+		l_genl_msg_append_attr(msg, NL80211_ATTR_PMK, hs->pmk_len,
+					hs->pmk);
+
 	rm_enabled_capabilities =
 			wiphy_get_rm_enabled_capabilities(netdev->wiphy);
 	if (rm_enabled_capabilities && bss->capability & IE_BSS_CAP_RM) {
@@ -3000,7 +3014,7 @@ int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
 		if (!cmd_connect)
 			return -EINVAL;
 
-		if (is_rsn || hs->settings_8021x)
+		if (!hs->offload_psk && (is_rsn || hs->settings_8021x))
 			sm = eapol_sm_new(hs);
 	}
 
-- 
2.26.2

  parent reply	other threads:[~2021-03-03 17:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03 17:47 [PATCH 1/4] wiphy: add wiphy_can_offload API James Prestwood
2021-03-03 17:47 ` [PATCH 2/4] handshake: add offload member James Prestwood
2021-03-03 20:42   ` Denis Kenzior
2021-03-03 17:47 ` [PATCH 3/4] station: set handshake offload if supported James Prestwood
2021-03-03 20:50   ` Denis Kenzior
2021-03-03 17:47 ` James Prestwood [this message]
2021-03-03 20:41 ` [PATCH 1/4] wiphy: add wiphy_can_offload API 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=20210303174730.6738-4-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