Commit 3ed3b917 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Move IPv6 hosts out of dhcpd6 subnet

parent 81cb8c96
......@@ -257,31 +257,29 @@ def emit_hosts(tree, options, networks):
return filter(lambda n: a in n, networks)
static = {}
never = {}
for interface in tree._host_._interface_:
ethernet = interface.ethernet[0:]
for ip in tree._host_._interface_._ip_:
# Find all hosts that associated with this network
ethernet = ip.ethernet[0:]
if not ethernet:
continue
if ethernet.lower() != ethernet:
raise util.HostinfoException('%s not lower-case' % ethernet)
for ip in interface._ip_:
# Find all hosts that associated with this network
if ip.never[0]:
if match(util.address(ip.never[0])):
if not ethernet in never:
never[ethernet] = []
pass
never[ethernet].append(ip)
if ip.never[0]:
if match(util.address(ip.never[0])):
if not ethernet in never:
never[ethernet] = []
pass
continue
if match(util.address(ip)):
if not ethernet in static:
static[ethernet] = []
pass
static[ethernet].append(ip)
continue
pass
never[ethernet].append(ip)
pass
continue
if match(util.address(ip)):
if not ethernet in static:
static[ethernet] = []
pass
static[ethernet].append(ip)
continue
pass
def by_name(ether_ip_dict):
result = {}
for e in ether_ip_dict:
......
......@@ -46,8 +46,11 @@ def generate(tree, options):
for i in interface:
result += emit_interface(tree, options, i)
pass
served_networks = map(lambda d: util.network(get_subnet(tree, d._parent)),
dhcp)
result += emit_hosts(tree, options, served_networks)
return str(result)
def emit_interface(tree, options, interface):
result = util.StringArray()
subnet = dict(map(lambda d: (get_subnet(tree, d._parent), d),
......@@ -79,7 +82,6 @@ def emit_network(tree, options, subnet, dhcp):
result += " range6 %s %s;" % (first, last)
pass
result += emit_subnet_info(subnet).indent()
result += emit_hosts(tree, options, net).indent()
result += '}'
return result
......@@ -98,12 +100,12 @@ def emit_subnet_info(subnet):
result += ''
return result
def emit_hosts(tree, options, net):
def emit_hosts(tree, options, networks):
result = util.StringArray()
def match(a):
return filter(lambda n: a in n, networks)
static = {}
never = {}
def match(a):
return filter(lambda n: a in n, [net])
for ip in tree._host_._interface_._ipv6_:
# Find all hosts that associated with this network
ethernet = ip.ethernet[0:]
......@@ -126,6 +128,7 @@ def emit_hosts(tree, options, net):
static[ethernet].append(ip)
continue
pass
def by_name(ether_ip_dict):
result = {}
for e in ether_ip_dict:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment