gluon-client-bridge: fix 320-gluon-client-bridge-wireless coding style
This commit is contained in:
parent
51a3e8e072
commit
2b9dd54f00
@ -7,48 +7,46 @@ local uci = require('simple-uci').cursor()
|
||||
|
||||
|
||||
local function is_disabled(config, name)
|
||||
local disabled
|
||||
if uci:get('wireless', name) then
|
||||
disabled = uci:get_bool('wireless', name, 'disabled')
|
||||
else
|
||||
disabled = config and config.disabled
|
||||
end
|
||||
local disabled
|
||||
if uci:get('wireless', name) then
|
||||
disabled = uci:get_bool('wireless', name, 'disabled')
|
||||
else
|
||||
disabled = config and config.disabled
|
||||
end
|
||||
|
||||
return disabled
|
||||
return disabled
|
||||
end
|
||||
|
||||
local function configure_client(config, radio, index, suffix)
|
||||
local name = 'client_' .. radio
|
||||
local disabled = is_disabled(config, name)
|
||||
local name = 'client_' .. radio
|
||||
local disabled = is_disabled(config, name)
|
||||
|
||||
uci:delete('wireless', name)
|
||||
uci:delete('wireless', name)
|
||||
|
||||
if not config then
|
||||
return
|
||||
end
|
||||
if not config then
|
||||
return
|
||||
end
|
||||
|
||||
local macaddr = util.get_wlan_mac(uci, radio, index, 1)
|
||||
if not macaddr then
|
||||
return
|
||||
end
|
||||
local macaddr = util.get_wlan_mac(uci, radio, index, 1)
|
||||
if not macaddr then
|
||||
return
|
||||
end
|
||||
|
||||
uci:section('wireless', 'wifi-iface', name,
|
||||
{
|
||||
device = radio,
|
||||
network = 'client',
|
||||
mode = 'ap',
|
||||
ssid = config.ssid,
|
||||
macaddr = macaddr,
|
||||
ifname = suffix and 'client' .. suffix,
|
||||
disabled = disabled or false,
|
||||
}
|
||||
)
|
||||
uci:section('wireless', 'wifi-iface', name, {
|
||||
device = radio,
|
||||
network = 'client',
|
||||
mode = 'ap',
|
||||
ssid = config.ssid,
|
||||
macaddr = macaddr,
|
||||
ifname = suffix and 'client' .. suffix,
|
||||
disabled = disabled or false,
|
||||
})
|
||||
end
|
||||
|
||||
local function configure_radio(radio, index, config)
|
||||
local suffix = radio:match('^radio(%d+)$')
|
||||
local suffix = radio:match('^radio(%d+)$')
|
||||
|
||||
configure_client(config.ap, radio, index, suffix)
|
||||
configure_client(config.ap, radio, index, suffix)
|
||||
end
|
||||
|
||||
util.iterate_radios(uci, configure_radio)
|
||||
|
Loading…
Reference in New Issue
Block a user