Commit 0cfaec25 authored by Aloka Dixit's avatar Aloka Dixit Committed by Johannes Berg
Browse files

wifi: nl80211: fixes to FILS discovery updates



Add a new flag 'update' which is set to true during start_ap()
if (and only if) one of the following two conditions are met:
- Userspace passed an empty nested attribute which indicates that
  the feature should be disabled and templates deleted.
- Userspace passed all the parameters for the nested attribute.

Existing configuration will not be changed while the flag
remains false.

Add similar changes for unsolicited broadcast probe response
transmission.

Signed-off-by: default avatarAloka Dixit <quic_alokad@quicinc.com>
Reviewed-by: default avatarJeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230727174100.11721-2-quic_alokad@quicinc.com


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent e04b1973
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1338,6 +1338,7 @@ struct cfg80211_acl_data {
 * struct cfg80211_fils_discovery - FILS discovery parameters from
 * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
 *
 * @update: Set to true if the feature configuration should be updated.
 * @min_interval: Minimum packet interval in TUs (0 - 10000)
 * @max_interval: Maximum packet interval in TUs (0 - 10000)
 * @tmpl_len: Template length
@@ -1345,6 +1346,7 @@ struct cfg80211_acl_data {
 *	frame headers.
 */
struct cfg80211_fils_discovery {
	bool update;
	u32 min_interval;
	u32 max_interval;
	size_t tmpl_len;
@@ -1355,6 +1357,7 @@ struct cfg80211_fils_discovery {
 * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
 *	response parameters in 6GHz.
 *
 * @update: Set to true if the feature configuration should be updated.
 * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
 *	in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
 *	scanning
@@ -1362,6 +1365,7 @@ struct cfg80211_fils_discovery {
 * @tmpl: Template data for probe response
 */
struct cfg80211_unsol_bcast_probe_resp {
	bool update;
	u32 interval;
	size_t tmpl_len;
	const u8 *tmpl;
+7 −4
Original line number Diff line number Diff line
@@ -2690,11 +2690,13 @@ enum nl80211_commands {
 *
 * @NL80211_ATTR_FILS_DISCOVERY: Optional parameter to configure FILS
 *	discovery. It is a nested attribute, see
 *	&enum nl80211_fils_discovery_attributes.
 *	&enum nl80211_fils_discovery_attributes. Userspace should pass an empty
 *	nested attribute to disable this feature and delete the templates.
 *
 * @NL80211_ATTR_UNSOL_BCAST_PROBE_RESP: Optional parameter to configure
 *	unsolicited broadcast probe response. It is a nested attribute, see
 *	&enum nl80211_unsol_bcast_probe_resp_attributes.
 *	&enum nl80211_unsol_bcast_probe_resp_attributes. Userspace should pass an empty
 *	nested attribute to disable this feature and delete the templates.
 *
 * @NL80211_ATTR_S1G_CAPABILITY: S1G Capability information element (from
 *	association request when used with NL80211_CMD_NEW_STATION)
@@ -7606,7 +7608,7 @@ enum nl80211_iftype_akm_attributes {
 * @NL80211_FILS_DISCOVERY_ATTR_INT_MIN: Minimum packet interval (u32, TU).
 *	Allowed range: 0..10000 (TU = Time Unit)
 * @NL80211_FILS_DISCOVERY_ATTR_INT_MAX: Maximum packet interval (u32, TU).
 *	Allowed range: 0..10000 (TU = Time Unit)
 *	Allowed range: 0..10000 (TU = Time Unit). If set to 0, the feature is disabled.
 * @NL80211_FILS_DISCOVERY_ATTR_TMPL: Template data for FILS discovery action
 *	frame including the headers.
 *
@@ -7639,7 +7641,8 @@ enum nl80211_fils_discovery_attributes {
 *
 * @NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT: Maximum packet interval (u32, TU).
 *	Allowed range: 0..20 (TU = Time Unit). IEEE P802.11ax/D6.0
 *	26.17.2.3.2 (AP behavior for fast passive scanning).
 *	26.17.2.3.2 (AP behavior for fast passive scanning). If set to 0, the feature is
 *	disabled.
 * @NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL: Unsolicited broadcast probe response
 *	frame template (binary).
 *
+15 −1
Original line number Diff line number Diff line
@@ -5647,6 +5647,13 @@ static int nl80211_parse_fils_discovery(struct cfg80211_registered_device *rdev,
	if (ret)
		return ret;
	if (!tb[NL80211_FILS_DISCOVERY_ATTR_INT_MIN] &&
	    !tb[NL80211_FILS_DISCOVERY_ATTR_INT_MAX] &&
	    !tb[NL80211_FILS_DISCOVERY_ATTR_TMPL]) {
		fd->update = true;
		return 0;
	}
	if (!tb[NL80211_FILS_DISCOVERY_ATTR_INT_MIN] ||
	    !tb[NL80211_FILS_DISCOVERY_ATTR_INT_MAX] ||
	    !tb[NL80211_FILS_DISCOVERY_ATTR_TMPL])
@@ -5656,7 +5663,7 @@ static int nl80211_parse_fils_discovery(struct cfg80211_registered_device *rdev,
	fd->tmpl = nla_data(tb[NL80211_FILS_DISCOVERY_ATTR_TMPL]);
	fd->min_interval = nla_get_u32(tb[NL80211_FILS_DISCOVERY_ATTR_INT_MIN]);
	fd->max_interval = nla_get_u32(tb[NL80211_FILS_DISCOVERY_ATTR_INT_MAX]);
	fd->update = true;
	return 0;
}
@@ -5679,6 +5686,12 @@ nl80211_parse_unsol_bcast_probe_resp(struct cfg80211_registered_device *rdev,
	if (ret)
		return ret;
	if (!tb[NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT] &&
	    !tb[NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL]) {
		presp->update = true;
		return 0;
	}
	if (!tb[NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT] ||
	    !tb[NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL])
		return -EINVAL;
@@ -5686,6 +5699,7 @@ nl80211_parse_unsol_bcast_probe_resp(struct cfg80211_registered_device *rdev,
	presp->tmpl = nla_data(tb[NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL]);
	presp->tmpl_len = nla_len(tb[NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL]);
	presp->interval = nla_get_u32(tb[NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT]);
	presp->update = true;
	return 0;
}