Re: 2.0.36 pings

Nick Holloway (Nick.Holloway@alfie.demon.co.uk)
20 Nov 1998 08:26:29 -0000


shahin@labf.org (Mofeed Shahin) writes:
> Why is there a 90-95% packet loss when I flood ping localhost?

Because your ping is buggy. This has come up so many times, I decided
to develop a patch to ping which would handle this (and other points
of failure, such as attempting to flood ping a host while another is
flood pinging you -- which will also lead to spurious packet loss being
reported).

The patch was sent off to the maintainers, but I haven't looked to see if
it has been included (the patch is against the version of ping included
with Debian 2.0 -- netkit-base-0.10). If you want to look for yourself,
have a look at http://www.alfie.demon.co.uk/download/ping.diff.gz.

The reason why it occurs is that ping sends out a packet for every ICMP
packet is receives. However, on loopback, it sees the outgoing packet
as well as the incoming packet. This means that it soon falls behind.
The kernel only buffers a fixed amount (you will see the number of packets
received fall as the packet size increases), and after that any other
packets to ping are dropped.

What happens when the buffer is full, is that ping reads a packet,
which frees up space for the kernel to store the echo request, but
there is no room for the echo reply. So after the initial X packets,
all that ping sees is its own echo requests, and none of the echo replies.

If you look at /proc/net/snmp you will see the Ip: InDiscards figure
increase during a buggy flood ping.

awk '/^Ip:/ { print $1, $9 }' /proc/net/snmp

-- 
 `O O'  | Home: Nick.Holloway@alfie.demon.co.uk  http://www.alfie.demon.co.uk/
// ^ \\ | Work: Nick.Holloway@parallax.co.uk

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/