]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: nl80211: ignore cluster id after NAN started
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 7 Jan 2026 12:22:54 +0000 (14:22 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 19 Jan 2026 09:18:49 +0000 (10:18 +0100)
After NAN was started, cluster id updates from the user space should not
happen, since the device already started a cluster with the
previousely provided id.

Since NL80211_CMD_CHANGE_NAN_CONFIG requires to set the full NAN
configuration, we can't require that NL80211_NAN_CONF_CLUSTER_ID won't
be included in this command, and keeping the last confgiured value just
to be able to compare it against the new one seems a bit overkill.

Therefore, just ignore cluster id in this command and clarify the
documentation.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260107142229.fb55e5853269.I10d18c8f69d98b28916596d6da4207c15ea4abb5@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/uapi/linux/nl80211.h
net/wireless/nl80211.c

index eb92296457c937b88522a5907cf2196fe5133df0..b0f050e36fa4a99f51026aa6b809206c17d2e6f3 100644 (file)
@@ -11,7 +11,7 @@
  * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
  * Copyright 2008 Colin McCabe <colin@cozybit.com>
  * Copyright 2015-2017 Intel Deutschland GmbH
- * Copyright (C) 2018-2025 Intel Corporation
+ * Copyright (C) 2018-2026 Intel Corporation
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -7454,6 +7454,8 @@ enum nl80211_nan_band_conf_attributes {
  *     address that can take values from 50-6F-9A-01-00-00 to
  *     50-6F-9A-01-FF-FF. This attribute is optional. If not present,
  *     a random Cluster ID will be chosen.
+ *     This attribute will be ignored in NL80211_CMD_CHANGE_NAN_CONFIG
+ *     since after NAN was started, the cluster ID can no longer change.
  * @NL80211_NAN_CONF_EXTRA_ATTRS: Additional NAN attributes to be
  *     published in the beacons. This is an optional byte array.
  * @NL80211_NAN_CONF_VENDOR_ELEMS: Vendor-specific elements that will
index bcf30c5f5042f3061776271576049cf7cbc273ed..56cc5ed33ea336604385f01cd518805df8da2a39 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright 2015-2017 Intel Deutschland GmbH
- * Copyright (C) 2018-2025 Intel Corporation
+ * Copyright (C) 2018-2026 Intel Corporation
  */
 
 #include <linux/if.h>
@@ -15583,7 +15583,8 @@ static int nl80211_parse_nan_band_config(struct wiphy *wiphy,
 static int nl80211_parse_nan_conf(struct wiphy *wiphy,
                                  struct genl_info *info,
                                  struct cfg80211_nan_conf *conf,
-                                 u32 *changed_flags)
+                                 u32 *changed_flags,
+                                 bool start)
 {
        struct nlattr *attrs[NL80211_NAN_CONF_ATTR_MAX + 1];
        int err, rem;
@@ -15630,7 +15631,7 @@ static int nl80211_parse_nan_conf(struct wiphy *wiphy,
                return err;
 
        changed |= CFG80211_NAN_CONF_CHANGED_CONFIG;
-       if (attrs[NL80211_NAN_CONF_CLUSTER_ID])
+       if (attrs[NL80211_NAN_CONF_CLUSTER_ID] && start)
                conf->cluster_id =
                        nla_data(attrs[NL80211_NAN_CONF_CLUSTER_ID]);
 
@@ -15741,7 +15742,7 @@ static int nl80211_start_nan(struct sk_buff *skb, struct genl_info *info)
        if (!info->attrs[NL80211_ATTR_NAN_MASTER_PREF])
                return -EINVAL;
 
-       err = nl80211_parse_nan_conf(&rdev->wiphy, info, &conf, NULL);
+       err = nl80211_parse_nan_conf(&rdev->wiphy, info, &conf, NULL, true);
        if (err)
                return err;
 
@@ -16107,7 +16108,7 @@ static int nl80211_nan_change_config(struct sk_buff *skb,
        if (!wdev_running(wdev))
                return -ENOTCONN;
 
-       err = nl80211_parse_nan_conf(&rdev->wiphy, info, &conf, &changed);
+       err = nl80211_parse_nan_conf(&rdev->wiphy, info, &conf, &changed, false);
        if (err)
                return err;