fix infini-ARP bug when pinging broadcast/network address

This commit is contained in:
Marek Wolan
2024-06-14 14:48:28 +00:00
parent 923d2629ca
commit c90c059411

View File

@@ -138,6 +138,16 @@ class ARP(Service):
target_ip_address
)
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:
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)}")
return
self.sys_log.info(f"Sending ARP request from NIC {outbound_network_interface} for ip {target_ip_address}")
arp_packet = ARPPacket(
sender_ip_address=outbound_network_interface.ip_address,