On Fri, Jun 08, 2018 at 08:52:17PM +0100, 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 5.134.88.1 > PING 5.134.88.1 (5.134.88.1): 56 data bytes > 64 bytes from 5.134.88.1: 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) >
This analysis is correct. This discrepancy always bugged me but I suspect that people got so used to it that changing it is a bad idea. I certainly do the math automatically in my head. I'd like to improve this but I don't think it's possible, this stuff is just around for too long to change. > > 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 > -- I'm not entirely sure you are real.