2023-07-28 07:54:13

by Kavitha Velayutham

[permalink] [raw]
Subject: [PATCH v2 1/1] wifi: changes for FILS Authentication for External Auth

For Auth to be handled by supplicant when sme is in lower layers for FILS Authentication and
to send Assoc params to the Lower layers.
If Auth is handled in supplicant and if Assoc to be handled in lower layers , then Assoc params to be
sent to the Lower layers from supplicant.

Signed-off-by: Kavitha Velayutham <[email protected]>
---
include/net/cfg80211.h | 14 ++++++++
include/uapi/linux/nl80211.h | 15 ++++++++-
net/wireless/Kconfig | 5 +++
net/wireless/nl80211.c | 63 ++++++++++++++++++++++++++++++------
net/wireless/rdev-ops.h | 14 ++++++++
net/wireless/trace.h | 24 ++++++++++++++
6 files changed, 125 insertions(+), 10 deletions(-)
mode change 100644 => 100755 include/net/cfg80211.h
mode change 100644 => 100755 include/uapi/linux/nl80211.h
mode change 100644 => 100755 net/wireless/nl80211.c
mode change 100644 => 100755 net/wireless/rdev-ops.h
mode change 100644 => 100755 net/wireless/trace.h

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
old mode 100644
new mode 100755
index 9e04f69712b1..ac61d326f0f3
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3467,6 +3467,16 @@ struct cfg80211_update_ft_ies_params {
size_t ie_len;
};

+#ifdef CONFIG_SCSC_WLAN_OCE
+struct cfg80211_external_fils_assoc_params {
+ const u8 *fils_kek;
+ size_t fils_kek_len;
+ const u8 *ie;
+ size_t ie_len;
+ const u8 *fils_nonces;
+ size_t fils_nonces_len;
+};
+#endif
/**
* struct cfg80211_mgmt_tx_params - mgmt tx parameters
*
@@ -4626,6 +4636,10 @@ struct cfg80211_ops {
struct net_device *dev);
int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_update_ft_ies_params *ftie);
+#ifdef CONFIG_SCSC_WLAN_OCE
+ int (*set_fils_assoc_params)(struct wiphy *wiphy, struct net_device *dev,
+ struct cfg80211_external_fils_assoc_params *ftie);
+#endif
int (*crit_proto_start)(struct wiphy *wiphy,
struct wireless_dev *wdev,
enum nl80211_crit_proto_id protocol,
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
old mode 100644
new mode 100755
index c59fec406da5..6ef927c966d3
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1562,6 +1562,10 @@ enum nl80211_commands {

NL80211_CMD_SET_HW_TIMESTAMP,

+ NL80211_CMD_SET_SAR_SPECS,
+
+ NL80211_CMD_FILS_ASSOC_REQ_INFO,
+
/* add new commands above here */

/* used to define NL80211_CMD_MAX below */
@@ -1581,6 +1585,7 @@ enum nl80211_commands {
#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE
#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
+#define NL80211_CMD_FILS_ASSOC_REQ_INFO NL80211_CMD_FILS_ASSOC_REQ_INFO

#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS

@@ -3302,6 +3307,14 @@ enum nl80211_attrs {

NL80211_ATTR_DISABLE_HE,

+ NL80211_ATTR_FILS_ASSOC_IE,
+
+ NL80211_ATTR_RECONNECT_REQUESTED,
+
+ NL80211_ATTR_SAR_SPEC,
+
+ NL80211_ATTR_DISABLE_HE,
+
NL80211_ATTR_OBSS_COLOR_BITMAP,

NL80211_ATTR_COLOR_CHANGE_COUNT,
@@ -6443,7 +6456,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_PUNCT,
NL80211_EXT_FEATURE_SECURE_NAN,
NL80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA,
-
+ NL80211_EXT_FEATURE_EXTERNAL_AUTH_FILS,
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
index f620acd2a0f5..cac4586e21e1 100644
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -67,6 +67,11 @@ config CFG80211_DEVELOPER_WARNINGS
Say Y only if you are developing cfg80211 or a driver based
on it (or mac80211).

+config SCSC_WLAN_OCE
+ bool "OCE Auth Support with External Auth"
+ default y
+ help
+ This option enables external Auth Support for FILS Authentication

config CFG80211_CERTIFICATION_ONUS
bool "cfg80211 certification onus"
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
old mode 100644
new mode 100755
index d95f8053020d..b78236883b84
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -559,6 +559,11 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_IE] = NLA_POLICY_VALIDATE_FN(NLA_BINARY,
validate_ie_attr,
IEEE80211_MAX_DATA_LEN),
+#ifdef CONFIG_SCSC_WLAN_OCE
+ [NL80211_ATTR_FILS_ASSOC_IE] = NLA_POLICY_VALIDATE_FN(NLA_BINARY,
+ validate_ie_attr,
+ IEEE80211_MAX_DATA_LEN),
+#endif
[NL80211_ATTR_SCAN_FREQUENCIES] = { .type = NLA_NESTED },
[NL80211_ATTR_SCAN_SSIDS] = { .type = NLA_NESTED },

@@ -5844,10 +5849,11 @@ static bool nl80211_valid_auth_type(struct cfg80211_registered_device *rdev,
if (auth_type == NL80211_AUTHTYPE_FILS_SK_PFS ||
auth_type == NL80211_AUTHTYPE_FILS_PK)
return false;
- if (!wiphy_ext_feature_isset(
- &rdev->wiphy,
- NL80211_EXT_FEATURE_FILS_SK_OFFLOAD) &&
- auth_type == NL80211_AUTHTYPE_FILS_SK)
+ if (!(wiphy_ext_feature_isset(&rdev->wiphy, NL80211_EXT_FEATURE_FILS_SK_OFFLOAD)
+#ifdef CONFIG_SCSC_WLAN_OCE
+ || wiphy_ext_feature_isset(&rdev->wiphy, NL80211_EXT_FEATURE_EXTERNAL_AUTH_FILS)
+#endif
+ ) && auth_type == NL80211_AUTHTYPE_FILS_SK)
return false;
return true;
case NL80211_CMD_START_AP:
@@ -11929,9 +11935,11 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
}
}

- if (wiphy_ext_feature_isset(&rdev->wiphy,
- NL80211_EXT_FEATURE_FILS_SK_OFFLOAD) &&
- info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] &&
+ if ((wiphy_ext_feature_isset(&rdev->wiphy, NL80211_EXT_FEATURE_FILS_SK_OFFLOAD)
+#ifdef CONFIG_SCSC_WLAN_OCE
+ || wiphy_ext_feature_isset(&rdev->wiphy, NL80211_EXT_FEATURE_EXTERNAL_AUTH_FILS)
+#endif
+ ) && info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] &&
info->attrs[NL80211_ATTR_FILS_ERP_REALM] &&
info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] &&
info->attrs[NL80211_ATTR_FILS_ERP_RRK]) {
@@ -12013,8 +12021,8 @@ static int nl80211_update_connect_params(struct sk_buff *skb,
changed |= UPDATE_ASSOC_IES;
}

- fils_sk_offload = wiphy_ext_feature_isset(&rdev->wiphy,
- NL80211_EXT_FEATURE_FILS_SK_OFFLOAD);
+ fils_sk_offload = wiphy_ext_feature_isset(&rdev->wiphy, NL80211_EXT_FEATURE_FILS_SK_OFFLOAD) ||
+ wiphy_ext_feature_isset(&rdev->wiphy, NL80211_EXT_FEATURE_EXTERNAL_AUTH_FILS);

/*
* when driver supports fils-sk offload all attributes must be
@@ -14789,6 +14797,33 @@ static int nl80211_update_ft_ies(struct sk_buff *skb, struct genl_info *info)
return rdev_update_ft_ies(rdev, dev, &ft_params);
}

+#ifdef CONFIG_SCSC_WLAN_OCE
+static int nl80211_fils_assoc_req_ies(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct cfg80211_external_fils_assoc_params fils_params;
+ struct net_device *dev = info->user_ptr[1];
+
+ if (!rdev->ops->set_fils_assoc_params)
+ return -EOPNOTSUPP;
+
+ if (!info->attrs[NL80211_ATTR_FILS_KEK] ||
+ !info->attrs[NL80211_ATTR_FILS_ASSOC_IE] ||
+ !info->attrs[NL80211_ATTR_FILS_NONCES])
+ return -EINVAL;
+
+ memset(&fils_params, 0, sizeof(fils_params));
+ fils_params.fils_kek = nla_data(info->attrs[NL80211_ATTR_FILS_KEK]);
+ fils_params.fils_kek_len = nla_len(info->attrs[NL80211_ATTR_FILS_KEK]);
+ fils_params.ie = nla_data(info->attrs[NL80211_ATTR_FILS_ASSOC_IE]);
+ fils_params.ie_len = nla_len(info->attrs[NL80211_ATTR_FILS_ASSOC_IE]);
+ fils_params.fils_nonces = nla_data(info->attrs[NL80211_ATTR_FILS_NONCES]);
+ fils_params.fils_nonces_len = nla_len(info->attrs[NL80211_ATTR_FILS_NONCES]);
+
+ return rdev_fils_assoc_req_ies(rdev, dev, &fils_params);
+}
+#endif
+
static int nl80211_crit_protocol_start(struct sk_buff *skb,
struct genl_info *info)
{
@@ -16631,6 +16666,16 @@ static const struct genl_small_ops nl80211_small_ops[] = {
.doit = nl80211_set_wiphy,
.flags = GENL_UNS_ADMIN_PERM,
},
+#ifdef CONFIG_SCSC_WLAN_OCE
+ {
+ .cmd = NL80211_CMD_FILS_ASSOC_REQ_INFO,
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+ .doit = nl80211_fils_assoc_req_ies,
+ .flags = GENL_UNS_ADMIN_PERM,
+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
+ NL80211_FLAG_NEED_RTNL,
+ },
+#endif
{
.cmd = NL80211_CMD_GET_INTERFACE,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
old mode 100644
new mode 100755
index 2e497cf26ef2..000d2019901d
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1062,6 +1062,20 @@ static inline int rdev_update_ft_ies(struct cfg80211_registered_device *rdev,
return ret;
}

+#ifdef CONFIG_SCSC_WLAN_OCE
+static inline int rdev_fils_assoc_req_ies(struct cfg80211_registered_device *rdev,
+ struct net_device *dev,
+ struct cfg80211_external_fils_assoc_params *params)
+{
+ int ret;
+
+ trace_rdev_fils_assoc_req_ies(&rdev->wiphy, dev, params);
+ ret = rdev->ops->set_fils_assoc_params(&rdev->wiphy, dev, params);
+ trace_rdev_return_int(&rdev->wiphy, ret);
+ return ret;
+}
+#endif
+
static inline int rdev_crit_proto_start(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev,
enum nl80211_crit_proto_id protocol,
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
old mode 100644
new mode 100755
index 716a1fa70069..7c2877a7099b
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -2256,6 +2256,30 @@ TRACE_EVENT(rdev_update_ft_ies,
WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->md)
);

+#ifdef CONFIG_SCSC_WLAN_OCE
+TRACE_EVENT(rdev_fils_assoc_req_ies,
+ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
+ struct cfg80211_external_fils_assoc_params *filsie),
+ TP_ARGS(wiphy, netdev, filsie),
+ TP_STRUCT__entry(
+ WIPHY_ENTRY
+ NETDEV_ENTRY
+ __dynamic_array(u8, kek, filsie->fils_kek_len)
+ __dynamic_array(u8, ie, filsie->ie_len)
+ __dynamic_array(u8, nonces, filsie->fils_nonces_len)
+ ),
+ TP_fast_assign(
+ WIPHY_ASSIGN;
+ NETDEV_ASSIGN;
+ memcpy(__get_dynamic_array(kek), filsie->fils_kek, filsie->fils_kek_len);
+ memcpy(__get_dynamic_array(ie), filsie->ie, filsie->ie_len);
+ memcpy(__get_dynamic_array(ie), filsie->fils_nonces, filsie->fils_nonces_len);
+ ),
+ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ,
+ WIPHY_PR_ARG, NETDEV_PR_ARG)
+);
+#endif
+
TRACE_EVENT(rdev_crit_proto_start,
TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
enum nl80211_crit_proto_id protocol, u16 duration),
--
2.34.1



2023-08-08 19:25:22

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v2 1/1] wifi: changes for FILS Authentication for External Auth

Hi,

So since there's just about _everything_ wrong with this patch I'm not
even going to bother reviewing it.

Please run it by someone internal to your company who actually has
upstream development experience. Until then, please don't resubmit it
either.

johannes