From patchwork Mon Nov 13 12:47:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Jance X-Patchwork-Id: 744428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EADCC4332F for ; Mon, 13 Nov 2023 12:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbjKMMry (ORCPT ); Mon, 13 Nov 2023 07:47:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjKMMry (ORCPT ); Mon, 13 Nov 2023 07:47:54 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D8CD171A for ; Mon, 13 Nov 2023 04:47:51 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6c10f098a27so3238457b3a.2 for ; Mon, 13 Nov 2023 04:47:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1699879671; x=1700484471; darn=vger.kernel.org; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=JaGEnM2rJIV7UPao0q/Cv21f6cWpB34QUi+4DqR489U=; b=gU0TSqeScpdOKxMZPjDKzv0oQYVLqSZX1SI2UQpmte/KVz/ENM6BHXS2NdEJJSvoRT VNaeLc1a/rThHX9190KocJKumP3iwcX5Olg9kBJA1s2Kp+t2i5gbkgmNp7fPGhKTbBmm ShSzRTug2AurLLQGp742rg6E9Qnn6XRcxOneo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699879671; x=1700484471; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JaGEnM2rJIV7UPao0q/Cv21f6cWpB34QUi+4DqR489U=; b=Zbi36SMxDXaCRZYXyK6/BL+kny0S7svKMY/Xu+SMWRW8PEyPDZq6qrl7iRA5nETUMP SirScP9Q1QgxAWe8RmlPXHcCwl9Gpr3I+N8ACvP4jYU2PKYawq5DKWL+MROLXz2P+HSa wtQD8K0deXuuPshXA/4ikKJXiXOwFHwrieuIEi55qpv1QMMIbkhNt6X2A/pBC4sXGggl eelmeC2JOpppui5YbEFER1Fre6JuXzLQT+Oyg/aSf/IB8AIhUxVQSH5C7IdYS1AVxDbL sVCzxLYR++hlhCjB7QL+iPz97Q/fnf3zYINrlcpeT7GudRrfWf/miFWYk+NeU8/e4tBo PgvA== X-Gm-Message-State: AOJu0Yyz9zKCjf4UIk+jJRBFX/Q5TgRA1l4J17ocFC0fYVTwzjpHz0oc PZZjXHraRfesEQwdSNnWBWU3dA== X-Google-Smtp-Source: AGHT+IHl9NAqtQ624XBEWhQJ2t0NMPnNHb0JRdVe/9+DZRVN6+elPa5SVTwge9bgeWk5MaBQAqva8A== X-Received: by 2002:a62:e313:0:b0:6b2:2a2d:7a25 with SMTP id g19-20020a62e313000000b006b22a2d7a25mr4215352pfh.29.1699879670239; Mon, 13 Nov 2023 04:47:50 -0800 (PST) Received: from C02F22LSML85.lan ([180.151.107.109]) by smtp.gmail.com with ESMTPSA id e16-20020a656890000000b005b6c1972c99sm3377513pgt.7.2023.11.13.04.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 04:47:49 -0800 (PST) From: Jithu Jance To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, vinayak.yadawad@broadcom.com, Jithu Jance Subject: [PATCH v3 1/1] wifi: nl80211: Add PTK/GTK rekey interval attributes for APs supporting PSK offload Date: Mon, 13 Nov 2023 18:17:42 +0530 Message-Id: <20231113124742.13588-1-jithu.jance@broadcom.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This patch adds attributes to NL80211_CMD_START_AP that the user application can use to pass down PTK/GTK rekey interval times to the driver. If driver can't support the configuration, it is expected to return failure to NL8011_CMD_START_AP. The rekey interval timings are to be passed in seconds. --- v2 > v3: Fixed indentation v1 > v2: Fixed the missing nl80211_policy changes Signed-off-by: Jithu Jance --- include/net/cfg80211.h | 6 ++++++ include/uapi/linux/nl80211.h | 13 +++++++++++++ net/wireless/nl80211.c | 13 +++++++++++++ 3 files changed, 32 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index b137a33a1b68..459e29d4d766 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1218,6 +1218,10 @@ struct survey_info { * * NL80211_SAE_PWE_BOTH * Allow either hunting-and-pecking loop or hash-to-element + * @ptk_rekey_interval: PTK rekey interval in seconds for drivers supporting + * AP 4 way handshake offload. + * @gtk_rekey_interval: GTK rekey interval in seconds for drivers supporting + * AP 4 way handshake offload. */ struct cfg80211_crypto_settings { u32 wpa_versions; @@ -1235,6 +1239,8 @@ struct cfg80211_crypto_settings { const u8 *sae_pwd; u8 sae_pwd_len; enum nl80211_sae_pwe_mechanism sae_pwe; + u32 ptk_rekey_interval; + u32 gtk_rekey_interval; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index dced2c49daec..519be2b58cd0 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -205,6 +205,10 @@ * preshared key material is provided, for example when that driver does * not support setting the temporal keys through %NL80211_CMD_NEW_KEY. * + * NL80211_CMD_START_AP can optionally carry %NL80211_ATTR_GTK_REKEY_INTERVAL + * and %NL80211_ATTR_PTK_REKEY_INTERVAL to pass down user configured values to + * the driver. + * * For 802.1X the PMK or PMK-R0 are set by providing %NL80211_ATTR_PMK * using %NL80211_CMD_SET_PMK. For offloaded FT support also * %NL80211_ATTR_PMKR0_NAME must be provided. @@ -2826,6 +2830,12 @@ enum nl80211_commands { * @NL80211_ATTR_MLO_LINK_DISABLED: Flag attribute indicating that the link is * disabled. * + * @NL80211_ATTR_PTK_REKEY_INTERVAL: PTK refresh interval in seconds for drivers + * supporting NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK. + * + * @NL80211_ATTR_GTK_REKEY_INTERVAL: GTK refresh interval in seconds for drivers + * supporting NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -3364,6 +3374,9 @@ enum nl80211_attrs { NL80211_ATTR_MLO_LINK_DISABLED, + NL80211_ATTR_PTK_REKEY_INTERVAL, + NL80211_ATTR_GTK_REKEY_INTERVAL, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 569234bc2be6..514960e5681d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -818,6 +818,8 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_HW_TIMESTAMP_ENABLED] = { .type = NLA_FLAG }, [NL80211_ATTR_EMA_RNR_ELEMS] = { .type = NLA_NESTED }, [NL80211_ATTR_MLO_LINK_DISABLED] = { .type = NLA_FLAG }, + [NL80211_ATTR_PTK_REKEY_INTERVAL] = { .type = NLA_U32 }, + [NL80211_ATTR_GTK_REKEY_INTERVAL] = { .type = NLA_U32 }, }; /* policy for the key attributes */ @@ -10892,6 +10894,17 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, else settings->sae_pwe = NL80211_SAE_PWE_UNSPECIFIED; + if (info->attrs[NL80211_ATTR_PTK_REKEY_INTERVAL] || + info->attrs[NL80211_ATTR_GTK_REKEY_INTERVAL]) { + if (!wiphy_ext_feature_isset(&rdev->wiphy, + NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK)) + return -EINVAL; + if (info->attrs[NL80211_ATTR_PTK_REKEY_INTERVAL]) + settings->ptk_rekey_interval = nla_get_u32(info->attrs[NL80211_ATTR_PTK_REKEY_INTERVAL]); + else + settings->gtk_rekey_interval = nla_get_u32(info->attrs[NL80211_ATTR_GTK_REKEY_INTERVAL]); + } + return 0; }