Bug 254860 - ping flood output incorrectly shows dot for dropped packet
Summary: ping flood output incorrectly shows dot for dropped packet
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2021-04-07 18:43 UTC by jcaplan
Modified: 2022-01-18 19:47 UTC (History)
1 user (show)

See Also:

proposed patch (852 bytes, patch)
2021-04-07 18:43 UTC, jcaplan
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jcaplan 2021-04-07 18:43:04 UTC
Created attachment 223903 [details]
proposed patch


The output of the ping with '-f' option always contains one dot symbol indicating that one packet has been dropped even all ECHO_REPLY have been received successfully and there is 0.0% packet loss actually.

This is because the final '\b' written in pr_pack() is ignored when putchar('\n') gets called in finish().

Attached solution diff makes sure in pr_pack() that the DOT is overwritten with a space.

Steps to Reproduce
$ sudo ping -f -c1 localhost
PING6(56=40+8+8 bytes) ::1 --> ::1
--- localhost ping6 statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.460/0.460/0.460/0.000 ms

Actual Results
There is a dot in the middle line:
PING6(56=40+8+8 bytes) ::1 --> ::1
--- localhost ping6 statistics ---

Expected Results
No dot.

Build Date & Hardware
FreeBSD bsd-vbox 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r368820: Tue Jan  5 17:30:19 EST 2021     jcaplan@bsd-vbox:/usr/obj/usr/src-head/amd64.amd64/sys/GENERIC  amd64