[RFC 13/34] nl80211: Parse NAN capabilities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx>
---
 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 ede16cca0c..0675dd1bd9 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1204,6 +1204,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


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux