Skip to content

Commit

Permalink
replace accept_local with statically-injected BGP communities
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Nov 8, 2020
1 parent 3202afd commit 42bdd5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
20 changes: 2 additions & 18 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;
route {{ $prefix }} reject { bgp_large_community.add(ASN,0,100) };
{{- end }}
}
{{- end }}
Expand All @@ -24,7 +24,7 @@ define LOCAL_v6 = [
protocol static static6 {
ipv6;
{{- range $i, $prefix := .OriginSet6 }}
route {{ $prefix }} reject;
route {{ $prefix }} reject { bgp_large_community.add(ASN,0,100) };
{{- end }}
}
{{- end }}
Expand Down Expand Up @@ -212,22 +212,6 @@ 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 }}
accept_local(); # Originated
if ((ASN,0,100) ~ bgp_large_community) then accept; # Originated
{{ end -}}

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

0 comments on commit 42bdd5a

Please sign in to comment.