private-ap: add network config
This commit is contained in:
parent
281ab49eae
commit
eda0f01fab
@ -43,10 +43,37 @@ if wireless.device_supports_mfp(uci) then
|
|||||||
end
|
end
|
||||||
mfp.default = uci:get('wireless', primary_iface, 'ieee80211w') or "0"
|
mfp.default = uci:get('wireless', primary_iface, 'ieee80211w') or "0"
|
||||||
|
|
||||||
|
local subnet4 = s:option(Value, "subnet4", translate("Subnet IPv4 (NAT)"), translate("IPv4 CIDR"))
|
||||||
|
subnet4:depends(enabled, true)
|
||||||
|
subnet4.datatype = "maxlength(32)"
|
||||||
|
subnet4.default = uci:get('network', 'ap', 'ipaddr') or '192.168.178.1/24'
|
||||||
|
|
||||||
|
local subnet6 = s:option(Value, "subnet6", translate("ULA IPv6"), translate("IPv6 CIDR or 'auto'"))
|
||||||
|
subnet6:depends(enabled, true)
|
||||||
|
subnet6.datatype = "maxlength(128)"
|
||||||
|
subnet6.default = uci:get('network', 'globals', 'ula_prefix')
|
||||||
|
|
||||||
-- TODO: ipv4 when prefix4() set? or always? allow custom cidr
|
-- TODO: ipv4 when prefix4() set? or always? allow custom cidr
|
||||||
-- TODO: allow mesh (regular meshing) on private net?
|
-- TODO: allow mesh (regular meshing) on private net?
|
||||||
|
|
||||||
function f:write()
|
function f:write()
|
||||||
|
uci:set('network', 'globals', 'ula_prefix', subnet6.data)
|
||||||
|
|
||||||
|
uci:section('network', 'interface', 'ap', {
|
||||||
|
type = 'bridge',
|
||||||
|
ifname = {},
|
||||||
|
proto = 'static',
|
||||||
|
ipaddr = subnet4.data,
|
||||||
|
ip6assign = '64',
|
||||||
|
})
|
||||||
|
|
||||||
|
uci:section('dhcp', 'dhcp', 'ap', {
|
||||||
|
interface = 'ap',
|
||||||
|
start = '100',
|
||||||
|
limit = '150',
|
||||||
|
leasetime = '12h',
|
||||||
|
})
|
||||||
|
|
||||||
wireless.foreach_radio(uci, function(radio, index)
|
wireless.foreach_radio(uci, function(radio, index)
|
||||||
local radio_name = radio['.name']
|
local radio_name = radio['.name']
|
||||||
local suffix = radio_name:match('^radio(%d+)$')
|
local suffix = radio_name:match('^radio(%d+)$')
|
||||||
@ -78,6 +105,7 @@ function f:write()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
uci:commit('network')
|
||||||
uci:commit('wireless')
|
uci:commit('wireless')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user