From: Avraham Stern Some frames sent to the NAN device may be protected, such as protected action frames (in particular protected dual of public action). Accept robust management frames except disassoc on the NAN device, and clean up the code a little bit. Signed-off-by: Avraham Stern Signed-off-by: Miri Korenblit --- net/mac80211/rx.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 82ea7404f3da..e1f376e0620c 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -4624,16 +4624,24 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx) ieee80211_has_fromds(hdr->frame_control)) return false; - /* Accept only frames that are addressed to the NAN cluster + /* + * Accept only frames that are addressed to the NAN cluster * (based on the Cluster ID). From these frames, accept only - * action frames or authentication frames that are addressed to - * the local NAN interface. + * - public action frames, + * - authentication frames to the local address, and + * - robust management frames except disassoc. */ - 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) && - ether_addr_equal(sdata->vif.addr, hdr->addr1))); + if (!ether_addr_equal(sdata->u.nan.conf.cluster_id, hdr->addr3)) + return false; + if (ieee80211_is_public_action(hdr, skb->len)) + return true; + if (ieee80211_is_auth(hdr->frame_control) && + ether_addr_equal(sdata->vif.addr, hdr->addr1)) + return true; + if (!ieee80211_is_disassoc(hdr->frame_control) && + ieee80211_is_robust_mgmt_frame(skb)) + return true; + return false; case NL80211_IFTYPE_NAN_DATA: if (ieee80211_has_tods(hdr->frame_control) || ieee80211_has_fromds(hdr->frame_control)) -- 2.34.1