HedongGao opened a new pull request, #17674:
URL: https://github.com/apache/nuttx/pull/17674
## Summary
According to section 3.2.2.6 of RFC1122, An ICMP Echo Request destined to
an IP broadcast or IP multicast address MAY be silently discarded.
## Impact
Check src ip for icmp request message, and drop the request message if src
ip is broadcast/multicast.
## Testing
Set up a SIM environment, ping the SIM from the host side, and verify that
normal ping can reply.
Then, write a Python script to construct a multicast/broadcast ICMP request
message with the source IP address, where SIM does not respond.
`
from scapy.all import Ether, IP, ICMP, sendp
SRC_MAC = "fa:b1:d9:6d:a0:d3"
DST_MAC = "42:e1:c4:3f:48:dd"
SRC_IP = "224.0.0.1"
DST_IP = "10.0.1.2"
INTERFACE = "eth0"
def send_custom_icmp():
try:
ether_layer = Ether(src=SRC_MAC, dst=DST_MAC)
ip_layer = IP(src=SRC_IP, dst=DST_IP, ttl=64)
icmp_layer = ICMP(type=8, code=0)
full_packet = ether_layer / ip_layer / icmp_layer
sendp(full_packet, iface=INTERFACE, verbose=True)
print("\nā
ICMP packet sent successfully!")
print(f"š Packet details:")
print(f" Source MAC: {SRC_MAC} | Destination MAC: {DST_MAC}")
print(f" Source IP: {SRC_IP} (Multicast) | Destination IP:
{DST_IP}")
except PermissionError:
print("ā Insufficient permissions! Run the script with
administrator/root privileges (e.g., sudo python3 xxx.py)")
except Exception as e:
print(f"ā Failed to send packet: {str(e)}")
print("š” Please check: 1. Correct network interface name 2. Valid
MAC/IP format 3. Normal network connection")
if __name__ == "__main__":
send_custom_icmp()
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]