mtwifi-cfg: add support for KickStaRssiLow and AssocReqRssiThres

This commit is contained in:
hanwckf 2023-12-05 20:57:29 +08:00
parent 98cf9c1c47
commit 4c0506adc5
3 changed files with 37 additions and 2 deletions

View File

@ -203,6 +203,30 @@ function mtwifi_reinstall()
--os.execute("modprobe mt_whnat")
end
function __exec_iwpriv_cmd(ifname, key, val)
local cmd = string.format("iwpriv %s set %s=%s", ifname, key, tostring(val))
nixio.syslog("info", "mtwifi-cfg: iwpriv cmd: "..cmd)
os.execute(cmd)
end
function mtwifi_cfg_iwpriv_hook(cfg)
local cmd
local iwpriv_cfgs = {}
if cfg == nil then return end
for _, v in pairs(cfg.interfaces) do
if not v.config.disabled and v.mtwifi_ifname then
local vif = v.mtwifi_ifname
local mode = v.config.mode
if mode == "ap" then
iwpriv_cfgs = defs.iwpriv_ap_cfgs
end
for k, j in pairs(iwpriv_cfgs) do
__exec_iwpriv_cmd(vif, j[1], v.config[k] or j[2])
end
end
end
end
function mtwifi_cfg_setup(argv)
local cfg = cjson.decode(argv)
@ -467,7 +491,7 @@ function mtwifi_cfg_setup(argv)
if k == devname then
mtwifi_up(k, cfg, nil, true)
else
os.execute("/sbin/wifi up " .. k)
os.execute("/sbin/wifi up " .. k) -- TODO: may cause deadlock
end
end
else
@ -506,6 +530,9 @@ function mtwifi_cfg_setup(argv)
mtwifi_up(devname, cfg)
end
mtwifi_cfg_iwpriv_hook(cfg)
end
function mtwifi_cfg_down(devname)

View File

@ -67,6 +67,7 @@ mtwifi_defs.vif_cfgs = {
["DLSCapable"] = "0",
["WdsEnable"] = "0",
["WscConfMode"] = "0",
["TxRate"] = "0",
}
mtwifi_defs.vif_cfgs_idx = {
@ -85,6 +86,12 @@ mtwifi_defs.reinstall_cfgs = {
"HT_RxStream", "HT_TxStream", "WdsEnable"
}
mtwifi_defs.iwpriv_ap_cfgs = {
-- uci config = iwpriv set cmd , default value
["kicklow"] = {"KickStaRssiLow", "0"},
["assocthres"] = {"AssocReqRssiThres" , "0"},
}
mtwifi_defs.enc2dat = {
-- enc = AuthMode, EncrypType
["none"] = {"OPEN", "NONE"},

View File

@ -20,7 +20,7 @@ drv_mtwifi_init_device_config() {
}
drv_mtwifi_init_iface_config() {
config_add_string 'ssid:string' macfilter bssid
config_add_string 'ssid:string' macfilter bssid kicklow assocthres
config_add_boolean wmm hidden isolate ieee80211k
config_add_int wpa_group_rekey
config_add_array 'maclist:list(macaddr)'
@ -67,6 +67,7 @@ mtwifi_vif_sta_config() {
logger -t "netifd-mtwifi" "add $ifname to vifidx $name"
# setup apcli autoconnect
iwpriv "$ifname" set ApCliEnable=1
iwpriv "$ifname" set ApCliAutoConnect=3
wireless_add_vif "$name" "$ifname"