diff --git a/src/primaite/game/agent/actions.py b/src/primaite/game/agent/actions.py index 6b15c5f8..fa85dbf7 100644 --- a/src/primaite/game/agent/actions.py +++ b/src/primaite/game/agent/actions.py @@ -453,27 +453,33 @@ class NetworkACLAddRuleAction(AbstractAction): protocol = self.manager.get_internet_protocol_by_idx(protocol_id - 2) # subtract 2 to account for UNUSED=0 and ALL=1. - if source_ip_id in [0, 1]: + if source_ip_id == 0: + return ["do_nothing"] # invalid formulation + elif source_ip_id == 1: src_ip = "ALL" - return ["do_nothing"] # NOT SUPPORTED, JUST DO NOTHING IF WE COME ACROSS THIS else: src_ip = self.manager.get_ip_address_by_idx(source_ip_id - 2) # subtract 2 to account for UNUSED=0, and ALL=1 - if source_port_id == 1: + if source_port_id == 0: + return ["do_nothing"] # invalid formulation + elif source_port_id == 1: src_port = "ALL" else: src_port = self.manager.get_port_by_idx(source_port_id - 2) # subtract 2 to account for UNUSED=0, and ALL=1 - if dest_ip_id in (0, 1): + if source_ip_id == 0: + return ["do_nothing"] # invalid formulation + elif dest_ip_id == 1: dst_ip = "ALL" - return ["do_nothing"] # NOT SUPPORTED, JUST DO NOTHING IF WE COME ACROSS THIS else: dst_ip = self.manager.get_ip_address_by_idx(dest_ip_id - 2) # subtract 2 to account for UNUSED=0, and ALL=1 - if dest_port_id == 1: + if dest_port_id == 0: + return ["do_nothing"] # invalid formulation + elif dest_port_id == 1: dst_port = "ALL" else: dst_port = self.manager.get_port_by_idx(dest_port_id - 2) diff --git a/src/primaite/simulator/network/hardware/nodes/router.py b/src/primaite/simulator/network/hardware/nodes/router.py index 41c14967..a17d2ebf 100644 --- a/src/primaite/simulator/network/hardware/nodes/router.py +++ b/src/primaite/simulator/network/hardware/nodes/router.py @@ -162,9 +162,9 @@ class AccessControlList(SimComponent): func=lambda request, context: self.add_rule( ACLAction[request[0]], None if request[1] == "ALL" else IPProtocol[request[1]], - IPv4Address(request[2]), + None if request[2] == "ALL" else IPv4Address(request[2]), None if request[3] == "ALL" else Port[request[3]], - IPv4Address(request[4]), + None if request[4] == "ALL" else IPv4Address(request[4]), None if request[5] == "ALL" else Port[request[5]], int(request[6]), )