Browse Source

fastd: split port calculation and bind config

Karsten Böddeker 6 years ago
parent
commit
6ab385405a
1 changed files with 9 additions and 12 deletions
  1. 9 12
      fastd/fastd.conf

+ 9 - 12
fastd/fastd.conf

@@ -13,21 +13,18 @@ method "aes128-ctr+umac";
 {%- endif %}
 method "salsa2012+umac";
 
-
-{#- nodes{4,6} VPNs #}
+{#- Calculating FASTd port depending on network_type #}
+{%- set port = -1 %}
 {%- if network_type == 'nodes' %}
-  {%- set proto = network.split ('-')[-1] %}
   {%- set port = 10000 + site_no|int %}
-  {%- if network == 'nodes4' %}
-bind 0.0.0.0:{{ port }} interface "vrf_external";
-  {%- else %}
-bind [::]:{{ port }} interface "vrf_external";
-  {%- endif %}
- 
-{#- intergw VPN #}
-{%- else %}
-{%- set port = 11000 + site_no|int %}
+{%- elif network_type == 'intergw' %}
+  {%- set port = 11000 + site_no|int %}
+{%- endif %}
+
+{%- if network in ['nodes4', 'intergw'] %}
 bind 0.0.0.0:{{ port }} interface "vrf_external";
+{%- endif %}
+{%- if network in ['nodes6', 'intergw'] %}
 bind [::]:{{ port }} interface "vrf_external";
 {%- endif %}