netifd: fix wireless vif seq out of order

This commit is contained in:
hanwckf 2024-06-13 17:12:47 +08:00
parent 5665c71075
commit ab766cbcb0
2 changed files with 28 additions and 2 deletions

View File

@ -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 "")

View File

@ -0,0 +1,26 @@
From 89dd694e33b2b1c23ca8e0a5178075f9198abb83 Mon Sep 17 00:00:00 2001
From: "Allen.Ye" <allen.ye@mediatek.com>
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