Signed-off-by: Roman Yeryomin <ro...@advem.lv>
---
 include/iwinfo.h | 9 +++++++++
 iwinfo_cli.c     | 2 +-
 iwinfo_nl80211.c | 7 +++++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 95020a4..856525e 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -21,7 +21,9 @@
 
 
 #define IWINFO_BUFSIZE 24 * 1024
+#define IWINFO_MAX_APS         100
 #define IWINFO_ESSID_MAX_SIZE  32
+#define IWINFO_VE_MAX          10
 
 #define IWINFO_80211_A       (1 << 0)
 #define IWINFO_80211_B       (1 << 1)
@@ -119,6 +121,12 @@ struct iwinfo_crypto_entry {
        uint8_t auth_algs;
 };
 
+struct iwinfo_ve_entry {
+       uint8_t len;
+       uint8_t oui[3];
+       uint8_t data[255];
+};
+
 struct iwinfo_scanlist_entry {
        uint8_t mac[6];
        uint8_t ssid[IWINFO_ESSID_MAX_SIZE+1];
@@ -128,6 +136,7 @@ struct iwinfo_scanlist_entry {
        uint8_t quality;
        uint8_t quality_max;
        struct iwinfo_crypto_entry crypto;
+       struct iwinfo_ve_entry ve[IWINFO_VE_MAX];
 };
 
 struct iwinfo_country_entry {
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index ed6be54..85f232a 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -565,7 +565,7 @@ static void print_info(const struct iwinfo_ops *iw, const 
char *ifname)
 static void print_scanlist(const struct iwinfo_ops *iw, const char *ifname)
 {
        int i, x, len;
-       char buf[IWINFO_BUFSIZE];
+       char buf[IWINFO_MAX_APS * sizeof(struct iwinfo_scanlist_entry)];
        struct iwinfo_scanlist_entry *e;
 
        if (iw->scanlist(ifname, buf, &len))
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index efc58e6..8c595cd 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1859,6 +1859,7 @@ static void nl80211_get_scanlist_ie(struct nlattr **bss,
        unsigned char *ie = nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]);
        static unsigned char ms_oui[3] = { 0x00, 0x50, 0xf2 };
        int len;
+       int vei = 0;
 
        while (ielen >= 2 && ielen >= ie[1])
        {
@@ -1876,6 +1877,12 @@ static void nl80211_get_scanlist_ie(struct nlattr **bss,
                        break;
 
                case 221: /* Vendor */
+                       if (ie[1] >= 4 && vei < IWINFO_VE_MAX) {
+                               e->ve[vei].len = ie[1];
+                               memcpy(e->ve[vei].oui, ie + 2, 3);
+                               memcpy(e->ve[vei].data, ie + 5, ie[1] - 3);
+                               vei++;
+                       }
                        if (ie[1] >= 4 && !memcmp(ie + 2, ms_oui, 3) && ie[5] 
== 1)
                                iwinfo_parse_rsn(&e->crypto, ie + 6, ie[1] - 4,
                                                 IWINFO_CIPHER_TKIP, 
IWINFO_KMGMT_PSK);
-- 
2.1.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to