add a patch from netperf-wrapper to allow printing timestamps.
This commit is contained in:
parent
915e69fa8a
commit
9fad7aedd9
@ -1,10 +1,10 @@
|
||||
# $OpenBSD: Makefile,v 1.31 2013/03/11 11:35:46 espie Exp $
|
||||
# $OpenBSD: Makefile,v 1.32 2013/04/18 18:52:49 sthen Exp $
|
||||
|
||||
COMMENT = quickly ping N hosts w/o flooding the network
|
||||
|
||||
DISTNAME = fping-2.4b2_to4-ipv6
|
||||
PKGNAME = ${DISTNAME:S/_to4-ipv6//}
|
||||
REVISION = 6
|
||||
REVISION = 7
|
||||
|
||||
CATEGORIES = net
|
||||
|
||||
@ -23,7 +23,6 @@ CONFIGURE_STYLE = gnu
|
||||
SEPARATE_BUILD = Yes
|
||||
CONFIGURE_ARGS = --bindir=${PREFIX}/sbin
|
||||
COPTS += -DHAVE_PROGNAME
|
||||
USE_GROFF = Yes
|
||||
|
||||
pre-configure:
|
||||
perl -pi -e 's,/usr/local/bin/fping,${LOCALBASE}/sbin/fping,g' \
|
||||
|
@ -1,5 +1,2 @@
|
||||
MD5 (fping-2.4b2_to4-ipv6.tar.gz) = 56VaYiZJJMmnNzmHOwc3oA==
|
||||
RMD160 (fping-2.4b2_to4-ipv6.tar.gz) = dv+o8/B9W/PHCsT4ntx6YzYwPR4=
|
||||
SHA1 (fping-2.4b2_to4-ipv6.tar.gz) = qchGpvvrhoB4fmAsa6MFk6Vgc9M=
|
||||
SHA256 (fping-2.4b2_to4-ipv6.tar.gz) = CxMI+nzJoIP76THwySftUrY0v4lavYaeyrgmQdbl9G8=
|
||||
SIZE (fping-2.4b2_to4-ipv6.tar.gz) = 127986
|
||||
|
@ -1,6 +1,6 @@
|
||||
$OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
--- fping.c.orig Thu Dec 31 15:57:28 2009
|
||||
+++ fping.c Wed Nov 24 15:07:47 2010
|
||||
$OpenBSD: patch-fping_c,v 1.9 2013/04/18 18:52:50 sthen Exp $
|
||||
--- fping.c.orig Thu Apr 18 19:45:15 2013
|
||||
+++ fping.c Thu Apr 18 19:49:21 2013
|
||||
@@ -67,7 +67,7 @@ extern "C"
|
||||
|
||||
/*** autoconf includes ***/
|
||||
@ -53,7 +53,15 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
int total_time_i; /* sum of response times */
|
||||
int *resp_times; /* individual response times */
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
@@ -524,7 +529,11 @@ int main( int argc, char **argv )
|
||||
@@ -319,6 +324,7 @@ int verbose_flag, quiet_flag, stats_flag, unreachable_
|
||||
int elapsed_flag, version_flag, count_flag, loop_flag;
|
||||
int per_recv_flag, report_all_rtts_flag, name_flag, addr_flag, backoff_flag;
|
||||
int multif_flag;
|
||||
+int timestamp_flag = 0;
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
int randomly_lose_flag, sent_times_flag, trace_flag, print_per_system_flag;
|
||||
int lose_factor;
|
||||
@@ -524,7 +530,11 @@ int main( int argc, char **argv )
|
||||
|
||||
}/* IF */
|
||||
|
||||
@ -66,7 +74,35 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
ident = getpid() & 0xFFFF;
|
||||
|
||||
verbose_flag = 1;
|
||||
@@ -883,8 +892,13 @@ int main( int argc, char **argv )
|
||||
@@ -533,7 +543,7 @@ int main( int argc, char **argv )
|
||||
|
||||
/* get command line options */
|
||||
|
||||
- while( ( c = getopt( argc, argv, "gedhlmnqusaAvz:t:i:p:f:r:c:b:C:Q:B:S:I:T:O:" ) ) != EOF )
|
||||
+ while( ( c = getopt( argc, argv, "gedhlmnqusaAvDz:t:i:p:f:r:c:b:C:Q:B:S:I:T:O:" ) ) != EOF )
|
||||
{
|
||||
switch( c )
|
||||
{
|
||||
@@ -622,6 +632,10 @@ int main( int argc, char **argv )
|
||||
|
||||
break;
|
||||
|
||||
+ case 'D':
|
||||
+ timestamp_flag = 1;
|
||||
+ break;
|
||||
+
|
||||
case 's':
|
||||
stats_flag = 1;
|
||||
break;
|
||||
@@ -846,6 +860,7 @@ int main( int argc, char **argv )
|
||||
if( loop_flag ) fprintf( stderr, " loop_flag set\n" );
|
||||
if( backoff_flag ) fprintf( stderr, " backoff_flag set\n" );
|
||||
if( per_recv_flag ) fprintf( stderr, " per_recv_flag set\n" );
|
||||
+ if( timestamp_flag ) fprintf( stderr, " timestamp_flag set\n" );
|
||||
if( report_all_rtts_flag ) fprintf( stderr, " report_all_rtts_flag set\n" );
|
||||
if( randomly_lose_flag ) fprintf( stderr, " randomly_lose_flag set\n" );
|
||||
if( sent_times_flag ) fprintf( stderr, " sent_times_flag set\n" );
|
||||
@@ -883,8 +898,13 @@ int main( int argc, char **argv )
|
||||
else if( filename )
|
||||
{
|
||||
FILE *ping_file;
|
||||
@ -80,7 +116,7 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
char *p;
|
||||
|
||||
if( strcmp( filename, "-" ) == 0 )
|
||||
@@ -898,6 +912,7 @@ int main( int argc, char **argv )
|
||||
@@ -898,6 +918,7 @@ int main( int argc, char **argv )
|
||||
|
||||
while( fgets( line, sizeof(line), ping_file ) )
|
||||
{
|
||||
@ -88,7 +124,7 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
if( sscanf( line, "%s", host ) != 1 )
|
||||
continue;
|
||||
|
||||
@@ -1594,7 +1609,6 @@ void send_ping( int s, HOST_ENTRY *h )
|
||||
@@ -1594,7 +1615,6 @@ void send_ping( int s, HOST_ENTRY *h )
|
||||
memset( buffer, 0, ping_pkt_size * sizeof( char ) );
|
||||
icp = ( FPING_ICMPHDR* )buffer;
|
||||
|
||||
@ -96,7 +132,7 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
myseq = h->num_sent * num_hosts + h->i;
|
||||
max_seq_sent = myseq > max_seq_sent ? myseq : max_seq_sent;
|
||||
|
||||
@@ -1606,6 +1620,8 @@ void send_ping( int s, HOST_ENTRY *h )
|
||||
@@ -1606,6 +1626,8 @@ void send_ping( int s, HOST_ENTRY *h )
|
||||
icp->icmp_id = htons(ident);
|
||||
|
||||
pdp = ( PING_DATA* )( buffer + SIZE_ICMP_HDR );
|
||||
@ -105,7 +141,7 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
pdp->ping_ts = h->last_send_time;
|
||||
pdp->ping_count = h->num_sent;
|
||||
|
||||
@@ -1617,6 +1633,8 @@ void send_ping( int s, HOST_ENTRY *h )
|
||||
@@ -1617,6 +1639,8 @@ void send_ping( int s, HOST_ENTRY *h )
|
||||
icp->icmp6_id = htons(ident);
|
||||
|
||||
pdp = ( PING_DATA* )( buffer + SIZE_ICMP_HDR );
|
||||
@ -114,7 +150,7 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
pdp->ping_ts = h->last_send_time;
|
||||
pdp->ping_count = h->num_sent;
|
||||
|
||||
@@ -1705,6 +1723,9 @@ int wait_for_reply( void )
|
||||
@@ -1705,6 +1729,9 @@ int wait_for_reply( void )
|
||||
|
||||
result = recvfrom_wto( s, buffer, sizeof(buffer), &response_addr, select_time );
|
||||
|
||||
@ -124,7 +160,7 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
if( result < 0 )
|
||||
return 0; /* timeout */
|
||||
|
||||
@@ -1719,7 +1740,7 @@ int wait_for_reply( void )
|
||||
@@ -1719,7 +1746,7 @@ int wait_for_reply( void )
|
||||
|
||||
ip = ( struct ip* )buffer;
|
||||
#ifndef IPV6
|
||||
@ -133,7 +169,7 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
/* The alpha headers are decidedly broken.
|
||||
* Using an ANSI compiler, it provides ip_vhl instead of ip_hl and
|
||||
* ip_v. So, to get ip_hl, we mask off the bottom four bits.
|
||||
@@ -1727,7 +1748,7 @@ int wait_for_reply( void )
|
||||
@@ -1727,7 +1754,7 @@ int wait_for_reply( void )
|
||||
hlen = ( ip->ip_vhl & 0x0F ) << 2;
|
||||
#else
|
||||
hlen = ip->ip_hl << 2;
|
||||
@ -142,7 +178,7 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
if( result < hlen + ICMP_MINLEN )
|
||||
#else
|
||||
if( result < sizeof(FPING_ICMPHDR) )
|
||||
@@ -1784,7 +1805,6 @@ int wait_for_reply( void )
|
||||
@@ -1784,7 +1811,6 @@ int wait_for_reply( void )
|
||||
h = table[n];
|
||||
|
||||
/* received ping is cool, so process it */
|
||||
@ -150,7 +186,19 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
h->waiting = 0;
|
||||
h->timeout = timeout;
|
||||
h->num_recv++;
|
||||
@@ -2677,7 +2697,7 @@ char * sprint_tm( int t )
|
||||
@@ -1885,6 +1911,11 @@ int wait_for_reply( void )
|
||||
|
||||
if( per_recv_flag )
|
||||
{
|
||||
+ if(timestamp_flag) {
|
||||
+ printf("[%lu.%06lu] ",
|
||||
+ (unsigned long)current_time.tv_sec,
|
||||
+ (unsigned long)current_time.tv_usec);
|
||||
+ }
|
||||
avg = h->total_time / h->num_recv;
|
||||
printf( "%s%s : [%d], %d bytes, %s ms",
|
||||
h->host, h->pad, this_count, result, sprint_tm( this_reply ) );
|
||||
@@ -2677,7 +2708,7 @@ char * sprint_tm( int t )
|
||||
/* <= 0.99 ms */
|
||||
if( t < 100 )
|
||||
{
|
||||
@ -159,7 +207,7 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
return( buf );
|
||||
|
||||
}/* IF */
|
||||
@@ -2685,7 +2705,7 @@ char * sprint_tm( int t )
|
||||
@@ -2685,7 +2716,7 @@ char * sprint_tm( int t )
|
||||
/* 1.00 - 9.99 ms */
|
||||
if( t < 1000 )
|
||||
{
|
||||
@ -168,7 +216,7 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
return( buf );
|
||||
|
||||
}/* IF */
|
||||
@@ -2693,13 +2713,13 @@ char * sprint_tm( int t )
|
||||
@@ -2693,13 +2724,13 @@ char * sprint_tm( int t )
|
||||
/* 10.0 - 99.9 ms */
|
||||
if( t < 10000 )
|
||||
{
|
||||
@ -184,3 +232,11 @@ $OpenBSD: patch-fping_c,v 1.8 2010/11/24 15:14:45 sthen Exp $
|
||||
return( buf );
|
||||
|
||||
} /* sprint_tm() */
|
||||
@@ -2825,6 +2856,7 @@ void usage( void )
|
||||
fprintf( stderr, " -B f set exponential backoff factor to f\n" );
|
||||
fprintf( stderr, " -c n count of pings to send to each target (default %d)\n", count );
|
||||
fprintf( stderr, " -C n same as -c, report results in verbose format\n" );
|
||||
+ fprintf( stderr, " -D print timestamp before each output line\n" );
|
||||
fprintf( stderr, " -e show elapsed time on return packets\n" );
|
||||
fprintf( stderr, " -f file read list of targets from a file ( - means stdin) (only if no -g specified)\n" );
|
||||
fprintf( stderr, " -g generate target list (only if no -f specified)\n" );
|
||||
|
Loading…
x
Reference in New Issue
Block a user