From 57a57646d8c6665a1f5f41b469b665bc1503c156 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 13 Jul 2021 14:43:52 -0500 Subject: [PATCH] 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. --- src/wiphy.c | 20 ++++++++++++++++++++ src/wiphy.h | 1 + 2 files changed, 21 insertions(+) diff --git a/src/wiphy.c b/src/wiphy.c index e4e2cf7d..3812256b 100644 --- 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 index 8c99fbe7..2a38860f 100644 --- 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]);