Skip to content

Commit

Permalink
fix address family detection
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Nov 3, 2020
1 parent 1d4b4d7 commit ab00347
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions templates/peer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down

0 comments on commit ab00347

Please sign in to comment.