HomeFreeBSD

ping: Avoid reporting NaNs

Description

ping: Avoid reporting NaNs

Avoid calculating the square root of negative zero, which can easily
happen on certain architectures when calculating the population standard
deviation with a sample size of one, e.g., 0.01 - (0.1 * 0.1) =
-0.000000.

Avoid returning a NaN by capping the minimum possible variance value to
zero (positive).

In the future, maybe skip reporting statistics at all for a single
sample.

Reported by: Jenkins
Reviewed by: asomers
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/863
Differential Revision: https://reviews.freebsd.org/D42114

(cherry picked from commit 4d348e83b738347f6aaf2b110459a01c5402d04e)

Details

Provenance
jlduranAuthored on Oct 6 2023, 5:55 PM
markjCommitted on Nov 13 2023, 3:20 PM
Reviewer
asomers
Differential Revision
D42114: ping: Avoid reporting NaNs
Parents
rG221a60a426d7: pf: expose more syncookie state information to userspace
Branches
Unknown
Tags
Unknown