summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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