Currently, we store in nan.conf the cluster id that was configured from
upper layer to be used when the device opens a cluster.
But after we joined a cluster, the configured cluster id is no longer
relevant. Particularly, in reconfig we will give the driver the
(possibly) wrong cluster id.
Add an API to be called by the driver when joined a cluster
in which the cluster id will be updated.
Use the locally stored cluster id instead of cfg80211's copy.
Ignore cluster id updates from cfg80211 if we already have one
configured.
Adjust the drivers that use the cfg80211 API
(cfg80211_nan_cluster_joined) directly, otherwise we break functionality
(i.e. accept frame check won't evaluate to true).
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260504101829.5dada1b756a4.I0f1060215267fd8aef31afd99f8f42e6fde7f234@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
*/
void ieee80211_nan_sched_update_done(struct ieee80211_vif *vif);
+/**
+ * ieee80211_nan_cluster_joined - notify about NAN cluster join.
+ *
+ * This function is used to notify mac80211 about NAN cluster join.
+ *
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ * @cluster_id: the cluster ID that was joined
+ * @new_cluster: true if this is a new cluster
+ * @gfp: allocation flags
+ */
+void ieee80211_nan_cluster_joined(struct ieee80211_vif *vif,
+ const u8 *cluster_id, bool new_cluster,
+ gfp_t gfp);
+
/**
* ieee80211_calc_rx_airtime - calculate estimated transmission airtime for RX.
*
}
EXPORT_SYMBOL(ieee80211_nan_func_match);
+void ieee80211_nan_cluster_joined(struct ieee80211_vif *vif,
+ const u8 *cluster_id, bool new_cluster,
+ gfp_t gfp)
+{
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+
+ if (WARN_ON(vif->type != NL80211_IFTYPE_NAN))
+ return;
+
+ if (WARN_ON(!sdata->u.nan.started))
+ return;
+
+ ether_addr_copy(sdata->u.nan.conf.cluster_id, cluster_id);
+
+ cfg80211_nan_cluster_joined(ieee80211_vif_to_wdev(vif), cluster_id,
+ new_cluster, gfp);
+}
+EXPORT_SYMBOL(ieee80211_nan_cluster_joined);
+
static int ieee80211_set_multicast_to_unicast(struct wiphy *wiphy,
struct net_device *dev,
const bool enabled)
* action frames or authentication frames that are addressed to
* the local NAN interface.
*/
- return memcmp(sdata->wdev.u.nan.cluster_id,
+ return memcmp(sdata->u.nan.conf.cluster_id,
hdr->addr3, ETH_ALEN) == 0 &&
(ieee80211_is_public_action(hdr, skb->len) ||
(ieee80211_is_auth(hdr->frame_control) &&
if (!nmi)
return false;
- if (!ether_addr_equal(nmi->wdev.u.nan.cluster_id,
+ if (!ether_addr_equal(nmi->u.nan.conf.cluster_id,
hdr->addr3))
return false;
ret = -ENOTCONN;
goto free;
}
- memcpy(hdr.addr3, nmi->wdev.u.nan.cluster_id, ETH_ALEN);
+ memcpy(hdr.addr3, nmi->u.nan.conf.cluster_id, ETH_ALEN);
hdrlen = 24;
break;
}