#2661 Improve style on ARP check code to be more concise

This commit is contained in:
Marek Wolan
2024-06-18 10:09:06 +01:00
parent c90c059411
commit 7375bb383a

View File

@@ -139,13 +139,11 @@ class ARP(Service):
)
if outbound_network_interface:
# ensure we are not attempting to find the network address or broadcast address (not useable IPs)
intf_network_address = outbound_network_interface.ip_network.network_address
intf_broadcast_address = outbound_network_interface.ip_network.broadcast_address
if target_ip_address == intf_network_address:
if target_ip_address == outbound_network_interface.ip_network.network_address:
self.sys_log.info(f"Cannot send ARP request to a network address {str(target_ip_address)}")
return
if target_ip_address == intf_broadcast_address:
self.sys_log.info(f"Cannot send ARP request to a broadcast addresss {str(target_ip_address)}")
if target_ip_address == outbound_network_interface.ip_network.broadcast_address:
self.sys_log.info(f"Cannot send ARP request to a broadcast address {str(target_ip_address)}")
return
self.sys_log.info(f"Sending ARP request from NIC {outbound_network_interface} for ip {target_ip_address}")