Browse Source

gluon-mesh-batman-adv-core: make gateway selection class configurable

Fixes #401
Matthias Schiffer 8 years ago
parent
commit
b46d4fd537

+ 12 - 0
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 = {

+ 16 - 0
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.

+ 4 - 0
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

+ 6 - 0
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,
 	    }