diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 02318a4be0e1..0d1b1d726b9c 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -7891,6 +7891,20 @@ void ieee80211_nan_func_match(struct ieee80211_vif *vif, */ 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. * diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 00261bd6674b..c71af8878562 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -5215,6 +5215,25 @@ void ieee80211_nan_func_match(struct ieee80211_vif *vif, } 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) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 3e5d1c47a5b0..82ea7404f3da 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -4629,7 +4629,7 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx) * 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) && @@ -4646,7 +4646,7 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx) 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; diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 8e4876d1c544..1702f816419b 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2854,7 +2854,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, 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; }