#2775 - Removed default ARP rule for routers and added logic when handling ARP traffic
This commit is contained in:
@@ -467,6 +467,14 @@ class AccessControlList(SimComponent):
|
|||||||
"""Check if a packet with the given properties is permitted through the ACL."""
|
"""Check if a packet with the given properties is permitted through the ACL."""
|
||||||
permitted = False
|
permitted = False
|
||||||
rule: ACLRule = None
|
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:
|
for _rule in self._acl:
|
||||||
if not _rule:
|
if not _rule:
|
||||||
continue
|
continue
|
||||||
@@ -1257,7 +1265,6 @@ class Router(NetworkNode):
|
|||||||
Initializes the router's ACL (Access Control List) with default rules, permitting essential protocols like ARP
|
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.
|
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)
|
self.acl.add_rule(action=ACLAction.PERMIT, protocol=IPProtocol.ICMP, position=23)
|
||||||
|
|
||||||
def setup_for_episode(self, episode: int):
|
def setup_for_episode(self, episode: int):
|
||||||
|
|||||||
Reference in New Issue
Block a user