nl80211: NAN: Register multicast action frames if possible

The USD passive subscriber and solicited transmission only publisher
require receiving multicast NAN action frames in order to work.
Currently, we are not requesting to receive multicast when
registering NAN action frames. As a result, USD passive subscribe or
solicited only publish may not work.

The NL80211_ATTR_RECEIVE_MULTICAST attribute corresponds to wiphy
ext feature NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS, which
requires driver support and only a few drivers in the kernel tree
support it. Namely ath9k, ath9k_htc, ath10k and hwsim. We should
fall back to register non multicast action frames if the driver
has no support.

It was confirmed that ath9k_htc starts to work after the changes.

Note that even without requesting to receive multicast Action
frames, some drivers would still upload them. For example, rtl8192cu
and hwsim. This is why test cases like test_nan_usd_match would not
fail.

Tested-on: TP-LINK TL-WN821N v3(AR7010+AR9287, ath9k_htc)
Signed-off-by: Chien Wong <m@xv97.com>
This commit is contained in:
Chien Wong 2024-04-27 16:19:46 +08:00 committed by Jouni Malinen
parent f250c34d10
commit 6ad59779c2

View file

@ -2476,12 +2476,20 @@ static void nl80211_mgmt_handle_register_eloop(struct i802_bss *bss)
} }
static int nl80211_register_action_frame(struct i802_bss *bss, static int nl80211_register_action_frame2(struct i802_bss *bss,
const u8 *match, size_t match_len) const u8 *match, size_t match_len,
bool multicast)
{ {
u16 type = (WLAN_FC_TYPE_MGMT << 2) | (WLAN_FC_STYPE_ACTION << 4); u16 type = (WLAN_FC_TYPE_MGMT << 2) | (WLAN_FC_STYPE_ACTION << 4);
return nl80211_register_frame(bss, bss->nl_mgmt, return nl80211_register_frame(bss, bss->nl_mgmt,
type, match, match_len, false); type, match, match_len, multicast);
}
static int nl80211_register_action_frame(struct i802_bss *bss,
const u8 *match, size_t match_len)
{
return nl80211_register_action_frame2(bss, match, match_len, false);
} }
@ -2557,11 +2565,15 @@ static int nl80211_mgmt_subscribe_non_ap(struct i802_bss *bss)
ret = -1; ret = -1;
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
#ifdef CONFIG_NAN_USD #ifdef CONFIG_NAN_USD
#define NAN_PUB_ACTION ((u8 *) "\x04\x09\x50\x6f\x9a\x13")
/* NAN SDF Public Action */ /* NAN SDF Public Action */
if (nl80211_register_action_frame(bss, if (nl80211_register_action_frame2(bss, NAN_PUB_ACTION, 6, true) < 0) {
(u8 *) "\x04\x09\x50\x6f\x9a\x13", /* fallback to non-multicast */
6) < 0) if (nl80211_register_action_frame2(bss, NAN_PUB_ACTION, 6,
ret = -1; false) < 0)
ret = -1;
}
#undef NAN_PUB_ACTION
#endif /* CONFIG_NAN_USD */ #endif /* CONFIG_NAN_USD */
#ifdef CONFIG_DPP #ifdef CONFIG_DPP
/* DPP Public Action */ /* DPP Public Action */