From 24d9dc1d82b81b6386c4635bd86a9683931964ec Mon Sep 17 00:00:00 2001 From: Nate Sales Date: Sun, 14 May 2023 21:58:37 -0700 Subject: [PATCH] fix: prefixes list only enabled with filter-irr --- pkg/embed/templates/peer.tmpl | 4 +--- tests/generate-simple.yml | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/embed/templates/peer.tmpl b/pkg/embed/templates/peer.tmpl index 6ea5e88b..da9a0873 100644 --- a/pkg/embed/templates/peer.tmpl +++ b/pkg/embed/templates/peer.tmpl @@ -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 }} @@ -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 = [ @@ -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 }} diff --git a/tests/generate-simple.yml b/tests/generate-simple.yml index b5f2c823..f043d733 100644 --- a/tests/generate-simple.yml +++ b/tests/generate-simple.yml @@ -16,3 +16,6 @@ peers: neighbors: - 203.0.113.12 - 2001:db8::12 + prefixes: + - 192.0.2.0/24 + - 2001:db8::/48 \ No newline at end of file