On 9/06/2018, at 7:52 AM, Tom Smyth wrote:

> Hello I see a small discrepancy between the measurement
> of sent and received packets as displayed by ping command
> on the wire the sent and received packets are the same size
> I had a brief go
> foo# ping
> PING ( 56 data bytes
> 64 bytes from icmp_seq=0 ttl=53 time=91.719 ms
> it would appear that one measurement is the ICMP Payload only
> and the other is the ICMP payload + ICMP header  (8 byte difference)

Note that these values do not necessarily differ by 8 as one 
may receive something other than an ECHOREPLY in return e.g.

$ ping -s 40 -v
PING ( 40 data bytes
36 bytes from Destination Host Unreachable

To my mind the two measurements are distinct, distinguished, 
and useful in a diagnostic tool.

As an aside, I have long hankered for ping(1) to advise me on how 
to hit or exceed MTU but it is unable (and ought to be unable) 
to do so, as that would involve multiple layer violations. 
For the same reason, it is unable to indicate total bytes sent. 
See the second paragraph of icmp(4) for starters.


> foo# grep -n " data bytes" /root/ping.c
> 760:    printf("%s): %d data bytes\n", pr_addr(dst, dst->sa_len), datalen);
> foo# grep -n " bytes from" /root/ping.c
> 1248:                   printf("%d bytes from %s: icmp_seq=%u", cc,
> 1292:           printf("%d bytes from %s: ", cc, pr_addr(from, fromlen));
> looking at the source code it looks like the size = %d but %d is presenting
> different values
> I didnt see where %d was being changed between line 760 and line 1248
> It has been a while since I looked at C programming in anger and im a bit
> rusty...
> any pointers on where i should be looking so that I can submit a patch
> -- 
> Kindest regards,
> Tom Smyth

Reply via email to