modules/admin-full: fix wifi channel selection on multiple STA networks

Besides several AP networks, I have configured two STA networks on my
openwrt box - both on the same radio and thus on the same channel.
This was done via LuCI.

However after both STA networks were set up, I am unable to edit the
channel on neither network. When editing the one STA network, LuCI
tells me that the channel is locked by the other STA network. Same for
the other STA network.

Looks like a bug to me, so I made a patch.

Signed-off-by: Stephan Günther <steph.guenther@googlemail.com>
This commit is contained in:
Stephan Günther 2014-09-21 20:35:20 +02:00 committed by Jo-Philipp Wich
parent d2c1882786
commit da022f9157

View file

@ -147,21 +147,27 @@ local hwtype = wdev:get("type")
-- NanoFoo -- NanoFoo
local nsantenna = wdev:get("antenna") local nsantenna = wdev:get("antenna")
-- Check whether there is a client interface on the same radio, -- Check whether there are client interfaces on the same radio,
-- if yes, lock the channel choice as the station will dicatate the freq -- if yes, lock the channel choice as these stations will dicatate the freq
local has_sta = nil local found_sta = nil
local _, net local _, net
for _, net in ipairs(wdev:get_wifinets()) do if wnet:mode() ~= "sta" then
if net:mode() == "sta" and net:id() ~= wnet:id() then for _, net in ipairs(wdev:get_wifinets()) do
has_sta = net if net:mode() == "sta" then
break if not found_sta then
found_sta = {}
found_sta.channel = net:channel()
found_sta.names = {}
end
found_sta.names[#found_sta.names+1] = net:shortname()
end
end end
end end
if has_sta then if found_sta then
ch = s:taboption("general", DummyValue, "choice", translate("Channel")) ch = s:taboption("general", DummyValue, "choice", translate("Channel"))
ch.value = translatef("Locked to channel %d used by %s", ch.value = translatef("Locked to channel %d used by: %s",
has_sta:channel(), has_sta:shortname()) found_sta.channel, table.concat(found_sta.names, ", "))
else else
ch = s:taboption("general", Value, "channel", translate("Channel")) ch = s:taboption("general", Value, "channel", translate("Channel"))
ch:value("auto", translate("auto")) ch:value("auto", translate("auto"))