Skip to content
Snippets Groups Projects
Unverified Commit 0d6f9571 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-core: introduce new gluon_wired netifd proto for wired meshing

The new proto will simplify the switch to VXLAN encapsulation.
parent 8bcd0975
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
proto_gluon_wired_init_config() {
proto_config_add_boolean transitive
}
proto_gluon_wired_setup() {
local config="$1"
local ifname="$2"
local transitive
json_get_vars transitive
proto_init_update "$ifname" 1
proto_send_update "$config"
json_init
json_add_string name "${config}_mesh"
json_add_string ifname "@${config}"
json_add_string proto 'gluon_mesh'
json_add_boolean fixed_mtu 1
[ -n "$transitive" ] && json_add_boolean transitive "$transitive"
json_close_object
ubus call network add_dynamic "$(json_dump)"
}
proto_gluon_wired_teardown() {
export config="$1"
proto_init_update "*" 0
proto_send_update "$config"
}
add_protocol gluon_wired
......@@ -3,14 +3,24 @@
local site = require 'gluon.site_config'
local uci = require('simple-uci').cursor()
if not uci:get('network', 'mesh_wan') then
uci:section('network', 'interface', 'mesh_wan', {
ifname = 'br-wan',
proto = 'gluon_mesh',
transitive = true,
fixed_mtu = true,
auto = site.mesh_on_wan or false,
})
local old_proto = uci:get('network', 'mesh_wan', 'proto')
uci:section('network', 'interface', 'mesh_wan', {
ifname = 'br-wan',
proto = 'gluon_wired',
index = 0,
})
if uci:get('network', 'mesh_wan', 'auto') == nil then
uci:set('network', 'mesh_wan', 'auto', site.mesh_on_wan or false)
end
if uci:get('network', 'mesh_wan', 'transitive') == nil then
uci:set('network', 'mesh_wan', 'transitive', true)
end
if uci:get('network', 'mesh_wan', 'legacy') == nil then
uci:set('network', 'mesh_wan', 'legacy', old_proto == 'gluon_mesh')
end
uci:delete('network', 'mesh_wan', 'fixed_mtu')
uci:save('network')
......@@ -10,13 +10,15 @@ if not sysconfig.lan_ifname then
os.exit(0)
end
local old_proto = uci:get('network', 'mesh_lan', 'proto')
uci:section('network', 'interface', 'mesh_lan', {
ifname = sysconfig.lan_ifname,
type = 'bridge',
igmp_snooping = false,
proto = 'gluon_mesh',
transitive = true,
fixed_mtu = true,
proto = 'gluon_wired',
index = 4,
legacy = old_proto == 'gluon_mesh',
})
if uci:get('network', 'mesh_lan', 'auto') == nil then
......@@ -38,4 +40,13 @@ if uci:get('network', 'mesh_lan', 'auto') == nil then
uci:set('network', 'mesh_lan', 'auto', enable or false)
end
if uci:get('network', 'mesh_lan', 'transitive') == nil then
uci:set('network', 'mesh_lan', 'transitive', true)
end
if uci:get('network', 'mesh_lan', 'legacy') == nil then
uci:set('network', 'mesh_lan', 'legacy', old_proto == 'gluon_mesh')
end
uci:delete('network', 'mesh_lan', 'fixed_mtu')
uci:save('network')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment