From c54c82c709d92a028aed9866e02aee4a96532638 Mon Sep 17 00:00:00 2001 From: Simeon Keske Date: Fri, 22 May 2020 23:02:12 +0200 Subject: [PATCH] add peer.bgp4o6 option, to support bgp multiprotocol without a v4 config-block in the peers conf --- templates/bird2/peer.conf.j2 | 4 ++-- templates/wg-quick.j2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/bird2/peer.conf.j2 b/templates/bird2/peer.conf.j2 index c75410e..dc8159d 100644 --- a/templates/bird2/peer.conf.j2 +++ b/templates/bird2/peer.conf.j2 @@ -1,10 +1,10 @@ -{% if peer.v4 is defined%} +{% if peer.v4 is defined and not peer.bgp4o6 | default('false') %} protocol bgp {{ peer.name }} from dnpeers { neighbor {{ peer.v4 }} as {{ peer.as }}; }; {% endif %} -{% if peer.v6 is defined%} +{% if peer.v6 is defined %} protocol bgp {{ peer.name }}_v6 from dnpeers { # if you use link-local ipv6 addresses for peering using the following neighbor {{ peer.v6 }}%{{ peer.if.name | default('dn42_' + peer.name) }} as {{ peer.as }}; diff --git a/templates/wg-quick.j2 b/templates/wg-quick.j2 index e9e5a0e..7dffa33 100644 --- a/templates/wg-quick.j2 +++ b/templates/wg-quick.j2 @@ -1,7 +1,7 @@ [Interface] PrivateKey = {{ peer.wg.privkey | default(dn42_wg_private_key) }} Address = {{ peer.if.v4 | default(dn42_local_v4) }}/32, {{ peer.if.v6 | default(dn42_local_v6) }}/128 -PostUp = {% if peer.v4 is defined %}/sbin/ip addr del dev {{ peer.if.name | default("dn42_" + peer.name) }} {{ peer.if.v4 | default(dn42_local_v4) }}/32 && /sbin/ip addr add dev {{ peer.if.name | default("dn42_" + peer.name) }} {{ peer.if.v4 | default(dn42_local_v4) }}/32 peer {{ peer.v4 }}/32 &&/ {% endif %}{% if peer.v6 is defined %}/sbin/ip addr del dev {{ peer.if.name | default("dn42_" + peer.name) }} {{ peer.if.v6 | default(dn42_local_v6) }}/128 && /sbin/ip addr add dev {{ peer.if.name | default("dn42_" + peer.name) }} {{ peer.if.v6 | default(dn42_local_v6) }}/128 peer {{ peer.v6 }}/128{% endif %} +PostUp = {% if peer.v4 is defined %}/sbin/ip addr del dev {{ peer.if.name | default("dn42_" + peer.name) }} {{ peer.if.v4 | default(dn42_local_v4) }}/32 && /sbin/ip addr add dev {{ peer.if.name | default("dn42_" + peer.name) }} {{ peer.if.v4 | default(dn42_local_v4) }}/32 peer {{ peer.v4 }}/32 && {% endif %}{% if peer.v6 is defined %}/sbin/ip addr del dev {{ peer.if.name | default("dn42_" + peer.name) }} {{ peer.if.v6 | default(dn42_local_v6) }}/128 && /sbin/ip addr add dev {{ peer.if.name | default("dn42_" + peer.name) }} {{ peer.if.v6 | default(dn42_local_v6) }}/128 peer {{ peer.v6 }}/128{% endif %} Table = off ListenPort = {{ peer.wg.port }}