X-Git-Url: https://git.saurik.com/apple/network_cmds.git/blobdiff_plain/2b484d24084b903459c5b416c06cd77b48c748b9..44bd3e4da82664508ce0e5aea495c41bda73e120:/ping.tproj/ping.c?ds=sidebyside diff --git a/ping.tproj/ping.c b/ping.tproj/ping.c index 3b1b89c..7227bd4 100644 --- a/ping.tproj/ping.c +++ b/ping.tproj/ping.c @@ -1,3 +1,30 @@ +/* + * Copyright (c) 2008 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -43,9 +70,9 @@ static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; #endif #include #ifndef __APPLE__ -__FBSDID("$FreeBSD: /repoman/r/ncvs/src/sbin/ping/ping.c,v 1.105 2004/08/14 17:46:10 stefanf Exp $"); +__FBSDID("$FreeBSD: src/sbin/ping/ping.c,v 1.112 2007/07/01 12:08:06 gnn Exp $"); #endif - + /* * P I N G . C * @@ -76,6 +103,7 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/sbin/ping/ping.c,v 1.105 2004/08/14 17:4 #include #include #include +#include #ifdef IPSEC #include @@ -92,9 +120,10 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/sbin/ping/ping.c,v 1.105 2004/08/14 17:4 #include #include #include +#include #define INADDR_LEN ((int)sizeof(in_addr_t)) -#define TIMEVAL_LEN ((int)sizeof(struct timeval)) +#define TIMEVAL_LEN ((int)sizeof(struct tv32)) #define MASK_LEN (ICMP_MASKLEN - ICMP_MINLEN) #define TS_LEN (ICMP_TSLEN - ICMP_MINLEN) #define DEFDATALEN 56 /* default data length */ @@ -102,7 +131,7 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/sbin/ping/ping.c,v 1.105 2004/08/14 17:4 /* runs out of buffer space */ #define MAXIPLEN (sizeof(struct ip) + MAX_IPOPTLEN) #define MAXICMPLEN (ICMP_ADVLENMIN + MAX_IPOPTLEN) -#define MAXWAIT 10 /* max seconds to wait for response */ +#define MAXWAIT 10000 /* max ms to wait for response */ #define MAXALARM (60 * 60) /* max seconds for alarm timeout */ #define MAXTOS 255 @@ -112,6 +141,11 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/sbin/ping/ping.c,v 1.105 2004/08/14 17:4 #define CLR(bit) (A(bit) &= (~B(bit))) #define TST(bit) (A(bit) & B(bit)) +struct tv32 { + u_int32_t tv32_sec; + u_int32_t tv32_usec; +}; + /* various options */ int options; #define F_FLOOD 0x0001 @@ -139,6 +173,8 @@ int options; #define F_HDRINCL 0x40000 #define F_MASK 0x80000 #define F_TIME 0x100000 +#define F_SWEEP 0x200000 +#define F_WAITTIME 0x400000 /* * MAX_DUP_CHK is the number of bits in received table, i.e. the maximum @@ -165,6 +201,15 @@ u_char icmp_type = ICMP_ECHO; u_char icmp_type_rsp = ICMP_ECHOREPLY; int phdr_len = 0; int send_len; +char *boundif; +unsigned int ifscope; +#if defined(IP_FORCE_OUT_IFP) && TARGET_OS_EMBEDDED +char boundifname[IFNAMSIZ]; +#endif /* IP_FORCE_OUT_IFP */ +int nocell; +int how_traffic_class = 0; +int traffic_class = -1; +int no_dup = 0; /* counters */ long nmissedmax; /* max value of ntransmitted - nreceived - 1 */ @@ -172,7 +217,15 @@ long npackets; /* max packets to transmit */ long nreceived; /* # of packets we got back */ long nrepeats; /* number of duplicates */ long ntransmitted; /* sequence # for outbound packets = #sent */ +long snpackets; /* max packets to transmit in one sweep */ +long snreceived; /* # of packets we got back in this sweep */ +long sntransmitted; /* # of packets we sent in this sweep */ +int sweepmax; /* max value of payload in sweep */ +int sweepmin = 0; /* start value of payload in sweep */ +int sweepincr = 1; /* payload increment in sweep */ int interval = 1000; /* interval between packets, ms */ +int waittime = MAXWAIT; /* timeout for each packet */ +long nrcvtimeout = 0; /* # of packets we got back after waittime */ /* timing */ int timing; /* flag to do timing */ @@ -193,7 +246,7 @@ static char *pr_addr(struct in_addr); static char *pr_ntime(n_time); static void pr_icmph(struct icmp *); static void pr_iph(struct ip *); -static void pr_pack(char *, int, struct sockaddr_in *, struct timeval *); +static void pr_pack(char *, int, struct sockaddr_in *, struct timeval *, int); static void pr_retip(struct ip *); static void status(int); static void stopit(int); @@ -224,7 +277,7 @@ main(argc, argv) u_long alarmtimeout, ultmp; int almost_done, ch, df, hold, i, icmp_len, mib[4], preload, sockerrno, tos, ttl; - char ctrl[CMSG_SPACE(sizeof(struct timeval))]; + char ctrl[CMSG_SPACE(sizeof(struct timeval)) + CMSG_SPACE(sizeof(int))]; char hnamebuf[MAXHOSTNAMELEN], snamebuf[MAXHOSTNAMELEN]; #ifdef IP_OPTIONS char rspace[MAX_IPOPTLEN]; /* record route space */ @@ -241,7 +294,10 @@ main(argc, argv) * then drop our setuid bit. Save error reporting for * after arg parsing. */ - s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); + if (getuid()) + s = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP); + else + s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); sockerrno = errno; setuid(getuid()); @@ -251,12 +307,15 @@ main(argc, argv) outpack = outpackhdr + sizeof(struct ip); while ((ch = getopt(argc, argv, - "Aac:DdfI:i:Ll:M:m:nop:QqRrS:s:T:t:vz:" + "Aab:Cc:DdfG:g:h:I:i:k:Ll:M:m:nop:QqRrS:s:T:t:vW:z:" #ifdef IPSEC #ifdef IPSEC_POLICY_IPSEC "P:" #endif /*IPSEC_POLICY_IPSEC*/ #endif /*IPSEC*/ +#if defined(IP_FORCE_OUT_IFP) && TARGET_OS_EMBEDDED + "B:" +#endif /* IP_FORCE_OUT_IFP */ )) != -1) { switch(ch) { @@ -266,6 +325,18 @@ main(argc, argv) case 'a': options |= F_AUDIBLE; break; +#if defined(IP_FORCE_OUT_IFP) && TARGET_OS_EMBEDDED + case 'B': + (void) snprintf(boundifname, sizeof (boundifname), + "%s", optarg); + break; +#endif /* IP_FORCE_OUT_IFP */ + case 'b': + boundif = optarg; + break; + case 'C': + nocell++; + break; case 'c': ultmp = strtoul(optarg, &ep, 0); if (*ep || ep == optarg || ultmp > LONG_MAX || !ultmp) @@ -289,6 +360,54 @@ main(argc, argv) options |= F_FLOOD; setbuf(stdout, (char *)NULL); break; + case 'G': /* Maximum packet size for ping sweep */ + ultmp = strtoul(optarg, &ep, 0); + if (*ep || ep == optarg) + errx(EX_USAGE, "invalid packet size: `%s'", + optarg); +#ifndef __APPLE__ + if (uid != 0 && ultmp > DEFDATALEN) { + errno = EPERM; + err(EX_NOPERM, + "packet size too large: %lu > %u", + ultmp, DEFDATALEN); + } +#endif /* __APPLE__ */ + options |= F_SWEEP; + sweepmax = ultmp; + break; + case 'g': /* Minimum packet size for ping sweep */ + ultmp = strtoul(optarg, &ep, 0); + if (*ep || ep == optarg) + errx(EX_USAGE, "invalid packet size: `%s'", + optarg); +#ifndef __APPLE__ + if (uid != 0 && ultmp > DEFDATALEN) { + errno = EPERM; + err(EX_NOPERM, + "packet size too large: %lu > %u", + ultmp, DEFDATALEN); + } +#endif /* __APPLE__ */ + options |= F_SWEEP; + sweepmin = ultmp; + break; + case 'h': /* Packet size increment for ping sweep */ + ultmp = strtoul(optarg, &ep, 0); + if (*ep || ep == optarg || ultmp < 1) + errx(EX_USAGE, "invalid increment size: `%s'", + optarg); +#ifndef __APPLE__ + if (uid != 0 && ultmp > DEFDATALEN) { + errno = EPERM; + err(EX_NOPERM, + "packet size too large: %lu > %u", + ultmp, DEFDATALEN); + } +#endif /* __APPLE__ */ + options |= F_SWEEP; + sweepincr = ultmp; + break; case 'I': /* multicast interface */ if (inet_aton(optarg, &ifaddr) == 0) errx(EX_USAGE, @@ -308,6 +427,10 @@ main(argc, argv) err(EX_NOPERM, "-i interval too short"); } break; + case 'k': + how_traffic_class++; + traffic_class = atoi(optarg); + break; case 'L': options |= F_NOLOOP; loop = 0; @@ -395,7 +518,7 @@ main(argc, argv) "packet size too large: %lu > %u", ultmp, DEFDATALEN); } -#endif +#endif /* __APPLE__ */ datalen = ultmp; break; case 'T': /* multicast TTL */ @@ -414,11 +537,19 @@ main(argc, argv) if (alarmtimeout > MAXALARM) errx(EX_USAGE, "invalid timeout: `%s' > %d", optarg, MAXALARM); - alarm((int)alarmtimeout); + alarm((unsigned int)alarmtimeout); break; case 'v': options |= F_VERBOSE; break; + case 'W': /* wait ms for answer */ + t = strtod(optarg, &ep); + if (*ep || ep == optarg || t > (double)INT_MAX) + errx(EX_USAGE, "invalid timing interval: `%s'", + optarg); + options |= F_WAITTIME; + waittime = (int)t; + break; case 'z': options |= F_HDRINCL; ultmp = strtoul(optarg, &ep, 0); @@ -431,6 +562,9 @@ main(argc, argv) } } + if (boundif != NULL && (ifscope = if_nametoindex(boundif)) == 0) + errx(1, "bad interface name"); + if (argc - optind != 1) usage(); target = argv[optind]; @@ -513,6 +647,30 @@ main(argc, argv) hostname = hnamebuf; } + do { + struct ifaddrs *ifa_list, *ifa; + + if (IN_MULTICAST(ntohl(whereto.sin_addr.s_addr)) || whereto.sin_addr.s_addr == INADDR_BROADCAST) { + no_dup = 1; + break; + } + + if (getifaddrs(&ifa_list) == -1) + break; + for (ifa = ifa_list; ifa; ifa = ifa->ifa_next) { + if (ifa->ifa_addr->sa_family != AF_INET) + continue; + if ((ifa->ifa_flags & IFF_BROADCAST) == 0 || ifa->ifa_broadaddr == NULL) + continue; + if (whereto.sin_addr.s_addr != ((struct sockaddr_in*)ifa->ifa_broadaddr)->sin_addr.s_addr) + continue; + no_dup = 1; + break; + } + + freeifaddrs(ifa_list); + } while (0); + if (options & F_FLOOD && options & F_INTERVAL) errx(EX_USAGE, "-f and -i: incompatible options"); @@ -538,12 +696,38 @@ main(argc, argv) err(EX_OSERR, "socket"); } hold = 1; + if (ifscope != 0) { + if (setsockopt(s, IPPROTO_IP, IP_BOUND_IF, + (char *)&ifscope, sizeof (ifscope)) != 0) + err(EX_OSERR, "setsockopt(IP_BOUND_IF)"); + } +#if defined(IP_FORCE_OUT_IFP) && TARGET_OS_EMBEDDED + else if (boundifname[0] != 0) { + if (setsockopt(s, IPPROTO_IP, IP_FORCE_OUT_IFP, boundifname, + sizeof (boundifname)) != 0) + err(EX_OSERR, "setsockopt(IP_FORCE_OUT_IFP)"); + } +#endif /* IP_FORCE_OUT_IFP */ + if (nocell) { + if (setsockopt(s, IPPROTO_IP, IP_NO_IFT_CELLULAR, + (char *)&nocell, sizeof (nocell)) != 0) + err(EX_OSERR, "setsockopt(IP_NO_IFT_CELLULAR)"); + } if (options & F_SO_DEBUG) (void)setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&hold, sizeof(hold)); if (options & F_SO_DONTROUTE) (void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *)&hold, sizeof(hold)); + if (how_traffic_class == 1 && traffic_class > 0) { + (void)setsockopt(s, SOL_SOCKET, SO_TRAFFIC_CLASS, (void *)&traffic_class, + sizeof(traffic_class)); + } + if (how_traffic_class > 0) { + int on = 1; + (void)setsockopt(s, SOL_SOCKET, SO_RECV_TRAFFIC_CLASS, (void *)&on, + sizeof(on)); + } #ifdef IPSEC #ifdef IPSEC_POLICY_IPSEC if (options & F_POLICY) { @@ -642,6 +826,23 @@ main(argc, argv) err(EX_OSERR, "setsockopt SO_TIMESTAMP"); } #endif + if (sweepmax) { + if (sweepmin >= sweepmax) + errx(EX_USAGE, "Maximum packet size must be greater than the minimum packet size"); + + if (datalen != DEFDATALEN) + errx(EX_USAGE, "Packet size and ping sweep are mutually exclusive"); + + if (npackets > 0) { + snpackets = npackets; + npackets = 0; + } else + snpackets = 1; + datalen = sweepmin; + send_len = icmp_len + sweepmin; + } + if (options & F_SWEEP && !sweepmax) + errx(EX_USAGE, "Maximum sweep size must be specified"); /* * When pinging the broadcast address, you can get a lot of answers. @@ -667,9 +868,19 @@ main(argc, argv) inet_ntoa(to->sin_addr)); if (source) (void)printf(" from %s", shostname); - (void)printf(": %d data bytes\n", datalen); - } else - (void)printf("PING %s: %d data bytes\n", hostname, datalen); + if (sweepmax) + (void)printf(": (%d ... %d) data bytes\n", + sweepmin, sweepmax); + else + (void)printf(": %d data bytes\n", datalen); + + } else { + if (sweepmax) + (void)printf("PING %s: (%d ... %d) data bytes\n", + hostname, sweepmin, sweepmax); + else + (void)printf("PING %s: %d data bytes\n", hostname, datalen); + } /* * Use sigaction() instead of signal() to get unambiguous semantics, @@ -728,6 +939,7 @@ main(argc, argv) struct timeval now, timeout; fd_set rfds; int cc, n; + int tc = -1; check_status(); if ((unsigned)s >= FD_SETSIZE) @@ -764,25 +976,42 @@ main(argc, argv) warn("recvmsg"); continue; } -#ifdef SO_TIMESTAMP - if (cmsg->cmsg_level == SOL_SOCKET && - cmsg->cmsg_type == SCM_TIMESTAMP && - cmsg->cmsg_len == CMSG_LEN(sizeof *tv)) { - /* Copy to avoid alignment problems: */ - memcpy(&now, CMSG_DATA(cmsg), sizeof(now)); - tv = &now; + for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) { + #ifdef SO_TIMESTAMP + if (cmsg->cmsg_level == SOL_SOCKET && + cmsg->cmsg_type == SCM_TIMESTAMP && + cmsg->cmsg_len == CMSG_LEN(sizeof *tv)) { + /* Copy to avoid alignment problems: */ + memcpy(&now, CMSG_DATA(cmsg), sizeof(now)); + tv = &now; + } + #endif + if (cmsg->cmsg_level == SOL_SOCKET && + cmsg->cmsg_type == SO_TRAFFIC_CLASS && + cmsg->cmsg_len == CMSG_LEN(sizeof(int))) { + /* Copy to avoid alignment problems: */ + memcpy(&tc, CMSG_DATA(cmsg), sizeof(tc)); + } } -#endif if (tv == NULL) { (void)gettimeofday(&now, NULL); tv = &now; } - pr_pack((char *)packet, cc, &from, tv); + pr_pack((char *)packet, cc, &from, tv, tc); if ((options & F_ONCE && nreceived) || (npackets && nreceived >= npackets)) break; } if (n == 0 || options & F_FLOOD) { + if (sweepmax && sntransmitted == snpackets) { + for (i = 0; i < sweepincr ; ++i) + *datap++ = i; + datalen += sweepincr; + if (datalen > sweepmax) + break; + send_len = icmp_len + datalen; + sntransmitted = 0; + } if (!npackets || ntransmitted < npackets) pinger(); else { @@ -794,14 +1023,18 @@ main(argc, argv) intvl.tv_sec = 2 * tmax / 1000; if (!intvl.tv_sec) intvl.tv_sec = 1; - } else - intvl.tv_sec = MAXWAIT; + } else { + intvl.tv_sec = waittime / 1000; + intvl.tv_usec = waittime % 1000 * 1000; + } } (void)gettimeofday(&last, NULL); if (ntransmitted - nreceived - 1 > nmissedmax) { nmissedmax = ntransmitted - nreceived - 1; if (options & F_MISSED) (void)write(STDOUT_FILENO, &BBELL, 1); + if (!(options & F_QUIET)) + printf("Request timeout for icmp_seq %ld\n", ntransmitted - 2); } } } @@ -842,6 +1075,7 @@ static void pinger(void) { struct timeval now; + struct tv32 tv32; struct ip *ip; struct icmp *icp; int cc, i; @@ -860,13 +1094,15 @@ pinger(void) if ((options & F_TIME) || timing) { (void)gettimeofday(&now, NULL); + tv32.tv32_sec = htonl(now.tv_sec); + tv32.tv32_usec = htonl(now.tv_usec); if (options & F_TIME) icp->icmp_otime = htonl((now.tv_sec % (24*60*60)) * 1000 + now.tv_usec / 1000); if (timing) - bcopy((void *)&now, + bcopy((void *)&tv32, (void *)&outpack[ICMP_MINLEN + phdr_len], - sizeof(struct timeval)); + sizeof(tv32)); } cc = ICMP_MINLEN + phdr_len + datalen; @@ -881,9 +1117,34 @@ pinger(void) ip->ip_sum = in_cksum((u_short *)outpackhdr, cc); packet = outpackhdr; } - i = sendto(s, (char *)packet, cc, 0, (struct sockaddr *)&whereto, - sizeof(whereto)); - + if (how_traffic_class == 2) { + struct msghdr msg; + struct iovec iov; + char *cmbuf[CMSG_SPACE(sizeof(int))]; + struct cmsghdr *cm = (struct cmsghdr *)cmbuf; + + msg.msg_name = &whereto; + msg.msg_namelen = sizeof(whereto); + + iov.iov_base = packet; + iov.iov_len = cc; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + + cm->cmsg_len = CMSG_LEN(sizeof(int)); + cm->cmsg_level = SOL_SOCKET; + cm->cmsg_type = SO_TRAFFIC_CLASS; + *(int *)CMSG_DATA(cm) = traffic_class; + msg.msg_control = cm; + msg.msg_controllen = CMSG_SPACE(sizeof(int)); + + msg.msg_flags = 0; + + i = sendmsg(s, &msg, 0); + } else { + i = sendto(s, (char *)packet, cc, 0, (struct sockaddr *)&whereto, + sizeof(whereto)); + } if (i < 0 || i != cc) { if (i < 0) { if (options & F_FLOOD && errno == ENOBUFS) { @@ -897,6 +1158,7 @@ pinger(void) } } ntransmitted++; + sntransmitted++; if (!(options & F_QUIET) && options & F_FLOOD) (void)write(STDOUT_FILENO, &DOT, 1); } @@ -909,11 +1171,12 @@ pinger(void) * program to be run without having intermingled output (or statistics!). */ static void -pr_pack(buf, cc, from, tv) +pr_pack(buf, cc, from, tv, tc) char *buf; int cc; struct sockaddr_in *from; struct timeval *tv; + int tc; { struct in_addr ina; u_char *cp, *dp; @@ -946,6 +1209,7 @@ pr_pack(buf, cc, from, tv) triptime = 0.0; if (timing) { struct timeval tv1; + struct tv32 tv32; #ifndef icmp_data tp = &icp->icmp_ip; #else @@ -955,7 +1219,9 @@ pr_pack(buf, cc, from, tv) if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) { /* Copy to avoid alignment problems: */ - memcpy(&tv1, tp, sizeof(tv1)); + memcpy(&tv32, tp, sizeof(tv32)); + tv1.tv_sec = ntohl(tv32.tv32_sec); + tv1.tv_usec = ntohl(tv32.tv32_usec); tvsub(tv, &tv1); triptime = ((double)tv->tv_sec) * 1000.0 + ((double)tv->tv_usec) / 1000.0; @@ -982,6 +1248,11 @@ pr_pack(buf, cc, from, tv) if (options & F_QUIET) return; + + if (options & F_WAITTIME && triptime > waittime) { + ++nrcvtimeout; + return; + } if (options & F_FLOOD) (void)write(STDOUT_FILENO, &BSPACE, 1); @@ -992,8 +1263,12 @@ pr_pack(buf, cc, from, tv) (void)printf(" ttl=%d", ip->ip_ttl); if (timing) (void)printf(" time=%.3f ms", triptime); - if (dupflag) + if (tc != -1) { + (void)printf(" tc=%d", tc); + } + if (dupflag && no_dup == 0) { (void)printf(" (DUP!)"); + } if (options & F_AUDIBLE) (void)write(STDOUT_FILENO, &BBELL, 1); if (options & F_MASK) { @@ -1245,7 +1520,7 @@ check_status() if (siginfo_p) { siginfo_p = 0; - (void)fprintf(stderr, "\r%ld/%ld packets received (%.0f%%)", + (void)fprintf(stderr, "\r%ld/%ld packets received (%.1f%%)", nreceived, ntransmitted, ntransmitted ? nreceived * 100.0 / ntransmitted : 0.0); if (nreceived && timing) @@ -1276,10 +1551,12 @@ finish() if (nreceived > ntransmitted) (void)printf("-- somebody's printing up packets!"); else - (void)printf("%d%% packet loss", - (int)(((ntransmitted - nreceived) * 100) / - ntransmitted)); + (void)printf("%.1f%% packet loss", + ((ntransmitted - nreceived) * 100.0) / + ntransmitted); } + if (nrcvtimeout) + (void)printf(", %ld packets out of wait time", nrcvtimeout); (void)putchar('\n'); if (nreceived && timing) { double n = nreceived + nrepeats; @@ -1593,12 +1870,14 @@ static void usage() { - (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n", -"usage: ping [-AaDdfnoQqRrv] [-c count] [-i wait] [-l preload] [-M mask | time]", -" [-m ttl]" SECOPT " [-p pattern] [-S src_addr] [-s packetsize]", -" [-t timeout] [-z tos] host", + (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", +"usage: ping [-AaDdfnoQqRrv] [-b boundif] [-c count] [-G sweepmaxsize] [-g sweepminsize]", +" [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl]", +" " SECOPT " [-p pattern] [-S src_addr] [-s packetsize] [-t timeout]", +" [-W waittime] [-z tos] host", " ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]", " [-M mask | time] [-m ttl]" SECOPT " [-p pattern] [-S src_addr]", -" [-s packetsize] [-T ttl] [-t timeout] [-z tos] mcast-group"); +" [-s packetsize] [-T ttl] [-t timeout] [-W waittime]", +" [-z tos] mcast-group"); exit(EX_USAGE); }