diff options
author | Peter Palfrader <peter@palfrader.org> | 2006-01-07 15:04:14 +0000 |
---|---|---|
committer | weasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede> | 2006-01-07 15:04:14 +0000 |
commit | d3f98fdbad847e038f29eb9fd0cda2b554e98dec (patch) | |
tree | 6b4c88b0dd222b579c021deb2c18e926dab90925 | |
parent | d0d7370629bf48a00454ba89723b9ae8f3e15306 (diff) |
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
-rwxr-xr-x | Generate | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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']}" |