firewall: fix family / family_name
This commit is contained in:
parent
00fbb956b4
commit
39885a4329
@ -512,19 +512,22 @@ class NftablesWorker(FirewallWorker):
|
|||||||
self.chains[family].add(chain)
|
self.chains[family].add(chain)
|
||||||
|
|
||||||
def update_connected_ips(self, family):
|
def update_connected_ips(self, family):
|
||||||
|
family_name = ('ip6' if family == 6 else 'ip')
|
||||||
ips = self.get_connected_ips(family)
|
ips = self.get_connected_ips(family)
|
||||||
if ips:
|
if ips:
|
||||||
addr = '{' + ', '.join(ips) + '}'
|
addr = '{' + ', '.join(ips) + '}'
|
||||||
irule = 'iifname != "vif*" {family} saddr {addr} drop\n'.format(addr)
|
irule = 'iifname != "vif*" {family_name} saddr {addr} drop\n'.format(
|
||||||
orule = 'oifname != "vif*" {family} daddr {addr} drop\n'.format(addr)
|
family_name=family_name, addr=addr)
|
||||||
|
orule = 'oifname != "vif*" {family_name} daddr {addr} drop\n'.format(
|
||||||
|
family_name=family_name, addr=addr)
|
||||||
else:
|
else:
|
||||||
irule = ''
|
irule = ''
|
||||||
orule = ''
|
orule = ''
|
||||||
|
|
||||||
nft_input = (
|
nft_input = (
|
||||||
'flush chain {family} {table} prerouting\n'
|
'flush chain {family_name} {table} prerouting\n'
|
||||||
'flush chain {family} {table} postrouting\n'
|
'flush chain {family_name} {table} postrouting\n'
|
||||||
'table {family} {table} {{\n'
|
'table {family_name} {table} {{\n'
|
||||||
' chain prerouting {{\n'
|
' chain prerouting {{\n'
|
||||||
' {irule}'
|
' {irule}'
|
||||||
' }}\n'
|
' }}\n'
|
||||||
@ -533,7 +536,7 @@ class NftablesWorker(FirewallWorker):
|
|||||||
' }}\n'
|
' }}\n'
|
||||||
'}}\n'
|
'}}\n'
|
||||||
).format(
|
).format(
|
||||||
family=('ip6' if family == 6 else 'ip'),
|
family_name=family_name,
|
||||||
table='qubes-firewall',
|
table='qubes-firewall',
|
||||||
irule=irule,
|
irule=irule,
|
||||||
orule=orule,
|
orule=orule,
|
||||||
|
Loading…
Reference in New Issue
Block a user