This commit is contained in:
Konstantin Bogdanov 2024-08-28 15:20:56 +02:00
parent 5ee5c8224e
commit 9be79614a3
No known key found for this signature in database

View File

@ -164,11 +164,13 @@ class PartitionManager:
@staticmethod @staticmethod
def _is_ipv6_rule(rule): def _is_ipv6_rule(rule):
if "source" in rule: if rule.get("source"):
return ipaddress.ip_address(rule["source"]).version == 6 return ipaddress.ip_address(rule["source"]).version == 6
if "destination" in rule: if rule.get("destination"):
return ipaddress.ip_address(rule["destination"]).version == 6 return ipaddress.ip_address(rule["destination"]).version == 6
return False
def _add_rule(self, rule): def _add_rule(self, rule):
if self._is_ipv6_rule(rule): if self._is_ipv6_rule(rule):
_NetworkManager.get().add_ip6tables_rule(**rule) _NetworkManager.get().add_ip6tables_rule(**rule)