From ab00347b99559c6884c70f17090d172c89a2a0ae Mon Sep 17 00:00:00 2001 From: Nate Sales Date: Mon, 2 Nov 2020 16:34:24 -0800 Subject: [PATCH] fix address family detection --- templates/peer.tmpl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/templates/peer.tmpl b/templates/peer.tmpl index 03fe6afb..1cc0e629 100644 --- a/templates/peer.tmpl +++ b/templates/peer.tmpl @@ -14,12 +14,14 @@ define AS{{ .Peer.Asn }}_PFX_v6 = [ {{ end -}} -{{ $peer := .Peer }} -{{- $global := .Config }} -{{- $af := "4" }} -{{- range $i, $neighbor := .Peer.NeighborIps }} -{{- if Contains $neighbor ":" }} -{{ $af = "6" }} +{{ $peer := .Peer -}} +{{- $global := .Config -}} +{{- $af := "" -}} +{{- range $i, $neighbor := .Peer.NeighborIps -}} +{{- if Contains $neighbor ":" -}} +{{- $af = "6" }} +{{- else -}} +{{- $af = "4" }} {{- end -}} protocol bgp {{ $peer.Name }}v{{ $af }}_{{ $i }} { local as ASN; @@ -31,7 +33,7 @@ protocol bgp {{ $peer.Name }}v{{ $af }}_{{ $i }} { ipv{{ $af }} { {{ if $global.KeepFiltered -}} import keep filtered; - {{- end }} + {{ end -}} import limit AS{{ $peer.Asn }}_MAXPFX_v{{ $af }} action disable; {{ if eq $peer.Asn $global.Asn }}next hop self;{{ end }} import filter {