#2775 - Removed a print statement committed in error and updated the checks done in subject_to_acl following review
This commit is contained in:
@@ -1371,7 +1371,7 @@ class Router(NetworkNode):
|
|||||||
|
|
||||||
def subject_to_acl(self, frame: Frame) -> bool:
|
def subject_to_acl(self, frame: Frame) -> bool:
|
||||||
"""Check that frame is subject to ACL rules."""
|
"""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 False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -1388,9 +1388,6 @@ class Router(NetworkNode):
|
|||||||
if self.operating_state != NodeOperatingState.ON:
|
if self.operating_state != NodeOperatingState.ON:
|
||||||
return
|
return
|
||||||
|
|
||||||
print("£££££££££££££££££££££££££££££")
|
|
||||||
print(f"Frame received is: {frame}")
|
|
||||||
|
|
||||||
if self.subject_to_acl(frame=frame):
|
if self.subject_to_acl(frame=frame):
|
||||||
# Check if it's permitted
|
# Check if it's permitted
|
||||||
permitted, rule = self.acl.is_permitted(frame)
|
permitted, rule = self.acl.is_permitted(frame)
|
||||||
|
|||||||
@@ -161,11 +161,11 @@ class Frame(BaseModel):
|
|||||||
"""
|
"""
|
||||||
Checks if the Frame is an ARP (Address Resolution Protocol) packet.
|
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: 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
|
@property
|
||||||
def is_icmp(self) -> bool:
|
def is_icmp(self) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user