Date: Mon, 4 Jan 1999 22:32:28 +1000 (EST) From: Stephen McKay <syssgm@dtir.qld.gov.au> To: FreeBSD-gnats-submit@FreeBSD.ORG Cc: syssgm@dtir.qld.gov.au Subject: bin/9308: [PATCH] Flood ping doesn't flood Message-ID: <199901041232.WAA00489@nymph.dtir.qld.gov.au>
next in thread | raw e-mail | index | archive | help
>Number: 9308 >Category: bin >Synopsis: [PATCH] Flood ping doesn't flood >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jan 4 04:40:00 PST 1999 >Closed-Date: >Last-Modified: >Originator: Stephen McKay >Release: FreeBSD 3.0-CURRENT i386 >Organization: Just me >Environment: 2.2.7, 2.2.8, 3.0, -current >Description: Is your flood ping limp and flagging? Do you remember a day long ago when your eyesight was keen and your bones didn't hurt and you got more than 50 pings per second from "ping -f"? Why, I remember the days of 1500 pings per second! You can have those glory days back with this tiny patch: >How-To-Repeat: # time ping -c1000 -f localhost PING localhost (127.0.0.1): 56 data bytes . --- localhost ping statistics --- 1000 packets transmitted, 1000 packets received, 0% packet loss round-trip min/avg/max/stddev = 0.052/0.059/1.299/0.044 ms ping -c1000 -f localhost 0.04s user 0.43s system 2% cpu 20.017 total ^^^^^^ (By the way, the code is trying for 100 pings per second but gets only 50. This is because timeouts are rounded up in select() and you CAN'T have a timeout of less than 2 clock ticks.) (Apply patch and then...) # time ./ping -c1000 -f localhost PING localhost (127.0.0.1): 56 data bytes . --- localhost ping statistics --- 1000 packets transmitted, 1000 packets received, 0% packet loss round-trip min/avg/max/stddev = 0.048/0.087/0.198/0.009 ms ./ping -c1000 -f localhost 0.02s user 0.41s system 82% cpu 0.524 total ^^^^^ >Fix: Index: ping.c =================================================================== RCS file: /cvs/src/sbin/ping/ping.c,v retrieving revision 1.41 diff -u -r1.41 ping.c --- ping.c 1998/08/26 18:51:37 1.41 +++ ping.c 1999/01/04 11:59:16 @@ -553,13 +553,14 @@ if (npackets && nreceived >= npackets) break; } - if (n == 0) { + if (n == 0 || options & F_FLOOD) { if (!npackets || ntransmitted < npackets) pinger(); else { if (almost_done) break; almost_done = 1; + intvl.tv_usec = 0; if (nreceived) { intvl.tv_sec = 2 * tmax / 1000; if (!intvl.tv_sec) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901041232.WAA00489>