mirror of
https://github.com/FUjr/gl-infra-builder.git
synced 2025-12-21 19:44:53 +00:00
iwinfo: fix kmgmt names
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
This commit is contained in:
parent
1261b5876e
commit
55521d9558
@ -0,0 +1,13 @@
|
|||||||
|
Index: libiwinfo-2021-06-09-c0414642/iwinfo_lib.c
|
||||||
|
===================================================================
|
||||||
|
--- libiwinfo-2021-06-09-c0414642.orig/iwinfo_lib.c
|
||||||
|
+++ libiwinfo-2021-06-09-c0414642/iwinfo_lib.c
|
||||||
|
@@ -37,6 +37,8 @@ const char *IWINFO_KMGMT_NAMES[] = {
|
||||||
|
"NONE",
|
||||||
|
"802.1X",
|
||||||
|
"PSK",
|
||||||
|
+ "SAE",
|
||||||
|
+ "OWE",
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *IWINFO_AUTH_NAMES[] = {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
From 8c956cc81d2a9e56675f4dacb790611c07524aa2 Mon Sep 17 00:00:00 2001
|
From a89b379658c32d1e6374d8f69c060969926a11bd Mon Sep 17 00:00:00 2001
|
||||||
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
|
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
|
||||||
Date: Mon, 2 Aug 2021 18:07:26 +0800
|
Date: Mon, 2 Aug 2021 18:07:26 +0800
|
||||||
Subject: [PATCH] iwinfo: add some patchs
|
Subject: [PATCH] iwinfo: add some patchs
|
||||||
@ -9,18 +9,14 @@ Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
|
|||||||
.../001-add-htmodelist-for-scan-results.patch | 170 ++++++
|
.../001-add-htmodelist-for-scan-results.patch | 170 ++++++
|
||||||
.../patches/002-fix-station-mode-scan.patch | 28 +
|
.../patches/002-fix-station-mode-scan.patch | 28 +
|
||||||
.../patches/003-support-mtk-driver.patch | 166 ++++++
|
.../patches/003-support-mtk-driver.patch | 166 ++++++
|
||||||
.../patches/004-support-scan-hidden.patch | 316 +++++++++++
|
|
||||||
.../iwinfo/patches/005-fix-kmgmp-names.patch | 11 +
|
.../iwinfo/patches/005-fix-kmgmp-names.patch | 11 +
|
||||||
.../utils/iwinfo/patches/006-async-scan.patch | 155 ++++++
|
|
||||||
package/network/utils/iwinfo/src/api/mtk.h | 71 +++
|
package/network/utils/iwinfo/src/api/mtk.h | 71 +++
|
||||||
package/network/utils/iwinfo/src/iwinfo_mtk.c | 508 ++++++++++++++++++
|
package/network/utils/iwinfo/src/iwinfo_mtk.c | 489 ++++++++++++++++++
|
||||||
9 files changed, 1436 insertions(+), 3 deletions(-)
|
7 files changed, 946 insertions(+), 3 deletions(-)
|
||||||
create mode 100644 package/network/utils/iwinfo/patches/001-add-htmodelist-for-scan-results.patch
|
create mode 100644 package/network/utils/iwinfo/patches/001-add-htmodelist-for-scan-results.patch
|
||||||
create mode 100644 package/network/utils/iwinfo/patches/002-fix-station-mode-scan.patch
|
create mode 100644 package/network/utils/iwinfo/patches/002-fix-station-mode-scan.patch
|
||||||
create mode 100644 package/network/utils/iwinfo/patches/003-support-mtk-driver.patch
|
create mode 100644 package/network/utils/iwinfo/patches/003-support-mtk-driver.patch
|
||||||
create mode 100644 package/network/utils/iwinfo/patches/004-support-scan-hidden.patch
|
|
||||||
create mode 100644 package/network/utils/iwinfo/patches/005-fix-kmgmp-names.patch
|
create mode 100644 package/network/utils/iwinfo/patches/005-fix-kmgmp-names.patch
|
||||||
create mode 100644 package/network/utils/iwinfo/patches/006-async-scan.patch
|
|
||||||
create mode 100644 package/network/utils/iwinfo/src/api/mtk.h
|
create mode 100644 package/network/utils/iwinfo/src/api/mtk.h
|
||||||
create mode 100644 package/network/utils/iwinfo/src/iwinfo_mtk.c
|
create mode 100644 package/network/utils/iwinfo/src/iwinfo_mtk.c
|
||||||
|
|
||||||
@ -445,328 +441,6 @@ index 0000000000..3aaa24f6b0
|
|||||||
+ (bc[off] == 0x7688) || (bc[off] == 0x8876)) {
|
+ (bc[off] == 0x7688) || (bc[off] == 0x8876)) {
|
||||||
+ /* vendor: MediaTek */
|
+ /* vendor: MediaTek */
|
||||||
+ id->vendor_id = 0x14c3;
|
+ id->vendor_id = 0x14c3;
|
||||||
diff --git a/package/network/utils/iwinfo/patches/004-support-scan-hidden.patch b/package/network/utils/iwinfo/patches/004-support-scan-hidden.patch
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000..61093c7850
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/package/network/utils/iwinfo/patches/004-support-scan-hidden.patch
|
|
||||||
@@ -0,0 +1,316 @@
|
|
||||||
+--- a/include/iwinfo.h
|
|
||||||
++++ b/include/iwinfo.h
|
|
||||||
+@@ -242,6 +242,7 @@ struct iwinfo_ops {
|
|
||||||
+ int (*assoclist)(const char *, char *, int *);
|
|
||||||
+ int (*txpwrlist)(const char *, char *, int *);
|
|
||||||
+ int (*scanlist)(const char *, char *, int *);
|
|
||||||
++ int (*scanlist_ssid)(const char *, char *, int *, const char *);
|
|
||||||
+ int (*freqlist)(const char *, char *, int *);
|
|
||||||
+ int (*countrylist)(const char *, char *, int *);
|
|
||||||
+ int (*survey)(const char *, char *, int *);
|
|
||||||
+--- a/iwinfo_lua.c
|
|
||||||
++++ b/iwinfo_lua.c
|
|
||||||
+@@ -382,77 +382,98 @@ static int iwinfo_L_txpwrlist(lua_State
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Wrapper for scan list */
|
|
||||||
+-static int iwinfo_L_scanlist(lua_State *L, int (*func)(const char *, char *, int *))
|
|
||||||
++static void parse_scanlist(lua_State *L, char *rv, int len, const char *ssid)
|
|
||||||
+ {
|
|
||||||
+- int i, x, h, len = 0;
|
|
||||||
+- char rv[IWINFO_BUFSIZE];
|
|
||||||
+- char macstr[18];
|
|
||||||
+- const char *ifname = luaL_checkstring(L, 1);
|
|
||||||
+ struct iwinfo_scanlist_entry *e;
|
|
||||||
++ char macstr[18];
|
|
||||||
++ int i, x, h;
|
|
||||||
+
|
|
||||||
+- lua_newtable(L);
|
|
||||||
+- memset(rv, 0, sizeof(rv));
|
|
||||||
+-
|
|
||||||
+- if (!(*func)(ifname, rv, &len))
|
|
||||||
++ for (i = 0, x = 1; i < len; i += sizeof(struct iwinfo_scanlist_entry))
|
|
||||||
+ {
|
|
||||||
+- for (i = 0, x = 1; i < len; i += sizeof(struct iwinfo_scanlist_entry), x++)
|
|
||||||
+- {
|
|
||||||
+- e = (struct iwinfo_scanlist_entry *) &rv[i];
|
|
||||||
+-
|
|
||||||
+- lua_newtable(L);
|
|
||||||
++ e = (struct iwinfo_scanlist_entry *) &rv[i];
|
|
||||||
+
|
|
||||||
+- /* BSSID */
|
|
||||||
+- sprintf(macstr, "%02X:%02X:%02X:%02X:%02X:%02X",
|
|
||||||
+- e->mac[0], e->mac[1], e->mac[2],
|
|
||||||
+- e->mac[3], e->mac[4], e->mac[5]);
|
|
||||||
++ lua_newtable(L);
|
|
||||||
+
|
|
||||||
+- lua_pushstring(L, macstr);
|
|
||||||
+- lua_setfield(L, -2, "bssid");
|
|
||||||
++ /* BSSID */
|
|
||||||
++ sprintf(macstr, "%02X:%02X:%02X:%02X:%02X:%02X",
|
|
||||||
++ e->mac[0], e->mac[1], e->mac[2],
|
|
||||||
++ e->mac[3], e->mac[4], e->mac[5]);
|
|
||||||
+
|
|
||||||
+- /* ESSID */
|
|
||||||
+- if (e->ssid[0])
|
|
||||||
+- {
|
|
||||||
+- lua_pushstring(L, (char *) e->ssid);
|
|
||||||
+- lua_setfield(L, -2, "ssid");
|
|
||||||
+- }
|
|
||||||
++ lua_pushstring(L, macstr);
|
|
||||||
++ lua_setfield(L, -2, "bssid");
|
|
||||||
+
|
|
||||||
+- /* Channel */
|
|
||||||
+- lua_pushinteger(L, e->channel);
|
|
||||||
+- lua_setfield(L, -2, "channel");
|
|
||||||
++ /* ESSID */
|
|
||||||
++ if (e->ssid[0])
|
|
||||||
++ {
|
|
||||||
++ lua_pushstring(L, (char *) e->ssid);
|
|
||||||
++ lua_setfield(L, -2, "ssid");
|
|
||||||
++ }
|
|
||||||
+
|
|
||||||
+- /* Mode */
|
|
||||||
+- lua_pushstring(L, IWINFO_OPMODE_NAMES[e->mode]);
|
|
||||||
+- lua_setfield(L, -2, "mode");
|
|
||||||
+-
|
|
||||||
+- /* Quality, Signal */
|
|
||||||
+- lua_pushinteger(L, e->quality);
|
|
||||||
+- lua_setfield(L, -2, "quality");
|
|
||||||
+-
|
|
||||||
+- lua_pushinteger(L, e->quality_max);
|
|
||||||
+- lua_setfield(L, -2, "quality_max");
|
|
||||||
+-
|
|
||||||
+- lua_pushnumber(L, (e->signal - 0x100));
|
|
||||||
+- lua_setfield(L, -2, "signal");
|
|
||||||
+-
|
|
||||||
+- /* Crypto */
|
|
||||||
+- iwinfo_L_cryptotable(L, &e->crypto);
|
|
||||||
+- lua_setfield(L, -2, "encryption");
|
|
||||||
++ /* Channel */
|
|
||||||
++ lua_pushinteger(L, e->channel);
|
|
||||||
++ lua_setfield(L, -2, "channel");
|
|
||||||
++
|
|
||||||
++ /* Mode */
|
|
||||||
++ lua_pushstring(L, IWINFO_OPMODE_NAMES[e->mode]);
|
|
||||||
++ lua_setfield(L, -2, "mode");
|
|
||||||
++
|
|
||||||
++ /* Quality, Signal */
|
|
||||||
++ lua_pushinteger(L, e->quality);
|
|
||||||
++ lua_setfield(L, -2, "quality");
|
|
||||||
++
|
|
||||||
++ lua_pushinteger(L, e->quality_max);
|
|
||||||
++ lua_setfield(L, -2, "quality_max");
|
|
||||||
++
|
|
||||||
++ lua_pushnumber(L, (e->signal - 0x100));
|
|
||||||
++ lua_setfield(L, -2, "signal");
|
|
||||||
++
|
|
||||||
++ /* Crypto */
|
|
||||||
++ iwinfo_L_cryptotable(L, &e->crypto);
|
|
||||||
++ lua_setfield(L, -2, "encryption");
|
|
||||||
+
|
|
||||||
+- /* HT Modes */
|
|
||||||
+- if (e->htmodelist)
|
|
||||||
++ /* HT Modes */
|
|
||||||
++ if (e->htmodelist)
|
|
||||||
++ {
|
|
||||||
++ lua_newtable(L);
|
|
||||||
++ for (h = 0; h < ARRAY_SIZE(IWINFO_HTMODE_NAMES); h++)
|
|
||||||
+ {
|
|
||||||
+- lua_newtable(L);
|
|
||||||
+- for (h = 0; h < ARRAY_SIZE(IWINFO_HTMODE_NAMES); h++)
|
|
||||||
+- {
|
|
||||||
+- lua_pushboolean(L, e->htmodelist & (1 << h));
|
|
||||||
+- lua_setfield(L, -2, IWINFO_HTMODE_NAMES[h]);
|
|
||||||
+- }
|
|
||||||
+- lua_setfield(L, -2, "htmodelist");
|
|
||||||
++ lua_pushboolean(L, e->htmodelist & (1 << h));
|
|
||||||
++ lua_setfield(L, -2, IWINFO_HTMODE_NAMES[h]);
|
|
||||||
+ }
|
|
||||||
+-
|
|
||||||
+- lua_rawseti(L, -2, x);
|
|
||||||
++ lua_setfield(L, -2, "htmodelist");
|
|
||||||
+ }
|
|
||||||
++
|
|
||||||
++ lua_rawseti(L, -2, x++);
|
|
||||||
+ }
|
|
||||||
++}
|
|
||||||
++
|
|
||||||
++static int iwinfo_L_scanlist(lua_State *L, int (*func)(const char *, char *, int *))
|
|
||||||
++{
|
|
||||||
++ int len = 0;
|
|
||||||
++ char rv[IWINFO_BUFSIZE];
|
|
||||||
++ const char *ifname = luaL_checkstring(L, 1);
|
|
||||||
++
|
|
||||||
++ lua_newtable(L);
|
|
||||||
++ memset(rv, 0, sizeof(rv));
|
|
||||||
++
|
|
||||||
++ if (!(*func)(ifname, rv, &len))
|
|
||||||
++ parse_scanlist(L, rv, len, NULL);
|
|
||||||
++
|
|
||||||
++ return 1;
|
|
||||||
++}
|
|
||||||
++
|
|
||||||
++static int iwinfo_L_scanlist_ssid(lua_State *L, int (*func)(const char *, char *, int *, const char *))
|
|
||||||
++{
|
|
||||||
++ int len = 0;
|
|
||||||
++ char rv[IWINFO_BUFSIZE];
|
|
||||||
++ const char *ifname = luaL_checkstring(L, 1);
|
|
||||||
++ const char *ssid = lua_tostring(L, 2);
|
|
||||||
++
|
|
||||||
++ lua_newtable(L);
|
|
||||||
++ memset(rv, 0, sizeof(rv));
|
|
||||||
++
|
|
||||||
++ if (!(*func)(ifname, rv, &len, ssid))
|
|
||||||
++ parse_scanlist(L, rv, len, ssid);
|
|
||||||
+
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+@@ -753,6 +774,7 @@ LUA_WRAP_STRUCT_OP(nl80211,mode)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(nl80211,assoclist)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(nl80211,txpwrlist)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(nl80211,scanlist)
|
|
||||||
++LUA_WRAP_STRUCT_OP(nl80211,scanlist_ssid)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(nl80211,freqlist)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(nl80211,countrylist)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(nl80211,hwmodelist)
|
|
||||||
+@@ -783,6 +805,7 @@ LUA_WRAP_STRUCT_OP(mtk,mode)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(mtk,assoclist)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(mtk,txpwrlist)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(mtk,scanlist)
|
|
||||||
++LUA_WRAP_STRUCT_OP(mtk,scanlist_ssid)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(mtk,freqlist)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(mtk,countrylist)
|
|
||||||
+ LUA_WRAP_STRUCT_OP(mtk,hwmodelist)
|
|
||||||
+@@ -906,6 +929,7 @@ static const luaL_reg R_nl80211[] = {
|
|
||||||
+ LUA_REG(nl80211,assoclist),
|
|
||||||
+ LUA_REG(nl80211,txpwrlist),
|
|
||||||
+ LUA_REG(nl80211,scanlist),
|
|
||||||
++ LUA_REG(nl80211,scanlist_ssid),
|
|
||||||
+ LUA_REG(nl80211,freqlist),
|
|
||||||
+ LUA_REG(nl80211,countrylist),
|
|
||||||
+ LUA_REG(nl80211,hwmodelist),
|
|
||||||
+@@ -939,6 +963,7 @@ static const luaL_reg R_mtk[] = {
|
|
||||||
+ LUA_REG(mtk,assoclist),
|
|
||||||
+ LUA_REG(mtk,txpwrlist),
|
|
||||||
+ LUA_REG(mtk,scanlist),
|
|
||||||
++ LUA_REG(mtk,scanlist_ssid),
|
|
||||||
+ LUA_REG(mtk,freqlist),
|
|
||||||
+ LUA_REG(mtk,countrylist),
|
|
||||||
+ LUA_REG(mtk,hwmodelist),
|
|
||||||
+--- a/iwinfo_nl80211.c
|
|
||||||
++++ b/iwinfo_nl80211.c
|
|
||||||
+@@ -2476,11 +2476,30 @@ static int nl80211_get_scanlist_cb(struc
|
|
||||||
+ return NL_SKIP;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+-static int nl80211_get_scanlist_nl(const char *ifname, char *buf, int *len)
|
|
||||||
++static int nl80211_get_scanlist_nl(const char *ifname, char *buf, int *len, const char *ssid)
|
|
||||||
+ {
|
|
||||||
+ struct nl80211_scanlist sl = { .e = (struct iwinfo_scanlist_entry *)buf };
|
|
||||||
++ struct nl80211_msg_conveyor *cv;
|
|
||||||
++
|
|
||||||
++ cv = nl80211_msg(ifname, NL80211_CMD_TRIGGER_SCAN, 0);
|
|
||||||
++ if (!cv)
|
|
||||||
++ return -ENOMEM;
|
|
||||||
++
|
|
||||||
++ if (ssid && ssid[0])
|
|
||||||
++ {
|
|
||||||
++ struct nl_msg *ssids = nlmsg_alloc();
|
|
||||||
++ if (!ssids)
|
|
||||||
++ {
|
|
||||||
++ nl80211_free(cv);
|
|
||||||
++ return -ENOMEM;
|
|
||||||
++ }
|
|
||||||
+
|
|
||||||
+- if (nl80211_request(ifname, NL80211_CMD_TRIGGER_SCAN, 0, NULL, NULL))
|
|
||||||
++ nla_put(ssids, 1, strlen(ssid), ssid);
|
|
||||||
++ nla_put_nested(cv->msg, NL80211_ATTR_SCAN_SSIDS, ssids);
|
|
||||||
++ nlmsg_free(ssids);
|
|
||||||
++ }
|
|
||||||
++
|
|
||||||
++ if (nl80211_send(cv, NULL, NULL))
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
+ if (nl80211_wait("nl80211", "scan",
|
|
||||||
+@@ -2709,7 +2728,7 @@ static int nl80211_get_scanlist_wpactl(c
|
|
||||||
+ return (count >= 0) ? 0 : -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+-static int nl80211_get_scanlist(const char *ifname, char *buf, int *len)
|
|
||||||
++static int nl80211_get_scanlist_ssid(const char *ifname, char *buf, int *len, const char *ssid)
|
|
||||||
+ {
|
|
||||||
+ char *res;
|
|
||||||
+ int rv, mode;
|
|
||||||
+@@ -2722,13 +2741,13 @@ static int nl80211_get_scanlist(const ch
|
|
||||||
+ /* Reuse existing interface */
|
|
||||||
+ if ((res = nl80211_phy2ifname(ifname)) != NULL)
|
|
||||||
+ {
|
|
||||||
+- return nl80211_get_scanlist(res, buf, len);
|
|
||||||
++ return nl80211_get_scanlist_ssid(res, buf, len, ssid);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Need to spawn a temporary iface for scanning */
|
|
||||||
+ else if ((res = nl80211_ifadd(ifname)) != NULL)
|
|
||||||
+ {
|
|
||||||
+- rv = nl80211_get_scanlist(res, buf, len);
|
|
||||||
++ rv = nl80211_get_scanlist_ssid(res, buf, len, ssid);
|
|
||||||
+ nl80211_ifdel(res);
|
|
||||||
+ return rv;
|
|
||||||
+ }
|
|
||||||
+@@ -2749,7 +2768,7 @@ static int nl80211_get_scanlist(const ch
|
|
||||||
+ mode == IWINFO_OPMODE_MONITOR) &&
|
|
||||||
+ iwinfo_ifup(ifname))
|
|
||||||
+ {
|
|
||||||
+- return nl80211_get_scanlist_nl(ifname, buf, len);
|
|
||||||
++ return nl80211_get_scanlist_nl(ifname, buf, len, ssid);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* AP scan */
|
|
||||||
+@@ -2761,7 +2780,7 @@ static int nl80211_get_scanlist(const ch
|
|
||||||
+ if (!iwinfo_ifup(ifname))
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+- rv = nl80211_get_scanlist_nl(ifname, buf, len);
|
|
||||||
++ rv = nl80211_get_scanlist_nl(ifname, buf, len, ssid);
|
|
||||||
+ iwinfo_ifdown(ifname);
|
|
||||||
+ return rv;
|
|
||||||
+ }
|
|
||||||
+@@ -2778,7 +2797,7 @@ static int nl80211_get_scanlist(const ch
|
|
||||||
+ * additional interface and there's no need to tear down the ap */
|
|
||||||
+ if (iwinfo_ifup(res))
|
|
||||||
+ {
|
|
||||||
+- rv = nl80211_get_scanlist_nl(res, buf, len);
|
|
||||||
++ rv = nl80211_get_scanlist_nl(res, buf, len, ssid);
|
|
||||||
+ iwinfo_ifdown(res);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+@@ -2786,7 +2805,7 @@ static int nl80211_get_scanlist(const ch
|
|
||||||
+ * during scan */
|
|
||||||
+ else if (iwinfo_ifdown(ifname) && iwinfo_ifup(res))
|
|
||||||
+ {
|
|
||||||
+- rv = nl80211_get_scanlist_nl(res, buf, len);
|
|
||||||
++ rv = nl80211_get_scanlist_nl(res, buf, len, ssid);
|
|
||||||
+ iwinfo_ifdown(res);
|
|
||||||
+ iwinfo_ifup(ifname);
|
|
||||||
+ nl80211_hostapd_hup(ifname);
|
|
||||||
+@@ -2800,6 +2819,11 @@ static int nl80211_get_scanlist(const ch
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
++static int nl80211_get_scanlist(const char *ifname, char *buf, int *len)
|
|
||||||
++{
|
|
||||||
++ return nl80211_get_scanlist_ssid(ifname, buf, len, NULL);
|
|
||||||
++}
|
|
||||||
++
|
|
||||||
+ static int nl80211_get_freqlist_cb(struct nl_msg *msg, void *arg)
|
|
||||||
+ {
|
|
||||||
+ int bands_remain, freqs_remain;
|
|
||||||
+@@ -3238,6 +3262,7 @@ const struct iwinfo_ops nl80211_ops = {
|
|
||||||
+ .assoclist = nl80211_get_assoclist,
|
|
||||||
+ .txpwrlist = nl80211_get_txpwrlist,
|
|
||||||
+ .scanlist = nl80211_get_scanlist,
|
|
||||||
++ .scanlist_ssid = nl80211_get_scanlist_ssid,
|
|
||||||
+ .freqlist = nl80211_get_freqlist,
|
|
||||||
+ .countrylist = nl80211_get_countrylist,
|
|
||||||
+ .survey = nl80211_get_survey,
|
|
||||||
diff --git a/package/network/utils/iwinfo/patches/005-fix-kmgmp-names.patch b/package/network/utils/iwinfo/patches/005-fix-kmgmp-names.patch
|
diff --git a/package/network/utils/iwinfo/patches/005-fix-kmgmp-names.patch b/package/network/utils/iwinfo/patches/005-fix-kmgmp-names.patch
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..c47f605136
|
index 0000000000..c47f605136
|
||||||
@ -784,167 +458,6 @@ index 0000000000..c47f605136
|
|||||||
+ };
|
+ };
|
||||||
+
|
+
|
||||||
+ const char *IWINFO_AUTH_NAMES[] = {
|
+ const char *IWINFO_AUTH_NAMES[] = {
|
||||||
diff --git a/package/network/utils/iwinfo/patches/006-async-scan.patch b/package/network/utils/iwinfo/patches/006-async-scan.patch
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000..ef2be89105
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/package/network/utils/iwinfo/patches/006-async-scan.patch
|
|
||||||
@@ -0,0 +1,155 @@
|
|
||||||
+--- a/include/iwinfo.h
|
|
||||||
++++ b/include/iwinfo.h
|
|
||||||
+@@ -94,6 +94,11 @@ enum iwinfo_htmode {
|
|
||||||
+
|
|
||||||
+ extern const char *IWINFO_HTMODE_NAMES[IWINFO_HTMODE_COUNT];
|
|
||||||
+
|
|
||||||
++enum iwinfo_scan_type {
|
|
||||||
++ IWINFO_SCAN_DEFAULT,
|
|
||||||
++ IWINFO_SCAN_TRIGGER,
|
|
||||||
++ IWINFO_SCAN_DUMP
|
|
||||||
++};
|
|
||||||
+
|
|
||||||
+ struct iwinfo_rate_entry {
|
|
||||||
+ uint32_t rate;
|
|
||||||
+@@ -242,7 +247,7 @@ struct iwinfo_ops {
|
|
||||||
+ int (*assoclist)(const char *, char *, int *);
|
|
||||||
+ int (*txpwrlist)(const char *, char *, int *);
|
|
||||||
+ int (*scanlist)(const char *, char *, int *);
|
|
||||||
+- int (*scanlist_ssid)(const char *, char *, int *, const char *);
|
|
||||||
++ int (*scanlist_ssid)(const char *, char *, int *, const char *, enum iwinfo_scan_type);
|
|
||||||
+ int (*freqlist)(const char *, char *, int *);
|
|
||||||
+ int (*countrylist)(const char *, char *, int *);
|
|
||||||
+ int (*survey)(const char *, char *, int *);
|
|
||||||
+--- a/iwinfo_lua.c
|
|
||||||
++++ b/iwinfo_lua.c
|
|
||||||
+@@ -462,17 +462,20 @@ static int iwinfo_L_scanlist(lua_State *
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+-static int iwinfo_L_scanlist_ssid(lua_State *L, int (*func)(const char *, char *, int *, const char *))
|
|
||||||
++static int iwinfo_L_scanlist_ssid(lua_State *L, int (*func)(const char *, char *, int *,
|
|
||||||
++ const char *, enum iwinfo_scan_type))
|
|
||||||
+ {
|
|
||||||
+ int len = 0;
|
|
||||||
+ char rv[IWINFO_BUFSIZE];
|
|
||||||
+ const char *ifname = luaL_checkstring(L, 1);
|
|
||||||
+ const char *ssid = lua_tostring(L, 2);
|
|
||||||
++ enum iwinfo_scan_type type = lua_tointeger(L, 3);
|
|
||||||
+
|
|
||||||
+ lua_newtable(L);
|
|
||||||
++
|
|
||||||
+ memset(rv, 0, sizeof(rv));
|
|
||||||
+
|
|
||||||
+- if (!(*func)(ifname, rv, &len, ssid))
|
|
||||||
++ if (!(*func)(ifname, rv, &len, ssid, type))
|
|
||||||
+ parse_scanlist(L, rv, len, ssid);
|
|
||||||
+
|
|
||||||
+ return 1;
|
|
||||||
+--- a/iwinfo_nl80211.c
|
|
||||||
++++ b/iwinfo_nl80211.c
|
|
||||||
+@@ -2476,11 +2476,15 @@ static int nl80211_get_scanlist_cb(struc
|
|
||||||
+ return NL_SKIP;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+-static int nl80211_get_scanlist_nl(const char *ifname, char *buf, int *len, const char *ssid)
|
|
||||||
++static int nl80211_get_scanlist_nl(const char *ifname, char *buf, int *len,
|
|
||||||
++ const char *ssid, enum iwinfo_scan_type type)
|
|
||||||
+ {
|
|
||||||
+ struct nl80211_scanlist sl = { .e = (struct iwinfo_scanlist_entry *)buf };
|
|
||||||
+ struct nl80211_msg_conveyor *cv;
|
|
||||||
+
|
|
||||||
++ if (type == IWINFO_SCAN_DUMP)
|
|
||||||
++ goto dump;
|
|
||||||
++
|
|
||||||
+ cv = nl80211_msg(ifname, NL80211_CMD_TRIGGER_SCAN, 0);
|
|
||||||
+ if (!cv)
|
|
||||||
+ return -ENOMEM;
|
|
||||||
+@@ -2502,10 +2506,16 @@ static int nl80211_get_scanlist_nl(const
|
|
||||||
+ if (nl80211_send(cv, NULL, NULL))
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
++ if (type == IWINFO_SCAN_TRIGGER) {
|
|
||||||
++ *len = 0;
|
|
||||||
++ return 0;
|
|
||||||
++ }
|
|
||||||
++
|
|
||||||
+ if (nl80211_wait("nl80211", "scan",
|
|
||||||
+ NL80211_CMD_NEW_SCAN_RESULTS, NL80211_CMD_SCAN_ABORTED))
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
++dump:
|
|
||||||
+ if (nl80211_request(ifname, NL80211_CMD_GET_SCAN, NLM_F_DUMP,
|
|
||||||
+ nl80211_get_scanlist_cb, &sl))
|
|
||||||
+ goto out;
|
|
||||||
+@@ -2728,7 +2738,8 @@ static int nl80211_get_scanlist_wpactl(c
|
|
||||||
+ return (count >= 0) ? 0 : -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+-static int nl80211_get_scanlist_ssid(const char *ifname, char *buf, int *len, const char *ssid)
|
|
||||||
++static int nl80211_get_scanlist_ssid(const char *ifname, char *buf, int *len,
|
|
||||||
++ const char *ssid, enum iwinfo_scan_type type)
|
|
||||||
+ {
|
|
||||||
+ char *res;
|
|
||||||
+ int rv, mode;
|
|
||||||
+@@ -2741,13 +2752,13 @@ static int nl80211_get_scanlist_ssid(con
|
|
||||||
+ /* Reuse existing interface */
|
|
||||||
+ if ((res = nl80211_phy2ifname(ifname)) != NULL)
|
|
||||||
+ {
|
|
||||||
+- return nl80211_get_scanlist_ssid(res, buf, len, ssid);
|
|
||||||
++ return nl80211_get_scanlist_ssid(res, buf, len, ssid, type);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Need to spawn a temporary iface for scanning */
|
|
||||||
+ else if ((res = nl80211_ifadd(ifname)) != NULL)
|
|
||||||
+ {
|
|
||||||
+- rv = nl80211_get_scanlist_ssid(res, buf, len, ssid);
|
|
||||||
++ rv = nl80211_get_scanlist_ssid(res, buf, len, ssid, type);
|
|
||||||
+ nl80211_ifdel(res);
|
|
||||||
+ return rv;
|
|
||||||
+ }
|
|
||||||
+@@ -2768,7 +2779,7 @@ static int nl80211_get_scanlist_ssid(con
|
|
||||||
+ mode == IWINFO_OPMODE_MONITOR) &&
|
|
||||||
+ iwinfo_ifup(ifname))
|
|
||||||
+ {
|
|
||||||
+- return nl80211_get_scanlist_nl(ifname, buf, len, ssid);
|
|
||||||
++ return nl80211_get_scanlist_nl(ifname, buf, len, ssid, type);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* AP scan */
|
|
||||||
+@@ -2780,7 +2791,7 @@ static int nl80211_get_scanlist_ssid(con
|
|
||||||
+ if (!iwinfo_ifup(ifname))
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+- rv = nl80211_get_scanlist_nl(ifname, buf, len, ssid);
|
|
||||||
++ rv = nl80211_get_scanlist_nl(ifname, buf, len, ssid, type);
|
|
||||||
+ iwinfo_ifdown(ifname);
|
|
||||||
+ return rv;
|
|
||||||
+ }
|
|
||||||
+@@ -2797,7 +2808,7 @@ static int nl80211_get_scanlist_ssid(con
|
|
||||||
+ * additional interface and there's no need to tear down the ap */
|
|
||||||
+ if (iwinfo_ifup(res))
|
|
||||||
+ {
|
|
||||||
+- rv = nl80211_get_scanlist_nl(res, buf, len, ssid);
|
|
||||||
++ rv = nl80211_get_scanlist_nl(res, buf, len, ssid, type);
|
|
||||||
+ iwinfo_ifdown(res);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+@@ -2805,7 +2816,7 @@ static int nl80211_get_scanlist_ssid(con
|
|
||||||
+ * during scan */
|
|
||||||
+ else if (iwinfo_ifdown(ifname) && iwinfo_ifup(res))
|
|
||||||
+ {
|
|
||||||
+- rv = nl80211_get_scanlist_nl(res, buf, len, ssid);
|
|
||||||
++ rv = nl80211_get_scanlist_nl(res, buf, len, ssid, type);
|
|
||||||
+ iwinfo_ifdown(res);
|
|
||||||
+ iwinfo_ifup(ifname);
|
|
||||||
+ nl80211_hostapd_hup(ifname);
|
|
||||||
+@@ -2821,7 +2832,7 @@ static int nl80211_get_scanlist_ssid(con
|
|
||||||
+
|
|
||||||
+ static int nl80211_get_scanlist(const char *ifname, char *buf, int *len)
|
|
||||||
+ {
|
|
||||||
+- return nl80211_get_scanlist_ssid(ifname, buf, len, NULL);
|
|
||||||
++ return nl80211_get_scanlist_ssid(ifname, buf, len, NULL, 0);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ static int nl80211_get_freqlist_cb(struct nl_msg *msg, void *arg)
|
|
||||||
diff --git a/package/network/utils/iwinfo/src/api/mtk.h b/package/network/utils/iwinfo/src/api/mtk.h
|
diff --git a/package/network/utils/iwinfo/src/api/mtk.h b/package/network/utils/iwinfo/src/api/mtk.h
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..82a5ed7fce
|
index 0000000000..82a5ed7fce
|
||||||
@ -1024,10 +537,10 @@ index 0000000000..82a5ed7fce
|
|||||||
+#endif // __MTK_H__
|
+#endif // __MTK_H__
|
||||||
diff --git a/package/network/utils/iwinfo/src/iwinfo_mtk.c b/package/network/utils/iwinfo/src/iwinfo_mtk.c
|
diff --git a/package/network/utils/iwinfo/src/iwinfo_mtk.c b/package/network/utils/iwinfo/src/iwinfo_mtk.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..ab9ccab05a
|
index 0000000000..0ef10f4ab3
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/package/network/utils/iwinfo/src/iwinfo_mtk.c
|
+++ b/package/network/utils/iwinfo/src/iwinfo_mtk.c
|
||||||
@@ -0,0 +1,508 @@
|
@@ -0,0 +1,489 @@
|
||||||
+/*
|
+/*
|
||||||
+ * iwinfo - Wireless Information Library - Linux Wireless Extension Backend
|
+ * iwinfo - Wireless Information Library - Linux Wireless Extension Backend
|
||||||
+ *
|
+ *
|
||||||
@ -1297,31 +810,18 @@ index 0000000000..ab9ccab05a
|
|||||||
+ int htmodelist;
|
+ int htmodelist;
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+static int mtk_get_scanlist_ssid(const char *ifname, char *buf, int *len,
|
+static int mtk_get_scanlist(const char *ifname, char *buf, int *len)
|
||||||
+ const char *ssid, enum iwinfo_scan_type type)
|
|
||||||
+{
|
+{
|
||||||
+ struct iwinfo_scanlist_entry sce;
|
+ struct iwinfo_scanlist_entry sce;
|
||||||
+ char action[64] = "SiteSurvey=";
|
+ char action[64] = "SiteSurvey=";
|
||||||
+ char buf2[IWINFO_BUFSIZE];
|
+ char buf2[IWINFO_BUFSIZE];
|
||||||
+ int i, length;
|
+ int i, length;
|
||||||
+
|
+
|
||||||
+ if (type == IWINFO_SCAN_DUMP)
|
|
||||||
+ goto dump;
|
|
||||||
+
|
|
||||||
+ if (ssid && ssid[0])
|
|
||||||
+ snprintf(action, sizeof(action), "SiteSurvey=%s", ssid);
|
|
||||||
+
|
|
||||||
+ if(mtk_get80211priv(ifname, RTPRIV_IOCTL_SET, action, sizeof(action)) < 0)
|
+ if(mtk_get80211priv(ifname, RTPRIV_IOCTL_SET, action, sizeof(action)) < 0)
|
||||||
+ return -1;
|
+ return -1;
|
||||||
+
|
+
|
||||||
+ if (type == IWINFO_SCAN_TRIGGER) {
|
|
||||||
+ *len = 0;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ sleep(5);
|
+ sleep(5);
|
||||||
+
|
+
|
||||||
+dump:
|
|
||||||
+ strcpy(buf2, "fine");
|
+ strcpy(buf2, "fine");
|
||||||
+
|
+
|
||||||
+ length = mtk_get80211priv(ifname, RTPRIV_IOCTL_GSITESURVEY, buf2, sizeof(buf2));
|
+ length = mtk_get80211priv(ifname, RTPRIV_IOCTL_GSITESURVEY, buf2, sizeof(buf2));
|
||||||
@ -1359,11 +859,6 @@ index 0000000000..ab9ccab05a
|
|||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int mtk_get_scanlist(const char *ifname, char *buf, int *len)
|
|
||||||
+{
|
|
||||||
+ return mtk_get_scanlist_ssid(ifname, buf, len, NULL, 0);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int mtk_get_freqlist(const char *ifname, char *buf, int *len)
|
+static int mtk_get_freqlist(const char *ifname, char *buf, int *len)
|
||||||
+{
|
+{
|
||||||
+ return wext_ops.freqlist(ifname, buf, len);
|
+ return wext_ops.freqlist(ifname, buf, len);
|
||||||
@ -1531,11 +1026,10 @@ index 0000000000..ab9ccab05a
|
|||||||
+ .assoclist = mtk_get_assoclist,
|
+ .assoclist = mtk_get_assoclist,
|
||||||
+ .txpwrlist = mtk_get_txpwrlist,
|
+ .txpwrlist = mtk_get_txpwrlist,
|
||||||
+ .scanlist = mtk_get_scanlist,
|
+ .scanlist = mtk_get_scanlist,
|
||||||
+ .scanlist_ssid = mtk_get_scanlist_ssid,
|
|
||||||
+ .freqlist = mtk_get_freqlist,
|
+ .freqlist = mtk_get_freqlist,
|
||||||
+ .countrylist = mtk_get_countrylist,
|
+ .countrylist = mtk_get_countrylist,
|
||||||
+ .close = mtk_close
|
+ .close = mtk_close
|
||||||
+};
|
+};
|
||||||
--
|
--
|
||||||
2.17.1
|
2.25.1
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user