From d3f98fdbad847e038f29eb9fd0cda2b554e98dec Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 7 Jan 2006 15:04:14 +0000 Subject: Do not create the same as-path ACL over and over again git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@42 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- Generate | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Generate b/Generate index 9de41fa..a17b9a1 100755 --- a/Generate +++ b/Generate @@ -426,6 +426,13 @@ hostlist.each{ |host| host['networks6'].each_key{ |net| outmaps << "ipv6 prefix-list pl#{ net.tr(':./', '-_') } seq 10 permit #{net} #{net =~ /\/128/ ? '' : "le 128"}" } + hostlist.each{ |otherhost| + next if host['name'] == otherhost['name'] + next unless otherhost['bgp_preference'] + inmaps << "!" + inmaps << "! Create an ACL for anything that passes through AS#{otherhost['asn']} (#{otherhost['name']})" + inmaps << "ip as-path access-list passthruAS#{otherhost['asn']} permit _#{otherhost['asn']}_" + } mapdups = {} host['peer_map_name'] = {} peers.each{ |peer| @@ -468,7 +475,6 @@ hostlist.each{ |host| next unless otherhost['bgp_preference'] inmaps << "!" inmaps << "! Anything that passes through AS#{otherhost['asn']} (#{otherhost['name']}) gets a lower preference" - inmaps << "ip as-path access-list passthruAS#{otherhost['asn']} permit _#{otherhost['asn']}_" inmaps << "route-map IN#{mapname} permit #{seq}"; seq = seq + 1 inmaps << " match as-path passthruAS#{otherhost['asn']}" inmaps << " set local-preference #{otherhost['bgp_preference']}" -- cgit v1.2.3