version 1.97, 2011/08/21 06:39:09 |
version 1.98, 2011/08/27 18:40:18 |
Line 128 __RCSID("$NetBSD$"); |
|
Line 128 __RCSID("$NetBSD$"); |
|
* for duplicates. |
* for duplicates. |
*/ |
*/ |
#define MAX_DUP_CHK (8 * 2048) |
#define MAX_DUP_CHK (8 * 2048) |
u_char rcvd_tbl[MAX_DUP_CHK/8]; |
static u_char rcvd_tbl[MAX_DUP_CHK/8]; |
int nrepeats = 0; |
static int nrepeats = 0; |
#define A(seq) rcvd_tbl[(seq/8)%sizeof(rcvd_tbl)] /* byte in array */ |
#define A(seq) rcvd_tbl[(seq/8)%sizeof(rcvd_tbl)] /* byte in array */ |
#define B(seq) (1 << (seq & 0x07)) /* bit in byte */ |
#define B(seq) (1 << (seq & 0x07)) /* bit in byte */ |
#define SET(seq) (A(seq) |= B(seq)) |
#define SET(seq) (A(seq) |= B(seq)) |
|
|
}; |
}; |
|
|
|
|
u_char *packet; |
static u_char *packet; |
int packlen; |
static int packlen; |
int pingflags = 0, options; |
static int pingflags = 0, options; |
int pongflags = 0; |
static int pongflags = 0; |
char *fill_pat; |
static char *fill_pat; |
|
|
int s; /* Socket file descriptor */ |
static int s; /* Socket file descriptor */ |
int sloop; /* Socket file descriptor/loopback */ |
static int sloop; /* Socket file descriptor/loopback */ |
|
|
#define PHDR_LEN sizeof(struct tv32) /* size of timestamp header */ |
#define PHDR_LEN sizeof(struct tv32) /* size of timestamp header */ |
struct sockaddr_in whereto, send_addr; /* Who to ping */ |
static struct sockaddr_in whereto, send_addr; /* Who to ping */ |
struct sockaddr_in src_addr; /* from where */ |
static struct sockaddr_in src_addr; /* from where */ |
struct sockaddr_in loc_addr; /* 127.1 */ |
static struct sockaddr_in loc_addr; /* 127.1 */ |
int datalen = 64 - PHDR_LEN; /* How much data */ |
static int datalen = 64 - PHDR_LEN; /* How much data */ |
|
|
#ifndef __NetBSD__ |
#ifndef __NetBSD__ |
static char *progname; |
static char *progname; |
Line 163 static char *progname; |
|
Line 163 static char *progname; |
|
#define setprogname(name) ((void)(progname = (name))) |
#define setprogname(name) ((void)(progname = (name))) |
#endif |
#endif |
|
|
char hostname[MAXHOSTNAMELEN]; |
static char hostname[MAXHOSTNAMELEN]; |
|
|
static struct { |
static struct { |
struct ip o_ip; |
struct ip o_ip; |
|
|
} o_u; |
} o_u; |
} out_pack; |
} out_pack; |
#define opack_icmp out_pack.o_u.u_icmp |
#define opack_icmp out_pack.o_u.u_icmp |
struct ip *opack_ip; |
static struct ip *opack_ip; |
|
|
char optspace[MAX_IPOPTLEN]; /* record route space */ |
static char optspace[MAX_IPOPTLEN]; /* record route space */ |
int optlen; |
static int optlen; |
|
|
|
static int npackets; /* total packets to send */ |
int npackets; /* total packets to send */ |
static int preload; /* number of packets to "preload" */ |
int preload; /* number of packets to "preload" */ |
static int ntransmitted; /* output sequence # = #sent */ |
int ntransmitted; /* output sequence # = #sent */ |
static int ident; /* our ID, in network byte order */ |
int ident; /* our ID, in network byte order */ |
|
|
static int nreceived; /* # of packets we got back */ |
int nreceived; /* # of packets we got back */ |
|
|
static double interval; /* interval between packets */ |
double interval; /* interval between packets */ |
static struct timeval interval_tv; |
struct timeval interval_tv; |
static double tmin = 999999999.0; |
double tmin = 999999999.0; |
static double tmax = 0.0; |
double tmax = 0.0; |
static double tsum = 0.0; /* sum of all times */ |
double tsum = 0.0; /* sum of all times */ |
static double tsumsq = 0.0; |
double tsumsq = 0.0; |
static double maxwait = 0.0; |
double maxwait = 0.0; |
|
|
static int bufspace = IP_MAXPACKET; |
int bufspace = IP_MAXPACKET; |
|
|
static struct timeval now, clear_cache, last_tx, next_tx, first_tx; |
struct timeval now, clear_cache, last_tx, next_tx, first_tx; |
static struct timeval last_rx, first_rx; |
struct timeval last_rx, first_rx; |
static int lastrcvd = 1; /* last ping sent has been received */ |
int lastrcvd = 1; /* last ping sent has been received */ |
|
|
|
static struct timeval jiggle_time; |
static struct timeval jiggle_time; |
static int jiggle_cnt, total_jiggled, jiggle_direction = -1; |
static int jiggle_cnt, total_jiggled, jiggle_direction = -1; |
|
|
static void doit(void); |
__dead static void doit(void); |
static void prefinish(int); |
static void prefinish(int); |
static void prtsig(int); |
static void prtsig(int); |
static void finish(int); |
__dead static void finish(int); |
static void summary(int); |
static void summary(int); |
static void pinger(void); |
static void pinger(void); |
static void fill(void); |
static void fill(void); |
Line 226 static int pr_icmph(struct icmp *, struc |
|
Line 225 static int pr_icmph(struct icmp *, struc |
|
static void jiggle(int), jiggle_flush(int); |
static void jiggle(int), jiggle_flush(int); |
static void gethost(const char *, const char *, |
static void gethost(const char *, const char *, |
struct sockaddr_in *, char *, int); |
struct sockaddr_in *, char *, int); |
static void usage(void); |
__dead static void usage(void); |
|
|
int |
int |
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |