From: Andrei Otcheretianski Date: Tue, 23 Dec 2025 11:46:02 +0000 (+0200) Subject: nl80211: Parse NAN capabilities X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03156a52405de6361465868091c3fb371df94a24;p=thirdparty%2Fhostap.git nl80211: Parse NAN capabilities Parse NAN capabilities in NL80211_ATTR_NAN_CAPABILITIES attribute and set the driver NAN flags accodingly. Signed-off-by: Andrei Otcheretianski --- diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 4e5af7c4e..3347cf72e 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -1210,6 +1210,39 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg) capa->nan_flags |= WPA_DRIVER_FLAGS_NAN_SUPPORT_DUAL_BAND; } + + if (tb[NL80211_ATTR_NAN_CAPABILITIES]) { + static struct nla_policy nan_capa_policy[ + NL80211_NAN_CAPABILITIES_MAX + 1] = { + [NL80211_NAN_CAPA_CONFIGURABLE_SYNC] = + { .type = NLA_FLAG }, + [NL80211_NAN_CAPA_USERSPACE_DE] = { .type = NLA_FLAG }, + }; + struct nlattr *tb_nan_capa[NL80211_NAN_CAPABILITIES_MAX + 1]; + + if (nla_parse_nested(tb_nan_capa, + NL80211_NAN_CAPABILITIES_MAX, + tb[NL80211_ATTR_NAN_CAPABILITIES], + nan_capa_policy)) { + wpa_printf(MSG_DEBUG, + "nl80211: Failed to parse NAN capabilities"); + return NL_SKIP; + } + + if (tb_nan_capa[NL80211_NAN_CAPA_CONFIGURABLE_SYNC]) { + wpa_printf(MSG_DEBUG, + "nl80211: NAN sync offload supported"); + capa->nan_flags |= + WPA_DRIVER_FLAGS_NAN_SUPPORT_SYNC_CONFIG; + } + + if (tb_nan_capa[NL80211_NAN_CAPA_USERSPACE_DE]) { + wpa_printf(MSG_DEBUG, + "nl80211: NAN user space DE is supported"); + capa->nan_flags |= + WPA_DRIVER_FLAGS_NAN_SUPPORT_USERSPACE_DE; + } + } #endif /* CONFIG_NAN */ return NL_SKIP;