Skip to content

Commit

Permalink
fix: prefixes list only enabled with filter-irr
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed May 15, 2023
1 parent 10d0dd1 commit 24d9dc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/embed/templates/peer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ define AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_IMPORT_v6 = {{ $peer.ImportLim
{{ if IntDeref $peer.ExportLimit4 }}define AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_EXPORT_v4 = {{ $peer.ExportLimit4 }};{{ end }}
{{ if IntDeref $peer.ExportLimit6 }}define AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_EXPORT_v6 = {{ $peer.ExportLimit6 }};{{ end }}

{{ if BoolDeref $peer.FilterIRR }}
{{ if not (Empty $peer.PrefixSet4) }}
define AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_PFX_v4 = [
{{ BirdSet $peer.PrefixSet4 }}
Expand All @@ -26,7 +25,6 @@ define AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_PFX_v6 = [
{{ else }}
define AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_PFX_v6 = -empty-;
{{ end }}
{{ end }}

{{ if BoolDeref $peer.FilterASSet }}
define AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_AS_SET_MEMBERS = [
Expand Down Expand Up @@ -98,7 +96,7 @@ protocol bgp {{ UniqueProtocolName $peer.ProtocolName $peerName $af $peer.ASN }}
{{ if BoolDeref $peer.EnforceFirstAS }}enforce_first_as({{ $peer.ASN }});{{ end }}
{{ if BoolDeref $peer.EnforcePeerNexthop }}enforce_peer_nexthop({{ $neighborNoIface }});{{ end }}
{{ if BoolDeref $peer.FilterTransitASNs }}reject_transit_paths();{{ end }}
{{ if BoolDeref $peer.FilterIRR }}if !(net ~ AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_PFX_v{{ $af }}) then { _reject("not in IRR prefix set"); }{{ end }}
{{ if or (not (Empty $peer.PrefixSet4)) (not (Empty $peer.PrefixSet6)) }}if !(net ~ AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_PFX_v{{ $af }}) then { _reject("not in prefix set"); }{{ end }}
{{ if BoolDeref $peer.FilterASSet }}if !(bgp_path.first ~ AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_AS_SET_MEMBERS) then { _reject("not in AS set"); }{{ end }}
{{ if BoolDeref $peer.FilterBlocklist }}reject_blocklist();{{ end }}

Expand Down
3 changes: 3 additions & 0 deletions tests/generate-simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ peers:
neighbors:
- 203.0.113.12
- 2001:db8::12
prefixes:
- 192.0.2.0/24
- 2001:db8::/48

0 comments on commit 24d9dc1

Please sign in to comment.