gluon-client-bridge, gluon-mesh-batman-adv-core: simplify VIF config functions

This commit is contained in:
Matthias Schiffer 2016-07-20 15:44:36 +02:00
parent b2117fd31b
commit 849af9ade0
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
2 changed files with 88 additions and 73 deletions

View File

@ -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+)$')

View File

@ -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+)$')