From 1c6e8b2a95227606ba99a66fb32bf40fe0e1225b Mon Sep 17 00:00:00 2001 From: Charlie Crane Date: Tue, 10 Sep 2024 11:39:04 +0100 Subject: [PATCH] #2775 - Removed default ARP rule for routers and added logic when handling ARP traffic --- .../simulator/network/hardware/nodes/network/router.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/primaite/simulator/network/hardware/nodes/network/router.py b/src/primaite/simulator/network/hardware/nodes/network/router.py index ceb91695..bfc90984 100644 --- a/src/primaite/simulator/network/hardware/nodes/network/router.py +++ b/src/primaite/simulator/network/hardware/nodes/network/router.py @@ -467,6 +467,14 @@ class AccessControlList(SimComponent): """Check if a packet with the given properties is permitted through the ACL.""" permitted = False rule: ACLRule = None + + # check if the frame is ARP and if ACL rules apply. + if frame.udp: + if frame.is_arp: + permitted = True + rule: ACLRule = None + return permitted, rule + for _rule in self._acl: if not _rule: continue @@ -1257,7 +1265,6 @@ class Router(NetworkNode): Initializes the router's ACL (Access Control List) with default rules, permitting essential protocols like ARP and ICMP, which are necessary for basic network operations and diagnostics. """ - self.acl.add_rule(action=ACLAction.PERMIT, src_port=Port.ARP, dst_port=Port.ARP, position=22) self.acl.add_rule(action=ACLAction.PERMIT, protocol=IPProtocol.ICMP, position=23) def setup_for_episode(self, episode: int):