From: Ilan Peer Instant Communication requires user space to track the NAN beacons, so let it register for Rx of beacons on a NAN interface, but allow it only if the driver advertises Instant Communication support. Signed-off-by: Ilan Peer Signed-off-by: Miri Korenblit --- net/wireless/mlme.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index a0d1cde26f0c..801d5b811ac1 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c @@ -749,6 +749,15 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid, return -EINVAL; } + /* NAN beacons are only reported while Instant Communication is used */ + if (wdev->iftype == NL80211_IFTYPE_NAN && + (frame_type & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON && + !(wdev->wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM)) { + NL_SET_ERR_MSG(extack, + "Instant Communication is not supported"); + return -EOPNOTSUPP; + } + nreg = kzalloc(sizeof(*reg) + match_len, GFP_KERNEL); if (!nreg) return -ENOMEM; -- 2.34.1