[PATCH 13/35] nl80211: Parse NAN capabilities

Andrei Otcheretianski andrei.otcheretianski at intel.com
Mon Oct 20 05:27:48 PDT 2025


Parse NAN capabilities in NL80211_ATTR_NAN_CAPABILITIES attribute and
set driver nan flags accodingly.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 src/drivers/driver_nl80211_capa.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
index c4f4c594b7..0048b081c2 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1206,6 +1206,34 @@ 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;
-- 
2.49.0




More information about the Hostap mailing list