Development
This commit is contained in:
parent
f04b2b36cc
commit
5a3a18d5b0
7 changed files with 123 additions and 33 deletions
|
|
@ -518,20 +518,23 @@ def build_vlan_dnsmasq_conf(vlan, data, iface):
|
|||
for group in ordered:
|
||||
if len(group) == 1:
|
||||
r = group[0]
|
||||
h = r.get('hostname', '')
|
||||
line(f"# {r['description']}")
|
||||
if is_dynamic_ip(r):
|
||||
line(f"dhcp-host=set:{name},{r['mac']},{r['hostname']},{d['lease_time']}")
|
||||
line(f"dhcp-host=set:{name},{r['mac']},{h},{d['lease_time']}" if h else
|
||||
f"dhcp-host=set:{name},{r['mac']},{d['lease_time']}")
|
||||
else:
|
||||
line(f"dhcp-host=set:{name},{r['mac']},{r['ip']},{r['hostname']},{d['lease_time']}")
|
||||
line(f"dhcp-host=set:{name},{r['mac']},{r['ip']},{h},{d['lease_time']}" if h else
|
||||
f"dhcp-host=set:{name},{r['mac']},{r['ip']},{d['lease_time']}")
|
||||
else:
|
||||
# Multiple MACs share the same IP -- combine into one dhcp-host line
|
||||
descs = ", ".join(r['description'] for r in group)
|
||||
macs = ",".join(r['mac'] for r in group)
|
||||
ip = group[0]['ip']
|
||||
# Use first entry's hostname; all share the same IP anyway
|
||||
hostname = group[0]['hostname']
|
||||
descs = ", ".join(r['description'] for r in group)
|
||||
macs = ",".join(r['mac'] for r in group)
|
||||
ip = group[0]['ip']
|
||||
hostname = group[0].get('hostname', '')
|
||||
line(f"# {descs}")
|
||||
line(f"dhcp-host=set:{name},{macs},{ip},{hostname},{d['lease_time']}")
|
||||
line(f"dhcp-host=set:{name},{macs},{ip},{hostname},{d['lease_time']}" if hostname else
|
||||
f"dhcp-host=set:{name},{macs},{ip},{d['lease_time']}")
|
||||
line()
|
||||
|
||||
if inactive_res:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue