Hello Paul, All,

Thanks for your clarification,
I appreciate your help on this please find my reponses in line

On 9 June 2018 at 09:40, Paul de Weerd <we...@weirdnet.nl> wrote:
> Hi Tom,
>
> This is documented in ping(8):
>
>      -s packetsize
>              Specify the number of data bytes to be sent.  The default
>              is 56, which translates into 64 ICMP data bytes when
>              combined with the 8 bytes of ICMP header data.  The
>              maximum packet size is 65467 for IPv4 and 65527 for IPv6.
>
> You can play around with the 56 bytes, but those 8 are non-negotiable:
> they're always added.

I get you ...  the ICMP data bytes can be adjusted but not the ICMP
header bytes,

Note that it says 56 *data* bytes versus 64
> (total) bytes.
the issue I was highlighting is that when the user specifies
a certain size in the command , the command says
sending 1000 bytes
but then says the reply 1008 bytes

I think this is confusing to the user of the system.
also I think the total bytes is incorrect because it only takes
account of the ICMP header and not the IP header,

Perhaps the Approach I should take to fix this (my confusion)
( and possibly future users confusion)
would be to make the displayed values consistent and the
displayed label consistent

>
> You seem to be misunderstanding the format string passed that you
> found.  %d is part of a format string, see printf(3).  The "%"
> indicates a conversion specification, the "d" indicates the type of
> conversion, in this case a signed integer.  The arguments following
> the format string are filled in where a conversion specification is
> given in the format string, in the order given.  So in this example:
>

>         #include <stdio.h>;
>
>         int main() {
>                 int number;
>                 const char* test;
>
>                 text = "Hi Tom!";
>                 number = 42;
>
>                 printf("string: %s\nnumber: %d\n", string, number)
>                 return 0;
>         }
>
> The printf(3) function gets called with three arguments.  The first is
> the format string: "string: %s\nnumber: %d\n".  As you can see,
> there's two conversion specifications in there, "%s" and "%d".  "%s"
> is for a "char*" argument, it gets replaced with the second argument
> to the function (the variable 'string', which we gave the value "Hi
> Tom!").  "%d" is for the integer argument, it gets replaced with a
> decimal representation of the value of the third argument to the
> function (the variable 'number', which we gave the value 42).
>
Thanks for your help on printf(3) :)  Ill work on this

> Applying this knowledge to the three lines you found in the ping
> source:
> In line 760, %d gets the value from variable 'datalen'.
> In lines 1248 and 1292, %d gets the value from variable 'cc'.
>
> Note that 'cc' could be changed between those two lines, so the value
> printed in the end doesn't *have* to be the same - that depends on the
> rest of the code.

I think we could  display (datalen+8)   bytes  in line 760

or
preferably display   (cc -8)  bytes in lines 1248 and 1292

and do a ping man page   update based on the agreed approach

thanks for your help and input
Tom Smyth

>
> Cheers,
>
> Paul
>
> --
>>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
> +++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
>                  http://www.weirdnet.nl/



-- 
Kindest regards,
Tom Smyth

Reply via email to