From b4db236f0e384c29381b7a2a6f7dcb07effb90c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20De=20Keersmaeker?= <francois.dekeersmaeker@uclouvain.be> Date: Sun, 27 Oct 2024 11:03:51 +0100 Subject: [PATCH] Removed unused code --- profile_translator_blocklist/Policy.py | 31 +------------------------- profile_translator_blocklist/protocols | 2 +- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/profile_translator_blocklist/Policy.py b/profile_translator_blocklist/Policy.py index c9b200b..7981449 100644 --- a/profile_translator_blocklist/Policy.py +++ b/profile_translator_blocklist/Policy.py @@ -98,42 +98,13 @@ class Policy: if device_addr is not None: self_addrs.append(device_addr) if protocol_name in protocols: - ip_proto = "ipv6" if protocol_name == "ipv6" else "ipv4" src = profile_protocol.get("spa", None) if protocol_name == "arp" else profile_protocol.get("src", None) dst = profile_protocol.get("tpa", None) if protocol_name == "arp" else profile_protocol.get("dst", None) # Check if device is involved if src in self_addrs or dst in self_addrs: self.is_device = True - - # Device is not involved - else: - # Try expliciting source address - try: - saddr = ipaddress.ip_network(protocol.explicit_address(src)) - except ValueError: - saddr = None - - # Try expliciting destination address - try: - daddr = ipaddress.ip_network(protocol.explicit_address(dst)) - except ValueError: - daddr = None - - # Check if the involved other host is in the local network - local_networks = ip.addrs[ip_proto]["local"] - if isinstance(local_networks, list): - lans = map(lambda cidr: ipaddress.ip_network(cidr), local_networks) - else: - lans = [ipaddress.ip_network(local_networks)] - if saddr is not None and any(lan.supernet_of(saddr) for lan in lans): - self.other_host["protocol"] = protocol_name - self.other_host["direction"] = "src" - self.other_host["address"] = saddr - elif daddr is not None and any(lan.supernet_of(daddr) for lan in lans): - self.other_host["protocol"] = protocol_name - self.other_host["direction"] = "dst" - self.other_host["address"] = daddr + # Add nft rules new_rules = protocol.parse(is_backward=self.is_backward, initiator=self.initiator) diff --git a/profile_translator_blocklist/protocols b/profile_translator_blocklist/protocols index 3873ed2..9f79c30 160000 --- a/profile_translator_blocklist/protocols +++ b/profile_translator_blocklist/protocols @@ -1 +1 @@ -Subproject commit 3873ed2c155788ab03512a35431f702beacd3749 +Subproject commit 9f79c30e33e8e2625c274c90482fddf259685b76 -- GitLab