bundle/dhcpd: improvements #19

Merged
sophie merged 6 commits from kunsi-dhcpd-improvements into main 2020-11-15 12:34:41 +00:00
Showing only changes of commit ad569f073e - Show all commits

View file

@ -23,6 +23,7 @@ def get_static_allocations(metadata):
}
}
@metadata_reactor
def get_listen_interfaces(metadata):
listen_interfaces = []
@ -34,3 +35,19 @@ def get_listen_interfaces(metadata):
'listen_interfaces': ' '.join(sorted(listen_interfaces)),
}
}
@metadata_reactor
def iptables(metadata):
iptables = set()
for identfier, subnet in node.metadata.get('dhcpd/subnets', {}).items():
iptables.add('iptables -A INPUT -i {} -p udp --dport 67:68 -j ACCEPT'.format(subnet.get('interface')))
return {
'iptables': {
'bundle_rules': {
# iptables bundle relies on this being a list.
'dhcpd': sorted(list(iptables)),
},
}
}