diff --git a/docs/site-example/site.conf b/docs/site-example/site.conf index 9545b1be..f40f839d 100644 --- a/docs/site-example/site.conf +++ b/docs/site-example/site.conf @@ -82,6 +82,18 @@ mac = 'xe:xx:xx:xx:xx:xx', }, + -- Options specific to routing protocols (optional) + -- mesh = { + -- Options specific to the batman-adv routing protocol (optional) + -- batman_adv = { + -- Gateway selection class (optional) + -- The default class 20 is based on the link quality (TQ) only, + -- class 1 is calculated from both the TQ and the announced bandwidth + -- gw_sel_class = 1, + -- }, + -- }, + + next_node = { -- Refer to http://fastd.readthedocs.org/en/latest/ to better understand -- what these options do. fastd_mesh_vpn = { diff --git a/docs/user/site.rst b/docs/user/site.rst index 60024bf0..cb1528b1 100644 --- a/docs/user/site.rst +++ b/docs/user/site.rst @@ -117,6 +117,22 @@ next_node : package mac = 'ca:ff:ee:ba:be:00' } +mesh : optional + Options specific to routing protocols. + + At the moment, only the ``batman_adv`` routing protocol has such options: + + The optional value ``gw_sel_class`` sets the gateway selection class. The default + class 20 is based on the link quality (TQ) only, class 1 is calculated from + both the TQ and the announced bandwidth. + :: + + mesh = { + batman_adv = { + gw_sel_class = 1, + }, + } + fastd_mesh_vpn Remote server setup for the fastd-based mesh VPN. diff --git a/package/gluon-mesh-batman-adv-core/check_site.lua b/package/gluon-mesh-batman-adv-core/check_site.lua index 2c5badc2..49fff159 100644 --- a/package/gluon-mesh-batman-adv-core/check_site.lua +++ b/package/gluon-mesh-batman-adv-core/check_site.lua @@ -21,3 +21,7 @@ end need_boolean('mesh_on_wan', false) need_boolean('mesh_on_lan', false) + +if need_table('mesh', nil, false) and need_table('mesh.batman_adv', nil, false) then + need_number('mesh.batman_adv.gw_sel_class', false) +end diff --git a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh index b35aa010..fe576e33 100755 --- a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh +++ b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh @@ -6,11 +6,17 @@ local site = require 'gluon.site_config' local uci = require('luci.model.uci').cursor() +local gw_sel_class +if site.mesh and site.mesh.batman_adv then + gw_sel_class = site.mesh.batman_adv.gw_sel_class +end + uci:delete('batman-adv', 'bat0') uci:section('batman-adv', 'mesh', 'bat0', { orig_interval = 5000, gw_mode = 'client', + gw_sel_class = gw_sel_class, hop_penalty = 15, multicast_mode = 0, }