diff --git a/group_vars/all/general.yml b/group_vars/all/general.yml index 163c4c5d..1e6ad1e2 100644 --- a/group_vars/all/general.yml +++ b/group_vars/all/general.yml @@ -53,5 +53,6 @@ mesh_metric_default_in: 512 # Default mesh metric in inbound direction (rxcost) for tunnels mesh_metric_tunnel_in: 512 -# Default mesh metric in inbound direction (rxcost) for adhoc like interfaces -mesh_metric_adhoc_in: 2048 +# Default mesh metrics in inbound direction (rxcost) for adhoc like interfaces +mesh_metric_adhoc_11a_standard: 2024 +mesh_metric_adhoc_11g_standard: 2536 diff --git a/roles/cfg_openwrt/templates/corerouter/bird.conf.j2 b/roles/cfg_openwrt/templates/corerouter/bird.conf.j2 index 3bc0d4df..2345f259 100644 --- a/roles/cfg_openwrt/templates/corerouter/bird.conf.j2 +++ b/roles/cfg_openwrt/templates/corerouter/bird.conf.j2 @@ -40,8 +40,9 @@ protocol babel { }; # Mesh interfaces +{# metrics for 2 GHz adhoc get a penalty over 5 GHz adhoc so 5 GHz is preferred #} {% for nw in networks | selectattr('role', 'equalto', 'mesh') %} - {% set default_mesh_metric = mesh_metric_adhoc_in if 'mesh_ap' else mesh_metric_default_in %} + {% set default_mesh_metric = hostvars[inventory_hostname].get('mesh_metric_adhoc_' ~ nw.get('mesh_radio'), mesh_metric_default_in) %} interface "{{ libnetwork.getIfname(nw) }}" { type wireless; rxcost {{ nw.get('mesh_metric', default_mesh_metric) }};