summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2006-01-07 16:22:37 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2006-01-07 16:22:37 +0000
commit1f927169d49b744cd3a27e2d26d322bde4ab33d8 (patch)
tree769b2b582bcbdb14d497da243443c93e92491a8e
parent4a6f7b79bc8fea7cce3b4742cd89f4a54e251d71 (diff)
Change duplicate interface check
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@49 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-xGenerate6
1 files changed, 2 insertions, 4 deletions
diff --git a/Generate b/Generate
index a5ee4d5..f4b917d 100755
--- a/Generate
+++ b/Generate
@@ -270,7 +270,7 @@ def makelistname(peer, inout)
end
-iface_dup_check = {}
+hostlist = $config['hosts'].values.sort{ |a,b| a['host_no'] <=> b['host_no'] }
$config['hosts'].each_pair{ |name, host|
throw "Host #{name} doesn't have any groups" unless host['groups']
host['groups'] = makelist(host['groups']).sort{|a,b| a<=>b}
@@ -283,7 +283,6 @@ $config['hosts'].each_pair{ |name, host|
host['vpn_address6'] = $config['prefix6']+':'+host['host_no'].to_s
host['asn'] = $config['baseasn']+host['host_no']
host['ifacename'] = "tun-n2-#{host['name']}"[0..14]
- iface_dup_check[host['ifacename']] = true
host['networks'] = {} unless host['networks']
host['networks'][host['vpn_address']+"/32"] = host['groups'].join(',')
host['pkcs12'] = true unless host.has_key?('pkcs12')
@@ -293,8 +292,8 @@ $config['hosts'].each_pair{ |name, host|
host['networks6'][host['vpn_address6']+"/128"] = host['groups'].join(',')
end
}
+throw "Duplicate iface names" unless hostlist.collect{ |host| host['ifacename'] }.uniq.size == $config['hosts'].size
-hostlist = $config['hosts'].values.sort{ |a,b| a['host_no'] <=> b['host_no'] }
hostlist.each{ |host|
host['peers'] = hostlist.find_all{ |peer|
host['name'] != peer['name'] and
@@ -322,7 +321,6 @@ hostlist.each{ |host|
}
}
}
-throw "Duplicate iface names" unless iface_dup_check.size == $config['hosts'].size
#####################################################################
# Create the zonefile