Bug 222240

Summary: multiple ICMP echo requests reported when ping broadcast
Product: Base System Reporter: Hannes Mehnert <hannes>
Component: kernAssignee: George V. Neville-Neil <gnn>
Status: New ---    
Severity: Affects Many People CC: ae, gnn, pstef
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Hannes Mehnert 2017-09-11 20:56:38 UTC
When I send a broadcast ping, and run tcpdump on the same host, I see multiple ICMP echo requests in tcpdump (with slightly different timestamps).  Running a tcpdump on a different host in the same broadcast domain only sees one ICMP echo request!.

# ping 192.168.0.255
PING 192.168.0.255 (192.168.0.255): 56 data bytes
...

# tcpdump -lni wlan0 icmp
21:45:41.833915 IP 192.168.0.6 > 192.168.0.255: ICMP echo request, id 22192, seq 0, length 64
21:45:41.833927 IP 192.168.0.6 > 192.168.0.255: ICMP echo request, id 22192, seq 0, length 64
21:45:42.896747 IP 192.168.0.6 > 192.168.0.255: ICMP echo request, id 22192, seq 1, length 64
21:45:42.896758 IP 192.168.0.6 > 192.168.0.255: ICMP echo request, id 22192, seq 1, length 64


I reported this earlier on transport@ (https://lists.freebsd.org/pipermail/freebsd-transport/2016-September/000145.html) and it was cross-posted to net@ (https://lists.freebsd.org/pipermail/freebsd-net/2016-September/046105.html)

gnn@ reported he can reproduce this on 11 as well.

I just checked, and it this behaviour is still present in CURRENT (r322062)
Comment 1 Andrey V. Elsukov freebsd_committer freebsd_triage 2017-09-12 14:58:33 UTC
You see two copies of the broadcast packet, because wlan0 has IFF_SIMPLEX flag and ether_output() does if_simloop() for broadcast packets for those interfaces.
Interfaces with IFF_SIMPLEX flag can not receive their own broadcast packets, and  the kernel emulates this behavior. So you can "receive" you own broadcast on the link. You can use tcpdump with -Q in|out flag to check, that one packet is outbound, and other is inbound.
Comment 2 Piotr Pawel Stefaniak freebsd_committer freebsd_triage 2021-08-20 17:42:44 UTC
George, do you think this doesn't work as intended?