From baaf4b6850ce8a97e39c20882e60f2ef468b4ec6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20De=20Keersmaeker?=
 <francois.dekeersmaeker@uclouvain.be>
Date: Wed, 10 Jul 2024 16:27:49 +0200
Subject: [PATCH] Updated IP translator for block-list firewall

---
 dns.py  | 2 +-
 ip.py   | 5 ++---
 ipv4.py | 1 -
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/dns.py b/dns.py
index a738240..0d6e001 100644
--- a/dns.py
+++ b/dns.py
@@ -17,7 +17,7 @@ class dns(Custom):
     @staticmethod
     def get_domain_name_rule(domain_name: str) -> dict:
         """
-        Retrieves the NFQueue rule to match a given domain name.
+        Retrieve the NFQueue rule to match a given domain name.
 
         :param domain_name: Domain name to match.
         :return: Dictionary containing the NFQueue rule to match the given domain name.
diff --git a/ip.py b/ip.py
index abdb51b..f6ce60e 100644
--- a/ip.py
+++ b/ip.py
@@ -145,11 +145,10 @@ class ip(Protocol):
         domain_name_rule_suffix = "_addr}})"
         ip_addr_rule_prefix = "compare_ip((ip_addr_t) {{.version = " + str(version) + ", .value." + self.protocol_name + " = "
         ip_addr_rule_suffix = "_addr(payload)}}, ip_str_to_net(\"{}\", " + str(version) + "))"
-        cached_ip_rule_suffix = "_addr}}, interactions_data[{}].cached_ip)"
         # Template rules for a domain name
         rules_domain_name = {
-            "forward": "( " + ip_addr_rule_prefix + addr_dir + cached_ip_rule_suffix + " || " + domain_name_rule_prefix + addr_dir + domain_name_rule_suffix + " )",
-            "backward": "( " + ip_addr_rule_prefix + other_dir + cached_ip_rule_suffix + " || " + domain_name_rule_prefix + other_dir + domain_name_rule_suffix + " )"
+            "forward": "( " + domain_name_rule_prefix + addr_dir + domain_name_rule_suffix + " )",
+            "backward": "( " + domain_name_rule_prefix + other_dir + domain_name_rule_suffix + " )"
         }
         # Template rules for an IP address
         rules_address = {
diff --git a/ipv4.py b/ipv4.py
index 391fd88..0777fd7 100644
--- a/ipv4.py
+++ b/ipv4.py
@@ -1,5 +1,4 @@
 from ip import ip
-from igmp import igmp
 
 class ipv4(ip):
 
-- 
GitLab