#2775 - Removed default ARP rule for routers and added logic when handling ARP traffic

This commit is contained in:
Charlie Crane
2024-09-10 11:39:04 +01:00
parent 08f742b3ec
commit 1c6e8b2a95

View File

@@ -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):