gluon-core: migrate custom batadv interfaces to gluon_mesh proto
Users may have defined additional mesh interfaces. Properly migrate these to avoid subtly breaking the network config (and make them ready for new mesh protocols).
This commit is contained in:
parent
50d982cad7
commit
0b3af14bf8
24
package/gluon-core/luasrc/lib/gluon/upgrade/800-migrate-batadv
Executable file
24
package/gluon-core/luasrc/lib/gluon/upgrade/800-migrate-batadv
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/lua
|
||||||
|
|
||||||
|
local uci = require('luci.model.uci').cursor()
|
||||||
|
|
||||||
|
local function migrate_iface(iface)
|
||||||
|
if iface.proto ~= 'batadv' or iface.mesh ~= 'bat0' then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local s = iface['.name']
|
||||||
|
|
||||||
|
uci:set('network', s, 'proto', 'gluon_mesh')
|
||||||
|
uci:set('network', s, 'fixed_mtu', '1')
|
||||||
|
|
||||||
|
if iface.mesh_no_rebroadcast then
|
||||||
|
uci:set('network', s, 'transitive', iface.mesh_no_rebroadcast)
|
||||||
|
end
|
||||||
|
|
||||||
|
uci:delete('network', s, 'mesh')
|
||||||
|
uci:delete('network', s, 'mesh_no_rebroadcast')
|
||||||
|
end
|
||||||
|
|
||||||
|
uci:foreach('network', 'interface', migrate_iface)
|
||||||
|
uci:save('network')
|
Loading…
Reference in New Issue
Block a user