modify nodes and bundles for new nftables syntax
This commit is contained in:
parent
ecb67d012b
commit
d569b00960
30 changed files with 172 additions and 126 deletions
|
@ -37,18 +37,20 @@ def get_static_allocations(metadata):
|
|||
|
||||
|
||||
@metadata_reactor.provides(
|
||||
'iptables/bundle_rules/dhcpd',
|
||||
'nftables/rules/input/dhcpd',
|
||||
)
|
||||
def iptables(metadata):
|
||||
def nftables(metadata):
|
||||
rules = set()
|
||||
for subnet in node.metadata.get('dhcpd/subnets', {}):
|
||||
rules.add('iptables -A INPUT -i {} -p udp --dport 67:68 -j ACCEPT'.format(subnet))
|
||||
for iface in node.metadata.get('dhcpd/subnets', {}):
|
||||
rules.add(f'udp dport {{ 67, 68 }} iif {iface} accept')
|
||||
|
||||
return {
|
||||
'iptables': {
|
||||
'bundle_rules': {
|
||||
# can't use port_rules here, because we're generating interface based rules.
|
||||
'dhcpd': sorted(list(rules)),
|
||||
'nftables': {
|
||||
'rules': {
|
||||
'input': {
|
||||
# can't use port_rules here, because we're generating interface based rules.
|
||||
'dhcpd': sorted(rules),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue