gluon-core: adapt to new bridge handling
This commit is contained in:
parent
50e1013eb7
commit
8e630e9f6d
@ -73,4 +73,11 @@ end
|
|||||||
uci:delete('network', 'lan')
|
uci:delete('network', 'lan')
|
||||||
uci:delete('network', 'wan')
|
uci:delete('network', 'wan')
|
||||||
|
|
||||||
|
uci:foreach('network', 'device', function(dev)
|
||||||
|
if dev['type'] ~= 'bridge' then return end
|
||||||
|
if dev['ifname'] ~= 'lan' or dev['ifname'] ~= 'wan' then return end
|
||||||
|
|
||||||
|
uci:delete('network', dev['.name'])
|
||||||
|
end)
|
||||||
|
|
||||||
uci:save('network')
|
uci:save('network')
|
||||||
|
@ -1,12 +1,22 @@
|
|||||||
#!/usr/bin/lua
|
#!/usr/bin/lua
|
||||||
|
|
||||||
local uci = require('simple-uci').cursor()
|
local uci = require('simple-uci').cursor()
|
||||||
|
local util = require 'gluon.util'
|
||||||
local sysconfig = require 'gluon.sysconfig'
|
local sysconfig = require 'gluon.sysconfig'
|
||||||
|
|
||||||
|
local interfaces = {}
|
||||||
|
for wanif in sysconfig.wan_ifname:gmatch('%S+') do
|
||||||
|
util.add_to_set(interfaces, wanif)
|
||||||
|
end
|
||||||
|
|
||||||
|
uci:section('network', 'device', 'br_wan', {
|
||||||
|
ifname = 'br-wan',
|
||||||
|
type = 'bridge',
|
||||||
|
ports = interfaces,
|
||||||
|
})
|
||||||
|
|
||||||
uci:section('network', 'interface', 'wan', {
|
uci:section('network', 'interface', 'wan', {
|
||||||
ifname = sysconfig.wan_ifname,
|
ifname = 'br-wan',
|
||||||
type = 'bridge',
|
|
||||||
igmp_snooping = true,
|
igmp_snooping = true,
|
||||||
multicast_querier = false,
|
multicast_querier = false,
|
||||||
peerdns = false,
|
peerdns = false,
|
||||||
|
@ -11,28 +11,30 @@ if not sysconfig.lan_ifname then
|
|||||||
end
|
end
|
||||||
|
|
||||||
uci:section('network', 'interface', 'mesh_lan', {
|
uci:section('network', 'interface', 'mesh_lan', {
|
||||||
ifname = sysconfig.lan_ifname,
|
ifname = 'br-mesh_lan',
|
||||||
igmp_snooping = false,
|
igmp_snooping = false,
|
||||||
proto = 'gluon_wired',
|
proto = 'gluon_wired',
|
||||||
index = 4,
|
index = 4,
|
||||||
vxlan = site.mesh.vxlan(true),
|
vxlan = site.mesh.vxlan(true),
|
||||||
})
|
})
|
||||||
|
|
||||||
if sysconfig.lan_ifname:match(' ') then
|
uci:delete('network', 'mesh_lan', 'type')
|
||||||
uci:set('network', 'mesh_lan', 'type', 'bridge')
|
|
||||||
else
|
uci:section('network', 'device', 'br_mesh_lan', {
|
||||||
uci:delete('network', 'mesh_lan', 'type')
|
name = 'br-mesh_lan',
|
||||||
end
|
type = 'bridge',
|
||||||
|
})
|
||||||
|
|
||||||
local enable = site.mesh_on_lan(false)
|
local enable = site.mesh_on_lan(false)
|
||||||
local old_auto = uci:get('network', 'mesh_lan', 'auto')
|
local old_auto = uci:get('network', 'mesh_lan', 'auto')
|
||||||
local old_disabled = uci:get('network', 'mesh_lan', 'disabled')
|
local old_disabled = uci:get('network', 'mesh_lan', 'disabled')
|
||||||
if old_auto ~= nil or old_disabled ~= nil then
|
local new_disabled = uci:get('network', 'br_mesh_lan', 'disabled')
|
||||||
enable = old_auto ~= '0' and old_disabled ~= '1'
|
if old_auto ~= nil or old_disabled ~= nil or new_disabled ~= nil then
|
||||||
|
enable = old_auto ~= '0' and old_disabled ~= '1' and new_disabled ~= '1'
|
||||||
end
|
end
|
||||||
|
|
||||||
if enable then
|
if enable then
|
||||||
local interfaces = uci:get_list('network', 'client', 'ifname')
|
local interfaces = uci:get_list('network', 'br_client', 'ports')
|
||||||
|
|
||||||
if interfaces then
|
if interfaces then
|
||||||
for lanif in sysconfig.lan_ifname:gmatch('%S+') do
|
for lanif in sysconfig.lan_ifname:gmatch('%S+') do
|
||||||
@ -44,12 +46,20 @@ if enable then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
uci:set('network', 'mesh_lan', 'disabled', not enable)
|
uci:set('network', 'br_mesh_lan', 'disabled', not enable)
|
||||||
|
if enable then
|
||||||
|
local interfaces = {}
|
||||||
|
for lanif in sysconfig.lan_ifname:gmatch('%S+') do
|
||||||
|
util.add_to_set(interfaces, lanif)
|
||||||
|
end
|
||||||
|
uci:set('network', 'br_mesh_lan', 'ports', interfaces)
|
||||||
|
end
|
||||||
|
|
||||||
if uci:get('network', 'mesh_lan', 'transitive') == nil then
|
if uci:get('network', 'mesh_lan', 'transitive') == nil then
|
||||||
uci:set('network', 'mesh_lan', 'transitive', true)
|
uci:set('network', 'mesh_lan', 'transitive', true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
uci:delete('network', 'mesh_lan', 'disabled')
|
||||||
uci:delete('network', 'mesh_lan', 'auto')
|
uci:delete('network', 'mesh_lan', 'auto')
|
||||||
uci:delete('network', 'mesh_lan', 'fixed_mtu')
|
uci:delete('network', 'mesh_lan', 'fixed_mtu')
|
||||||
uci:delete('network', 'mesh_lan', 'legacy')
|
uci:delete('network', 'mesh_lan', 'legacy')
|
||||||
|
Loading…
Reference in New Issue
Block a user