Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 May 1999 03:00:03 -0700 (PDT)
From:      Stephen McKay <syssgm@detir.qld.gov.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/9308: [PATCH] Flood ping doesn't flood
Message-ID:  <199905061000.DAA55725@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/9308; it has been noted by GNATS.

From: Stephen McKay <syssgm@detir.qld.gov.au>
To: freebsd-gnats-submit@freebsd.org
Cc: syssgm@detir.qld.gov.au
Subject: Re: bin/9308: [PATCH] Flood ping doesn't flood
Date: Thu, 06 May 1999 19:58:13 +1000

 Back in January, I wrote:
 
 > Is your flood ping limp and flagging? ...
 
 My word but I've been slack!  I even got a version of my patch through
 the Bruce filter, and it's still not committed!
 
 Here's what I'm going to commit soon.  It minimally fixes the flood ping
 problem, and also restores -l behaviour to that described in the manual page.
 
 In a couple of days I'll commit it to -stable too, just before the freeze.
 
 Stephen.
 
 Index: ping.c
 ===================================================================
 RCS file: /cvs/src/sbin/ping/ping.c,v
 retrieving revision 1.43
 diff -u -r1.43 ping.c
 --- ping.c	1999/04/25 22:33:30	1.43
 +++ ping.c	1999/05/05 15:57:24
 @@ -274,11 +274,10 @@
  			if (*ep || ep == optarg || ultmp > INT_MAX)
  				errx(EX_USAGE, 
  				     "invalid preload value: `%s'", optarg);
 -			if (getuid()) {
 +			if (uid) {
  				errno = EPERM;
  				err(EX_NOPERM, "-l flag");
  			}
 -			options |= F_FLOOD;
  			preload = ultmp;
  			break;
  		case 'L':
 @@ -554,6 +553,8 @@
  		if (timeout.tv_sec < 0)
  			timeout.tv_sec = timeout.tv_usec = 0;
  		n = select(s + 1, &rfds, NULL, NULL, &timeout);
 +		if (n < 0)
 +			continue;	/* Must be EINTR. */
  		if (n == 1) {
  			struct timeval *t = 0;
  #ifdef SO_TIMESTAMP
 @@ -585,13 +586,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)
 


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?199905061000.DAA55725>