From ab766cbcb0cc22a64e8bf816443bf3e1a56614bd Mon Sep 17 00:00:00 2001 From: hanwckf Date: Thu, 13 Jun 2024 17:12:47 +0800 Subject: [PATCH] netifd: fix wireless vif seq out of order --- .../mtwifi-cfg/files/mtwifi-cfg/mtwifi_cfg | 4 +-- ...-Fix-the-AP-sequence-is-out-of-order.patch | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 package/network/config/netifd/patches/103-mtk-Fix-the-AP-sequence-is-out-of-order.patch diff --git a/package/mtk/applications/mtwifi-cfg/files/mtwifi-cfg/mtwifi_cfg b/package/mtk/applications/mtwifi-cfg/files/mtwifi-cfg/mtwifi_cfg index b842e7b842..8c85f2c29c 100755 --- a/package/mtk/applications/mtwifi-cfg/files/mtwifi-cfg/mtwifi_cfg +++ b/package/mtk/applications/mtwifi-cfg/files/mtwifi-cfg/mtwifi_cfg @@ -169,7 +169,7 @@ function mtwifi_cfg_foreach_vif(cfg, mode, func) local vif_num,_,_ = vif_count(cfg) for idx=0,vif_num-1 do - local v = cfg.interfaces[tostring(idx)] + local v = cfg.interfaces[string.format("%02d", idx)] if v.config.mode and v.config.mode == mode then func(v) end @@ -536,7 +536,7 @@ function mtwifi_cfg_setup(argv) -- setup vif cfgs local apidx = 1 for idx = 0,vif_num-1 do - v = cfg.interfaces[tostring(idx)] + v = cfg.interfaces[string.format("%02d", idx)] if v.config.mode == "ap" then set_idx_dat(dats, apidx, "SSID", v.config.ssid) set_idx_dat(dats, apidx, "WPAPSK", v.config.key or "") diff --git a/package/network/config/netifd/patches/103-mtk-Fix-the-AP-sequence-is-out-of-order.patch b/package/network/config/netifd/patches/103-mtk-Fix-the-AP-sequence-is-out-of-order.patch new file mode 100644 index 0000000000..0bc420daaa --- /dev/null +++ b/package/network/config/netifd/patches/103-mtk-Fix-the-AP-sequence-is-out-of-order.patch @@ -0,0 +1,26 @@ +From 89dd694e33b2b1c23ca8e0a5178075f9198abb83 Mon Sep 17 00:00:00 2001 +From: "Allen.Ye" +Date: Thu, 23 Feb 2023 14:15:07 +0800 +Subject: [PATCH] netifd: mtk: Fix the AP sequence is out of order when set + over 10 Aps + +--- + wireless.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/wireless.c b/wireless.c +index 705d6dd..43c6e3c 100644 +--- a/wireless.c ++++ b/wireless.c +@@ -1192,7 +1192,7 @@ struct wireless_interface* wireless_interface_create(struct wireless_device *wde + if (cur && blobmsg_get_bool(cur)) + return NULL; + +- sprintf(name, "%d", wdev->vif_idx++); ++ sprintf(name, "%02d", wdev->vif_idx++); + + vif = calloc_a(sizeof(*vif), + &name_buf, strlen(name) + 1); +-- +2.18.0 +