commit 57a57646d8c6665a1f5f41b469b665bc1503c156
parent 3f42e4df25a1221c865dc19628876650683ca5b8
Author: Denis Kenzior <denkenz@gmail.com>
Date: Tue, 13 Jul 2021 14:43:52 -0500
wiphy: Add wiphy_get_rsnxe
Returns a template RSNX element that can be further modified by callers
to set any additional capabilities if required. wiphy will fill in
those capabilities that are driver / firmware dependent.
Diffstat:
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/wiphy.c b/src/wiphy.c
@@ -551,6 +551,26 @@ const uint8_t *wiphy_get_rm_enabled_capabilities(struct wiphy *wiphy)
return wiphy->rm_enabled_capabilities;
}
+bool wiphy_get_rsnxe(const struct wiphy *wiphy, uint8_t *buf, size_t len)
+{
+ if (len < 3)
+ return false;
+
+ buf[0] = IE_TYPE_RSNX;
+ buf[1] = 1;
+
+ /*
+ * Lower 4 bits of the first octet:
+ * The length of the Extended RSN Capabilities field, in octets,
+ * minus 1, i.e., n - 1.
+ */
+ buf[2] = 0;
+
+ /* No other bits set for now */
+
+ return true;
+}
+
static void wiphy_address_constrain(struct wiphy *wiphy, uint8_t addr[static 6])
{
switch (mac_randomize_bytes) {
diff --git a/src/wiphy.h b/src/wiphy.h
@@ -101,6 +101,7 @@ const uint8_t *wiphy_get_permanent_address(struct wiphy *wiphy);
const uint8_t *wiphy_get_extended_capabilities(struct wiphy *wiphy,
uint32_t iftype);
const uint8_t *wiphy_get_rm_enabled_capabilities(struct wiphy *wiphy);
+bool wiphy_get_rsnxe(const struct wiphy *wiphy, uint8_t *buf, size_t len);
void wiphy_get_reg_domain_country(struct wiphy *wiphy, char *out);
void wiphy_generate_random_address(struct wiphy *wiphy, uint8_t addr[static 6]);