gluon-core: set VXLAN/legacy mode in site config
In multidomain setups, VXLAN is enabled by default, but can be disabled in domain configs using the mesh/vxlan option. In single domain setups, the mesh/vxlan option is mandatory. The UCI option for legacy mode is removed. Fixes #1364
This commit is contained in:
		
							parent
							
								
									5d92f125cd
								
							
						
					
					
						commit
						1f7ed28b76
					
				@ -79,6 +79,10 @@
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  mesh = {
 | 
			
		||||
    vxlan = true,
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  -- The next node feature allows clients to always reach the node it is
 | 
			
		||||
  -- connected to using a known IP address.
 | 
			
		||||
  next_node = {
 | 
			
		||||
 | 
			
		||||
@ -182,9 +182,16 @@ next_node \: package
 | 
			
		||||
    in isolated mesh segments). This is possible by providing one or more names
 | 
			
		||||
    in the ``name`` field.
 | 
			
		||||
 | 
			
		||||
mesh \: optional
 | 
			
		||||
mesh
 | 
			
		||||
    Configuration of general mesh functionality.
 | 
			
		||||
 | 
			
		||||
    To avoid inter-mesh links, Gluon can encapsulate the mesh protocol in VXLAN
 | 
			
		||||
    for Mesh-on-LAN/WAN. It is recommended to set *mesh.vxlan* to ``true`` to
 | 
			
		||||
    enable VXLAN in new setups. Setting it to ``false`` disables this
 | 
			
		||||
    encapsulation to allow meshing with other nodes that don't support VXLAN
 | 
			
		||||
    (Gluon 2017.1.x and older). In multi-domain setups, *mesh.vxlan* is optional
 | 
			
		||||
    and defaults to ``true``.
 | 
			
		||||
 | 
			
		||||
    Gluon generally segments layer-2 meshes so that each node becomes IGMP/MLD
 | 
			
		||||
    querier for its own local clients. This is necessary for reliable multicast
 | 
			
		||||
    snooping. The segmentation is realized by preventing IGMP/MLD queries from
 | 
			
		||||
@ -197,7 +204,7 @@ mesh \: optional
 | 
			
		||||
    the mesh; this is usually not a problem, as such setups are unusual. If
 | 
			
		||||
    you run a special-purpose mesh that requires membership reports to be
 | 
			
		||||
    working, this filtering can be disabled by setting the
 | 
			
		||||
    *filter_membership_reports* option to ``false``.
 | 
			
		||||
    optional *filter_membership_reports* value to ``false``.
 | 
			
		||||
 | 
			
		||||
    In addition, options specific to the batman-adv routing protocol can be set
 | 
			
		||||
    in the *batman_adv* section:
 | 
			
		||||
@ -208,6 +215,7 @@ mesh \: optional
 | 
			
		||||
    ::
 | 
			
		||||
 | 
			
		||||
      mesh = {
 | 
			
		||||
        vxlan = true,
 | 
			
		||||
        filter_membership_reports = false,
 | 
			
		||||
        batman_adv = {
 | 
			
		||||
          gw_sel_class = 1,
 | 
			
		||||
 | 
			
		||||
@ -73,6 +73,8 @@ need_string_array(in_domain({'next_node', 'name'}), false)
 | 
			
		||||
need_string_match(in_domain({'next_node', 'ip6'}), '^[%x:]+$', false)
 | 
			
		||||
need_string_match(in_domain({'next_node', 'ip4'}), '^%d+.%d+.%d+.%d+$', false)
 | 
			
		||||
 | 
			
		||||
need_boolean(in_domain({'mesh', 'vxlan'}), false)
 | 
			
		||||
 | 
			
		||||
need_boolean(in_site({'mesh_on_wan'}), false)
 | 
			
		||||
need_boolean(in_site({'mesh_on_lan'}), false)
 | 
			
		||||
need_boolean(in_site({'single_as_lan'}), false)
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,6 @@ init_proto "$@"
 | 
			
		||||
proto_gluon_wired_init_config() {
 | 
			
		||||
        proto_config_add_boolean transitive
 | 
			
		||||
        proto_config_add_int index
 | 
			
		||||
        proto_config_add_boolean legacy
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
xor2() {
 | 
			
		||||
@ -28,13 +27,15 @@ proto_gluon_wired_setup() {
 | 
			
		||||
 | 
			
		||||
        local meshif="$config"
 | 
			
		||||
 | 
			
		||||
        local transitive index legacy
 | 
			
		||||
        json_get_vars transitive index legacy
 | 
			
		||||
        local vxlan="$(lua -e 'print(require("gluon.site").mesh.vxlan(true))')"
 | 
			
		||||
 | 
			
		||||
        local transitive index
 | 
			
		||||
        json_get_vars transitive index
 | 
			
		||||
 | 
			
		||||
        proto_init_update "$ifname" 1
 | 
			
		||||
        proto_send_update "$config"
 | 
			
		||||
 | 
			
		||||
        if [ "${legacy:-0}" -eq 0 ]; then
 | 
			
		||||
        if [ "$vxlan" = 'true' ]; then
 | 
			
		||||
                meshif="vx_$config"
 | 
			
		||||
 | 
			
		||||
                json_init
 | 
			
		||||
 | 
			
		||||
@ -22,11 +22,9 @@ uci:set('network', 'mesh_wan', 'disabled', not enable)
 | 
			
		||||
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', 'auto')
 | 
			
		||||
uci:delete('network', 'mesh_wan', 'fixed_mtu')
 | 
			
		||||
uci:delete('network', 'mesh_wan', 'legacy')
 | 
			
		||||
 | 
			
		||||
uci:save('network')
 | 
			
		||||
 | 
			
		||||
@ -50,11 +50,9 @@ uci:set('network', 'mesh_lan', 'disabled', not enable)
 | 
			
		||||
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', 'auto')
 | 
			
		||||
uci:delete('network', 'mesh_lan', 'fixed_mtu')
 | 
			
		||||
uci:delete('network', 'mesh_lan', 'legacy')
 | 
			
		||||
 | 
			
		||||
uci:save('network')
 | 
			
		||||
 | 
			
		||||
@ -1,2 +1,5 @@
 | 
			
		||||
-- mesh/vxlan is required in single domain setups (this_domain() is nil)
 | 
			
		||||
need_boolean(in_domain({'mesh', 'vxlan'}), not this_domain())
 | 
			
		||||
 | 
			
		||||
need_number({'mesh', 'batman_adv', 'gw_sel_class'}, false)
 | 
			
		||||
need_one_of({'mesh', 'batman_adv', 'routing_algo'}, {'BATMAN_IV', 'BATMAN_V'}, false)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user