gluon-client-bridge, gluon-mesh-batman-adv-core: simplify VIF config functions
This commit is contained in:
parent
b2117fd31b
commit
849af9ade0
@ -21,21 +21,26 @@ local function configure_client(config, radio, index, suffix)
|
|||||||
|
|
||||||
uci:delete('wireless', name)
|
uci:delete('wireless', name)
|
||||||
|
|
||||||
macaddr = util.generate_mac(3*(index-1))
|
if not config then
|
||||||
|
return
|
||||||
if config and macaddr then
|
|
||||||
uci:section('wireless', 'wifi-iface', name,
|
|
||||||
{
|
|
||||||
device = radio,
|
|
||||||
network = 'client',
|
|
||||||
mode = 'ap',
|
|
||||||
ssid = config.ssid,
|
|
||||||
macaddr = macaddr,
|
|
||||||
ifname = suffix and 'client' .. suffix,
|
|
||||||
disabled = disabled,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
macaddr = util.generate_mac(3*(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,
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function configure_radio(radio, index, config)
|
local function configure_radio(radio, index, config)
|
||||||
|
@ -29,46 +29,51 @@ local function configure_ibss(config, radio, index, suffix, disabled)
|
|||||||
uci:delete('network', name .. '_vlan')
|
uci:delete('network', name .. '_vlan')
|
||||||
uci:delete('wireless', name)
|
uci:delete('wireless', name)
|
||||||
|
|
||||||
|
if not config then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
macaddr = util.generate_mac(3*(index-1)+2)
|
macaddr = util.generate_mac(3*(index-1)+2)
|
||||||
|
if not macaddr then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if config and macaddr then
|
if config.vlan then
|
||||||
if config.vlan then
|
uci:section('network', 'interface', name,
|
||||||
uci:section('network', 'interface', name,
|
|
||||||
{
|
|
||||||
proto = 'none',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
uci:section('network', 'interface', name .. '_vlan',
|
|
||||||
{
|
|
||||||
ifname = '@' .. name .. '.' .. config.vlan,
|
|
||||||
proto = 'batadv',
|
|
||||||
mesh = 'bat0',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
else
|
|
||||||
uci:section('network', 'interface', name,
|
|
||||||
{
|
|
||||||
proto = 'batadv',
|
|
||||||
mesh = 'bat0',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
uci:section('wireless', 'wifi-iface', name,
|
|
||||||
{
|
{
|
||||||
device = radio,
|
proto = 'none',
|
||||||
network = name,
|
}
|
||||||
mode = 'adhoc',
|
)
|
||||||
ssid = config.ssid,
|
|
||||||
bssid = config.bssid,
|
uci:section('network', 'interface', name .. '_vlan',
|
||||||
macaddr = macaddr,
|
{
|
||||||
mcast_rate = config.mcast_rate,
|
ifname = '@' .. name .. '.' .. config.vlan,
|
||||||
ifname = suffix and 'ibss' .. suffix,
|
proto = 'batadv',
|
||||||
disabled = disabled and 1 or 0,
|
mesh = 'bat0',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else
|
||||||
|
uci:section('network', 'interface', name,
|
||||||
|
{
|
||||||
|
proto = 'batadv',
|
||||||
|
mesh = 'bat0',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
uci:section('wireless', 'wifi-iface', name,
|
||||||
|
{
|
||||||
|
device = radio,
|
||||||
|
network = name,
|
||||||
|
mode = 'adhoc',
|
||||||
|
ssid = config.ssid,
|
||||||
|
bssid = config.bssid,
|
||||||
|
macaddr = macaddr,
|
||||||
|
mcast_rate = config.mcast_rate,
|
||||||
|
ifname = suffix and 'ibss' .. suffix,
|
||||||
|
disabled = disabled and 1 or 0,
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function configure_mesh(config, radio, index, suffix, disabled)
|
local function configure_mesh(config, radio, index, suffix, disabled)
|
||||||
@ -79,32 +84,37 @@ local function configure_mesh(config, radio, index, suffix, disabled)
|
|||||||
uci:delete('network', name)
|
uci:delete('network', name)
|
||||||
uci:delete('wireless', name)
|
uci:delete('wireless', name)
|
||||||
|
|
||||||
macaddr = util.generate_mac(3*(index-1)+1)
|
if not config then
|
||||||
|
return
|
||||||
if config and macaddr then
|
|
||||||
uci:section('network', 'interface', name,
|
|
||||||
{
|
|
||||||
proto = 'batadv',
|
|
||||||
mesh = 'bat0',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
uci:section('wireless', 'wifi-iface', name,
|
|
||||||
{
|
|
||||||
device = radio,
|
|
||||||
network = name,
|
|
||||||
mode = 'mesh',
|
|
||||||
mesh_id = config.id,
|
|
||||||
mesh_fwding = 0,
|
|
||||||
macaddr = macaddr,
|
|
||||||
mcast_rate = config.mcast_rate,
|
|
||||||
ifname = suffix and 'mesh' .. suffix,
|
|
||||||
disabled = disabled and 1 or 0,
|
|
||||||
macfilter = macfilter,
|
|
||||||
maclist = maclist,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
macaddr = util.generate_mac(3*(index-1)+1)
|
||||||
|
if not macaddr then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
uci:section('network', 'interface', name,
|
||||||
|
{
|
||||||
|
proto = 'batadv',
|
||||||
|
mesh = 'bat0',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
uci:section('wireless', 'wifi-iface', name,
|
||||||
|
{
|
||||||
|
device = radio,
|
||||||
|
network = name,
|
||||||
|
mode = 'mesh',
|
||||||
|
mesh_id = config.id,
|
||||||
|
mesh_fwding = 0,
|
||||||
|
macaddr = macaddr,
|
||||||
|
mcast_rate = config.mcast_rate,
|
||||||
|
ifname = suffix and 'mesh' .. suffix,
|
||||||
|
disabled = disabled and 1 or 0,
|
||||||
|
macfilter = macfilter,
|
||||||
|
maclist = maclist,
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function configure_radio(radio, index, config)
|
local function configure_radio(radio, index, config)
|
||||||
|
Loading…
Reference in New Issue
Block a user