2014-05-06 20:14:00 +00:00
|
|
|
#!/usr/bin/lua
|
|
|
|
|
2017-08-11 18:47:35 +00:00
|
|
|
local site = require 'gluon.site'
|
2017-01-19 11:51:04 +00:00
|
|
|
local uci = require('simple-uci').cursor()
|
2014-05-06 20:14:00 +00:00
|
|
|
|
2017-06-21 15:14:41 +00:00
|
|
|
uci:section('network', 'interface', 'mesh_wan', {
|
|
|
|
ifname = 'br-wan',
|
|
|
|
proto = 'gluon_wired',
|
|
|
|
index = 0,
|
2021-03-18 22:12:55 +00:00
|
|
|
vxlan = site.mesh.vxlan(true),
|
2017-06-21 15:14:41 +00:00
|
|
|
})
|
|
|
|
|
2018-01-10 00:00:28 +00:00
|
|
|
local enable = site.mesh_on_wan(false)
|
|
|
|
local old_auto = uci:get('network', 'mesh_wan', 'auto')
|
|
|
|
local old_disabled = uci:get('network', 'mesh_wan', 'disabled')
|
|
|
|
if old_auto ~= nil or old_disabled ~= nil then
|
|
|
|
enable = old_auto ~= '0' and old_disabled ~= '1'
|
2017-06-21 15:14:41 +00:00
|
|
|
end
|
2018-01-10 00:00:28 +00:00
|
|
|
uci:set('network', 'mesh_wan', 'disabled', not enable)
|
|
|
|
|
2017-06-21 15:14:41 +00:00
|
|
|
if uci:get('network', 'mesh_wan', 'transitive') == nil then
|
|
|
|
uci:set('network', 'mesh_wan', 'transitive', true)
|
2014-05-06 20:14:00 +00:00
|
|
|
end
|
2017-06-21 15:14:41 +00:00
|
|
|
|
2016-05-01 12:12:23 +00:00
|
|
|
uci:save('network')
|