From 1f927169d49b744cd3a27e2d26d322bde4ab33d8 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 7 Jan 2006 16:22:37 +0000 Subject: Change duplicate interface check git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@49 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- Generate | 6 ++---- 1 file 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 -- cgit v1.2.3