#2775 - Removed a print statement committed in error and updated the checks done in subject_to_acl following review

This commit is contained in:
Charlie Crane
2024-09-11 15:36:51 +01:00
parent f95501f2a8
commit 85863b1972
2 changed files with 3 additions and 6 deletions

View File

@@ -1371,7 +1371,7 @@ class Router(NetworkNode):
def subject_to_acl(self, frame: Frame) -> bool:
"""Check that frame is subject to ACL rules."""
if frame.ip.protocol == IPProtocol.UDP and frame.udp.dst_port == Port.ARP:
if frame.ip.protocol == IPProtocol.UDP and frame.is_arp:
return False
return True
@@ -1388,9 +1388,6 @@ class Router(NetworkNode):
if self.operating_state != NodeOperatingState.ON:
return
print("£££££££££££££££££££££££££££££")
print(f"Frame received is: {frame}")
if self.subject_to_acl(frame=frame):
# Check if it's permitted
permitted, rule = self.acl.is_permitted(frame)

View File

@@ -161,11 +161,11 @@ class Frame(BaseModel):
"""
Checks if the Frame is an ARP (Address Resolution Protocol) packet.
This is determined by checking if the destination port of the UDP header is equal to the ARP port.
This is determined by checking if the destination and source port of the UDP header is equal to the ARP port.
:return: True if the Frame is an ARP packet, otherwise False.
"""
return self.udp.dst_port == Port.ARP
return self.udp.dst_port == Port.ARP and self.udp.src_port == Port.ARP
@property
def is_icmp(self) -> bool: