qubes/firewall: allow listing only IPv4/IPv6 rules
This will allow setting only IPv4-related rules to IPv4 address, and the same for IPv6 QubesOS/qubes-issues#1815
This commit is contained in:
parent
e01f7b97d9
commit
5123f466eb
@ -467,10 +467,16 @@ class Firewall(object):
|
|||||||
"qubes-reload-firewall@%s.timer" % self.vm.name])
|
"qubes-reload-firewall@%s.timer" % self.vm.name])
|
||||||
|
|
||||||
|
|
||||||
def qdb_entries(self):
|
def qdb_entries(self, addr_family=None):
|
||||||
entries = {
|
entries = {
|
||||||
'policy': str(self.policy)
|
'policy': str(self.policy)
|
||||||
}
|
}
|
||||||
|
exclude_dsttype = None
|
||||||
|
if addr_family is not None:
|
||||||
|
exclude_dsttype = 'dst4' if addr_family == 6 else 'dst6'
|
||||||
for ruleno, rule in zip(itertools.count(), self.rules):
|
for ruleno, rule in zip(itertools.count(), self.rules):
|
||||||
|
# exclude rules for another address family
|
||||||
|
if rule.dsthost and rule.dsthost.type == exclude_dsttype:
|
||||||
|
continue
|
||||||
entries['{:04}'.format(ruleno)] = rule.rule
|
entries['{:04}'.format(ruleno)] = rule.rule
|
||||||
return entries
|
return entries
|
||||||
|
Loading…
Reference in New Issue
Block a user