Skip to content

internet-apps: ping wrongly reports in-flight packets as lost

The V4Ping application reports a summary of the collected statistics when it stops.

In these statistics the in-flight packets (i.e., the ones that have been sent but did not receive a reply) are counted as lost, resulting in wrong reports.

This is due to the fact that V4Ping::StopApplication stops sending data, closes the receiving sockets (for echo replies) and prints the results - at the same time. This is a wrong approach, as it leads to the above mentioned issue. A better approach would be to dynamically calculate the RTT statistics (average, min, max), and then delay closing the sockets and reporting the data by a suitable amount of time.

Of course if the whole simulation stops before that moment the statistics will be inherently wrong. In this case the correct behaviour would be to - at least - warn the user that the stats are possibly wrong.

Another approach would be to count only the data from packets sent before the "suitable amount of time" calculated as before.

In both cases there if no replies are received at all (100% drop rate) we'll not have any data to estimate the RTT.

Note that Ping6 doesn't have this issue because it doesn't print any report.

A good patch would consider these points - and propose a sensible approach to tackle the issue.