Skip to content

Commit

Permalink
revert to accept_local method
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Nov 8, 2020
1 parent 9c98d09 commit 8185dca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions templates/global.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define LOCAL_v4 = [
protocol static static4 {
ipv4;
{{- range $i, $prefix := .OriginSet4 }}
route {{ $prefix }} reject { bgp_large_community.add((ASN,0,100)); };
route {{ $prefix }} reject;
{{- end }}
}
{{- end }}
Expand All @@ -24,7 +24,7 @@ define LOCAL_v6 = [
protocol static static6 {
ipv6;
{{- range $i, $prefix := .OriginSet6 }}
route {{ $prefix }} reject { bgp_large_community.add((ASN,0,100)); };
route {{ $prefix }} reject;
{{- end }}
}
{{- end }}
Expand Down Expand Up @@ -212,6 +212,22 @@ function strip_communities() {
bgp_large_community.delete([(ASN, *, *)]);
}

function accept_local() {
{{ if .OriginSet4 -}}
if (net ~ LOCAL_v4 ) then {
bgp_large_community.add((ASN,0,100)); # Originated
accept;
}
{{- end }}

{{ if .OriginSet6 -}}
if (net ~ LOCAL_v6 ) then {
bgp_large_community.add((ASN,0,100)); # Originated
accept;
}
{{- end }}
}

function process_prepends() {
if ((ASN,0,401) ~ bgp_community) then {
print "Adding single prepend for ", net;
Expand Down
2 changes: 1 addition & 1 deletion templates/peer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protocol bgp {{ $peer.Name }}v{{ $af }}_{{ $i }} {
{{ $peer.PreExport -}}

{{- if or $global.OriginSet4 $global.OriginSet6 }}
if ((ASN,0,100) ~ bgp_large_community) then accept; # Originated
accept_local(); # Originated
{{ end -}}

{{ if eq $peer.Type "upstream" -}}
Expand Down

0 comments on commit 8185dca

Please sign in to comment.