gluon-client-bridge, gluon-mesh-batman-adv-core: simplify VIF config functions
This commit is contained in:
parent
b2117fd31b
commit
849af9ade0
@ -21,9 +21,15 @@ local function configure_client(config, radio, index, suffix)
|
||||
|
||||
uci:delete('wireless', name)
|
||||
|
||||
macaddr = util.generate_mac(3*(index-1))
|
||||
if not config then
|
||||
return
|
||||
end
|
||||
|
||||
macaddr = util.generate_mac(3*(index-1))
|
||||
if not macaddr then
|
||||
return
|
||||
end
|
||||
|
||||
if config and macaddr then
|
||||
uci:section('wireless', 'wifi-iface', name,
|
||||
{
|
||||
device = radio,
|
||||
@ -36,7 +42,6 @@ local function configure_client(config, radio, index, suffix)
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
local function configure_radio(radio, index, config)
|
||||
local suffix = radio:match('^radio(%d+)$')
|
||||
|
@ -29,9 +29,15 @@ local function configure_ibss(config, radio, index, suffix, disabled)
|
||||
uci:delete('network', name .. '_vlan')
|
||||
uci:delete('wireless', name)
|
||||
|
||||
macaddr = util.generate_mac(3*(index-1)+2)
|
||||
if not config then
|
||||
return
|
||||
end
|
||||
|
||||
macaddr = util.generate_mac(3*(index-1)+2)
|
||||
if not macaddr then
|
||||
return
|
||||
end
|
||||
|
||||
if config and macaddr then
|
||||
if config.vlan then
|
||||
uci:section('network', 'interface', name,
|
||||
{
|
||||
@ -69,7 +75,6 @@ local function configure_ibss(config, radio, index, suffix, disabled)
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
local function configure_mesh(config, radio, index, suffix, disabled)
|
||||
local name = 'mesh_' .. radio
|
||||
@ -79,9 +84,15 @@ local function configure_mesh(config, radio, index, suffix, disabled)
|
||||
uci:delete('network', name)
|
||||
uci:delete('wireless', name)
|
||||
|
||||
macaddr = util.generate_mac(3*(index-1)+1)
|
||||
if not config then
|
||||
return
|
||||
end
|
||||
|
||||
macaddr = util.generate_mac(3*(index-1)+1)
|
||||
if not macaddr then
|
||||
return
|
||||
end
|
||||
|
||||
if config and macaddr then
|
||||
uci:section('network', 'interface', name,
|
||||
{
|
||||
proto = 'batadv',
|
||||
@ -105,7 +116,6 @@ local function configure_mesh(config, radio, index, suffix, disabled)
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
local function configure_radio(radio, index, config)
|
||||
local suffix = radio:match('^radio(%d+)$')
|
||||
|
Loading…
Reference in New Issue
Block a user