Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 May 1999 07:13:04 -0400 (EDT)
From:      marc@destek.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/11818: Enhancement, ping(8)
Message-ID:  <199905211113.HAA23277@ns.destek.net>

next in thread | raw e-mail | index | archive | help

>Number:         11818
>Category:       bin
>Synopsis:       Added a feature to ping(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 21 04:20:00 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Marc Evans
>Release:        FreeBSD 2.2.8-STABLE i386
>Organization:
The Destek Group, Inc.
>Environment:

	Any platform that uses FreeBSD derived ping(8) sources.

>Description:

	I have added a feature to ping(8) which is effectively the inverse
	of the -a option. I use the -A flag on the command line. Both the
	man page and the source code have been updated in the attached patch.

>How-To-Repeat:

	Patch the sources using the attached patch. Compile, install and then
	run "ping -A {addr/name}".

>Fix:
	
*** ping.c	Thu May 20 17:15:47 1999
--- ping.c.old	Thu Feb 25 10:50:37 1999
***************
*** 124,130 ****
  #define	F_MTTL		0x0800
  #define	F_MIF		0x1000
  #define	F_AUDIBLE	0x2000
- #define	F_MISSED	0x4000
  
  /*
   * MAX_DUP_CHK is the number of bits in received table, i.e. the maximum
--- 124,129 ----
***************
*** 140,146 ****
  int s;				/* socket file descriptor */
  u_char outpack[MAXPACKET];
  char BSPACE = '\b';		/* characters written for flood */
- char BBELL = '\a';		/* characters written for MISSED and AUDIBLE */
  char DOT = '.';
  char *hostname;
  int ident;			/* process id to identify our packets */
--- 139,144 ----
***************
*** 219,229 ****
  	preload = 0;
  
  	datap = &outpack[8 + PHDR_LEN];
! 	while ((ch = getopt(argc, argv, "AI:LQRT:c:adfi:l:np:qrs:v")) != -1) {
  		switch(ch) {
- 		case 'A':
- 			options |= F_MISSED;
- 			break;
  		case 'a':
  			options |= F_AUDIBLE;
  			break;
--- 217,224 ----
  	preload = 0;
  
  	datap = &outpack[8 + PHDR_LEN];
! 	while ((ch = getopt(argc, argv, "I:LQRT:c:adfi:l:np:qrs:v")) != -1) {
  		switch(ch) {
  		case 'a':
  			options |= F_AUDIBLE;
  			break;
***************
*** 558,566 ****
  					intvl.tv_sec = MAXWAIT;
  			}
  			(void)gettimeofday(&last, NULL);
- 
- 			if (ntransmitted != nreceived+1 && options & F_MISSED)
- 				(void)write(STDOUT_FILENO, &BBELL, 1);
  		}
  	}
  	finish();
--- 553,558 ----
***************
*** 721,727 ****
  			if (dupflag)
  				(void)printf(" (DUP!)");
  			if (options & F_AUDIBLE)
! 				(void)write(STDOUT_FILENO, &BBELL, 1);
  			/* check the data */
  			cp = (u_char*)&icp->icmp_data[PHDR_LEN];
  			dp = &outpack[8 + PHDR_LEN];
--- 713,719 ----
  			if (dupflag)
  				(void)printf(" (DUP!)");
  			if (options & F_AUDIBLE)
! 				(void)printf("\a");
  			/* check the data */
  			cp = (u_char*)&icp->icmp_data[PHDR_LEN];
  			dp = &outpack[8 + PHDR_LEN];
*** ping.8	Thu May 20 17:20:20 1999
--- ping.8.old	Thu May 20 17:17:17 1999
***************
*** 42,48 ****
  packets to network hosts
  .Sh SYNOPSIS
  .Nm ping
! .Op Fl AQRadfnqrv
  .Op Fl c Ar count
  .Op Fl i Ar wait
  .Op Fl l Ar preload
--- 42,48 ----
  packets to network hosts
  .Sh SYNOPSIS
  .Nm ping
! .Op Fl QRadfnqrv
  .Op Fl c Ar count
  .Op Fl i Ar wait
  .Op Fl l Ar preload
***************
*** 75,87 ****
  .Dq pad
  bytes used to fill out the packet.  The options are as follows:
  .Bl -tag -width indent
- .It Fl A
- Audible missed packet. Include a bell
- .Pq ASCII 0x07
- character in the output when any packet is not received before the next packet
- is transmitted.
  .It Fl a
! Audible received packet. Include a bell
  .Pq ASCII 0x07
  character in the output when any packet is received. This option is ignored
  if other format options are present.
--- 75,82 ----
  .Dq pad
  bytes used to fill out the packet.  The options are as follows:
  .Bl -tag -width indent
  .It Fl a
! Audible. Include a bell
  .Pq ASCII 0x07
  character in the output when any packet is received. This option is ignored
  if other format options are present.


>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?199905211113.HAA23277>