Browse Source

fastd: Use SDN to determine B.A.T.M.A.N. adv. iface penalty

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 2 years ago
parent
commit
4e1d44b0f0
2 changed files with 5 additions and 9 deletions
  1. 3 9
      fastd/fastd.conf
  2. 2 0
      fastd/init.sls

+ 3 - 9
fastd/fastd.conf

@@ -2,10 +2,6 @@
 # {{ site }} / {{ network }} FASTd configuration (Salt managed)
 #
 {%- set node_config = salt['pillar.get']('nodes:' ~ grains['id']) %}
-{%- set meshif = "meshif" %}
-{%- if grains.oscodename != "buster" %}
-  {%- set meshif = "-m" %}
-{%- endif %}
 
 log to syslog level info;
 
@@ -52,15 +48,13 @@ on up "
 	ip link set address {{ mac_address }} dev $INTERFACE
 	ip link set $INTERFACE up
 
-	batctl {{ meshif }} {{ bat_iface }} if add $INTERFACE
-{%- if grains.oscodename == "buster" %}
+	batctl meshif {{ bat_iface }} if add $INTERFACE
 	# Make VPN more expensive than intra DC/DCI/WBBL links
-	batctl hardif $INTERFACE hop_penalty 50
-{%- endif %}
+	batctl hardif $INTERFACE hop_penalty {{ iface_penalty }}
 ";
 
 on down "
-	batctl {{ meshif }} {{ bat_iface }} if del $INTERFACE
+	batctl meshif {{ bat_iface }} if del $INTERFACE
 ";
 
 {%- if network_type == 'nodes' %}

+ 2 - 0
fastd/init.sls

@@ -76,6 +76,7 @@ fastd:
     {% set network_type = 'nodes' if network.startswith ('nodes') else network %}
     {% set instance_name = site ~ '_' ~ network %}
     {% set mac_address = salt['ffho_net.gen_batman_iface_mac'](site_no, device_no, network) %}
+    {% set iface_penalty = salt['ffho_net.get_batman_iface_penalty'](network_type) %}
 
 /etc/fastd/{{ instance_name }}:
   file.directory:
@@ -94,6 +95,7 @@ fastd:
       site: {{ site }}
       site_no: {{ site_no }}
       mac_address: {{ mac_address }}
+      iface_penalty: {{ iface_penalty }}
     {% if 'batman_ext' in node_config.get('roles', []) %}
       bat_iface: bat-{{ site }}-ext
     {% else %}