WARNS=3 and style fixes. No functionality change.
This commit is contained in:
parent
bd537a28cc
commit
7e9489e0f6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=273295
@ -7,7 +7,7 @@ PROG= ping
|
|||||||
MAN= ping.8
|
MAN= ping.8
|
||||||
BINOWN= root
|
BINOWN= root
|
||||||
BINMODE=4555
|
BINMODE=4555
|
||||||
WARNS?= 2
|
WARNS?= 3
|
||||||
DPADD= ${LIBM}
|
DPADD= ${LIBM}
|
||||||
LDADD= -lm
|
LDADD= -lm
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ struct tv32 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* various options */
|
/* various options */
|
||||||
int options;
|
static int options;
|
||||||
#define F_FLOOD 0x0001
|
#define F_FLOOD 0x0001
|
||||||
#define F_INTERVAL 0x0002
|
#define F_INTERVAL 0x0002
|
||||||
#define F_NUMERIC 0x0004
|
#define F_NUMERIC 0x0004
|
||||||
@ -157,52 +157,52 @@ int options;
|
|||||||
* to 8192 for complete accuracy...
|
* to 8192 for complete accuracy...
|
||||||
*/
|
*/
|
||||||
#define MAX_DUP_CHK (8 * 128)
|
#define MAX_DUP_CHK (8 * 128)
|
||||||
int mx_dup_ck = MAX_DUP_CHK;
|
static int mx_dup_ck = MAX_DUP_CHK;
|
||||||
char rcvd_tbl[MAX_DUP_CHK / 8];
|
static char rcvd_tbl[MAX_DUP_CHK / 8];
|
||||||
|
|
||||||
struct sockaddr_in whereto; /* who to ping */
|
static struct sockaddr_in whereto; /* who to ping */
|
||||||
int datalen = DEFDATALEN;
|
static int datalen = DEFDATALEN;
|
||||||
int maxpayload;
|
static int maxpayload;
|
||||||
int ssend; /* send socket file descriptor */
|
static int ssend; /* send socket file descriptor */
|
||||||
int srecv; /* receive socket file descriptor */
|
static int srecv; /* receive socket file descriptor */
|
||||||
u_char outpackhdr[IP_MAXPACKET], *outpack;
|
static u_char outpackhdr[IP_MAXPACKET], *outpack;
|
||||||
char BBELL = '\a'; /* characters written for MISSED and AUDIBLE */
|
static char BBELL = '\a'; /* characters written for MISSED and AUDIBLE */
|
||||||
char BSPACE = '\b'; /* characters written for flood */
|
static char BSPACE = '\b'; /* characters written for flood */
|
||||||
char DOT = '.';
|
static char DOT = '.';
|
||||||
char *hostname;
|
static char *hostname;
|
||||||
char *shostname;
|
static char *shostname;
|
||||||
int ident; /* process id to identify our packets */
|
static int ident; /* process id to identify our packets */
|
||||||
int uid; /* cached uid for micro-optimization */
|
static int uid; /* cached uid for micro-optimization */
|
||||||
u_char icmp_type = ICMP_ECHO;
|
static u_char icmp_type = ICMP_ECHO;
|
||||||
u_char icmp_type_rsp = ICMP_ECHOREPLY;
|
static u_char icmp_type_rsp = ICMP_ECHOREPLY;
|
||||||
int phdr_len = 0;
|
static int phdr_len = 0;
|
||||||
int send_len;
|
static int send_len;
|
||||||
|
|
||||||
/* counters */
|
/* counters */
|
||||||
long nmissedmax; /* max value of ntransmitted - nreceived - 1 */
|
static long nmissedmax; /* max value of ntransmitted - nreceived - 1 */
|
||||||
long npackets; /* max packets to transmit */
|
static long npackets; /* max packets to transmit */
|
||||||
long nreceived; /* # of packets we got back */
|
static long nreceived; /* # of packets we got back */
|
||||||
long nrepeats; /* number of duplicates */
|
static long nrepeats; /* number of duplicates */
|
||||||
long ntransmitted; /* sequence # for outbound packets = #sent */
|
static long ntransmitted; /* sequence # for outbound packets = #sent */
|
||||||
long snpackets; /* max packets to transmit in one sweep */
|
static long snpackets; /* max packets to transmit in one sweep */
|
||||||
long snreceived; /* # of packets we got back in this sweep */
|
static long sntransmitted; /* # of packets we sent in this sweep */
|
||||||
long sntransmitted; /* # of packets we sent in this sweep */
|
static int sweepmax; /* max value of payload in sweep */
|
||||||
int sweepmax; /* max value of payload in sweep */
|
static int sweepmin = 0; /* start value of payload in sweep */
|
||||||
int sweepmin = 0; /* start value of payload in sweep */
|
static int sweepincr = 1; /* payload increment in sweep */
|
||||||
int sweepincr = 1; /* payload increment in sweep */
|
static int interval = 1000; /* interval between packets, ms */
|
||||||
int interval = 1000; /* interval between packets, ms */
|
static int waittime = MAXWAIT; /* timeout for each packet */
|
||||||
int waittime = MAXWAIT; /* timeout for each packet */
|
static long nrcvtimeout = 0; /* # of packets we got back after waittime */
|
||||||
long nrcvtimeout = 0; /* # of packets we got back after waittime */
|
|
||||||
|
|
||||||
/* timing */
|
/* timing */
|
||||||
int timing; /* flag to do timing */
|
static int timing; /* flag to do timing */
|
||||||
double tmin = 999999999.0; /* minimum round trip time */
|
static double tmin = 999999999.0; /* minimum round trip time */
|
||||||
double tmax = 0.0; /* maximum round trip time */
|
static double tmax = 0.0; /* maximum round trip time */
|
||||||
double tsum = 0.0; /* sum of all times, for doing average */
|
static double tsum = 0.0; /* sum of all times, for doing average */
|
||||||
double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
|
static double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
|
||||||
|
|
||||||
volatile sig_atomic_t finish_up; /* nonzero if we've been told to finish up */
|
/* nonzero if we've been told to finish up */
|
||||||
volatile sig_atomic_t siginfo_p;
|
static volatile sig_atomic_t finish_up;
|
||||||
|
static volatile sig_atomic_t siginfo_p;
|
||||||
|
|
||||||
#ifdef HAVE_LIBCAPSICUM
|
#ifdef HAVE_LIBCAPSICUM
|
||||||
static cap_channel_t *capdns;
|
static cap_channel_t *capdns;
|
||||||
@ -1150,7 +1150,8 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, struct timeval *tv)
|
|||||||
#endif
|
#endif
|
||||||
tp = (const char *)tp + phdr_len;
|
tp = (const char *)tp + phdr_len;
|
||||||
|
|
||||||
if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) {
|
if ((size_t)(cc - ICMP_MINLEN - phdr_len) >=
|
||||||
|
sizeof(tv1)) {
|
||||||
/* Copy to avoid alignment problems: */
|
/* Copy to avoid alignment problems: */
|
||||||
memcpy(&tv32, tp, sizeof(tv32));
|
memcpy(&tv32, tp, sizeof(tv32));
|
||||||
tv1.tv_sec = ntohl(tv32.tv32_sec);
|
tv1.tv_sec = ntohl(tv32.tv32_sec);
|
||||||
|
@ -5,7 +5,7 @@ MAN= ping6.8
|
|||||||
|
|
||||||
CFLAGS+=-DIPSEC -DKAME_SCOPEID -DUSE_RFC2292BIS \
|
CFLAGS+=-DIPSEC -DKAME_SCOPEID -DUSE_RFC2292BIS \
|
||||||
-DHAVE_ARC4RANDOM
|
-DHAVE_ARC4RANDOM
|
||||||
WARNS?= 2
|
WARNS?= 3
|
||||||
|
|
||||||
BINOWN= root
|
BINOWN= root
|
||||||
BINMODE=4555
|
BINMODE=4555
|
||||||
|
@ -205,84 +205,83 @@ u_int options;
|
|||||||
* to 8192 for complete accuracy...
|
* to 8192 for complete accuracy...
|
||||||
*/
|
*/
|
||||||
#define MAX_DUP_CHK (8 * 8192)
|
#define MAX_DUP_CHK (8 * 8192)
|
||||||
int mx_dup_ck = MAX_DUP_CHK;
|
static int mx_dup_ck = MAX_DUP_CHK;
|
||||||
char rcvd_tbl[MAX_DUP_CHK / 8];
|
static char rcvd_tbl[MAX_DUP_CHK / 8];
|
||||||
|
|
||||||
struct sockaddr_in6 dst; /* who to ping6 */
|
static struct sockaddr_in6 dst; /* who to ping6 */
|
||||||
struct sockaddr_in6 src; /* src addr of this packet */
|
static struct sockaddr_in6 src; /* src addr of this packet */
|
||||||
socklen_t srclen;
|
static socklen_t srclen;
|
||||||
int datalen = DEFDATALEN;
|
static size_t datalen = DEFDATALEN;
|
||||||
int s; /* socket file descriptor */
|
static int s; /* socket file descriptor */
|
||||||
u_char outpack[MAXPACKETLEN];
|
static u_char outpack[MAXPACKETLEN];
|
||||||
char BSPACE = '\b'; /* characters written for flood */
|
static char BSPACE = '\b'; /* characters written for flood */
|
||||||
char BBELL = '\a'; /* characters written for AUDIBLE */
|
static char BBELL = '\a'; /* characters written for AUDIBLE */
|
||||||
char DOT = '.';
|
static char DOT = '.';
|
||||||
char *hostname;
|
static char *hostname;
|
||||||
int ident; /* process id to identify our packets */
|
static int ident; /* process id to identify our packets */
|
||||||
u_int8_t nonce[8]; /* nonce field for node information */
|
static u_int8_t nonce[8]; /* nonce field for node information */
|
||||||
int hoplimit = -1; /* hoplimit */
|
static int hoplimit = -1; /* hoplimit */
|
||||||
int pathmtu = 0; /* path MTU for the destination. 0 = unspec. */
|
static u_char *packet = NULL;
|
||||||
u_char *packet = NULL;
|
|
||||||
|
|
||||||
/* counters */
|
/* counters */
|
||||||
long nmissedmax; /* max value of ntransmitted - nreceived - 1 */
|
static long nmissedmax; /* max value of ntransmitted - nreceived - 1 */
|
||||||
long npackets; /* max packets to transmit */
|
static long npackets; /* max packets to transmit */
|
||||||
long nreceived; /* # of packets we got back */
|
static long nreceived; /* # of packets we got back */
|
||||||
long nrepeats; /* number of duplicates */
|
static long nrepeats; /* number of duplicates */
|
||||||
long ntransmitted; /* sequence # for outbound packets = #sent */
|
static long ntransmitted; /* sequence # for outbound packets = #sent */
|
||||||
int interval = 1000; /* interval between packets in ms */
|
static int interval = 1000; /* interval between packets in ms */
|
||||||
int waittime = MAXWAIT; /* timeout for each packet */
|
static int waittime = MAXWAIT; /* timeout for each packet */
|
||||||
long nrcvtimeout = 0; /* # of packets we got back after waittime */
|
static long nrcvtimeout = 0; /* # of packets we got back after waittime */
|
||||||
|
|
||||||
/* timing */
|
/* timing */
|
||||||
int timing; /* flag to do timing */
|
static int timing; /* flag to do timing */
|
||||||
double tmin = 999999999.0; /* minimum round trip time */
|
static double tmin = 999999999.0; /* minimum round trip time */
|
||||||
double tmax = 0.0; /* maximum round trip time */
|
static double tmax = 0.0; /* maximum round trip time */
|
||||||
double tsum = 0.0; /* sum of all times, for doing average */
|
static double tsum = 0.0; /* sum of all times, for doing average */
|
||||||
double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
|
static double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
|
||||||
|
|
||||||
/* for node addresses */
|
/* for node addresses */
|
||||||
u_short naflags;
|
static u_short naflags;
|
||||||
|
|
||||||
/* for ancillary data(advanced API) */
|
/* for ancillary data(advanced API) */
|
||||||
struct msghdr smsghdr;
|
static struct msghdr smsghdr;
|
||||||
struct iovec smsgiov;
|
static struct iovec smsgiov;
|
||||||
char *scmsg = 0;
|
static char *scmsg = 0;
|
||||||
|
|
||||||
volatile sig_atomic_t seenint;
|
static volatile sig_atomic_t seenint;
|
||||||
#ifdef SIGINFO
|
#ifdef SIGINFO
|
||||||
volatile sig_atomic_t seeninfo;
|
static volatile sig_atomic_t seeninfo;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(int, char *[]);
|
int main(int, char *[]);
|
||||||
void fill(char *, char *);
|
static void fill(char *, char *);
|
||||||
int get_hoplim(struct msghdr *);
|
static int get_hoplim(struct msghdr *);
|
||||||
int get_pathmtu(struct msghdr *);
|
static int get_pathmtu(struct msghdr *);
|
||||||
struct in6_pktinfo *get_rcvpktinfo(struct msghdr *);
|
static struct in6_pktinfo *get_rcvpktinfo(struct msghdr *);
|
||||||
void onsignal(int);
|
static void onsignal(int);
|
||||||
void onint(int);
|
static void onint(int);
|
||||||
size_t pingerlen(void);
|
static size_t pingerlen(void);
|
||||||
int pinger(void);
|
static int pinger(void);
|
||||||
const char *pr_addr(struct sockaddr *, int);
|
static const char *pr_addr(struct sockaddr *, int);
|
||||||
void pr_icmph(struct icmp6_hdr *, u_char *);
|
static void pr_icmph(struct icmp6_hdr *, u_char *);
|
||||||
void pr_iph(struct ip6_hdr *);
|
static void pr_iph(struct ip6_hdr *);
|
||||||
void pr_suptypes(struct icmp6_nodeinfo *, size_t);
|
static void pr_suptypes(struct icmp6_nodeinfo *, size_t);
|
||||||
void pr_nodeaddr(struct icmp6_nodeinfo *, int);
|
static void pr_nodeaddr(struct icmp6_nodeinfo *, int);
|
||||||
int myechoreply(const struct icmp6_hdr *);
|
static int myechoreply(const struct icmp6_hdr *);
|
||||||
int mynireply(const struct icmp6_nodeinfo *);
|
static int mynireply(const struct icmp6_nodeinfo *);
|
||||||
char *dnsdecode(const u_char **, const u_char *, const u_char *,
|
static char *dnsdecode(const u_char **, const u_char *, const u_char *,
|
||||||
char *, size_t);
|
char *, size_t);
|
||||||
void pr_pack(u_char *, int, struct msghdr *);
|
static void pr_pack(u_char *, int, struct msghdr *);
|
||||||
void pr_exthdrs(struct msghdr *);
|
static void pr_exthdrs(struct msghdr *);
|
||||||
void pr_ip6opt(void *, size_t);
|
static void pr_ip6opt(void *, size_t);
|
||||||
void pr_rthdr(void *, size_t);
|
static void pr_rthdr(void *, size_t);
|
||||||
int pr_bitrange(u_int32_t, int, int);
|
static int pr_bitrange(u_int32_t, int, int);
|
||||||
void pr_retip(struct ip6_hdr *, u_char *);
|
static void pr_retip(struct ip6_hdr *, u_char *);
|
||||||
void summary(void);
|
static void summary(void);
|
||||||
void tvsub(struct timeval *, struct timeval *);
|
static void tvsub(struct timeval *, struct timeval *);
|
||||||
int setpolicy(int, char *);
|
static int setpolicy(int, char *);
|
||||||
char *nigroup(char *, int);
|
static char *nigroup(char *, int);
|
||||||
void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
@ -390,9 +389,9 @@ main(int argc, char *argv[])
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
e = NULL;
|
e = NULL;
|
||||||
lsockbufsize = strtoul(optarg, &e, 10);
|
lsockbufsize = strtoul(optarg, &e, 10);
|
||||||
sockbufsize = lsockbufsize;
|
sockbufsize = (int)lsockbufsize;
|
||||||
if (errno || !*optarg || *e ||
|
if (errno || !*optarg || *e ||
|
||||||
sockbufsize != lsockbufsize)
|
lsockbufsize > INT_MAX)
|
||||||
errx(1, "invalid socket buffer size");
|
errx(1, "invalid socket buffer size");
|
||||||
#else
|
#else
|
||||||
errx(1,
|
errx(1,
|
||||||
@ -751,7 +750,7 @@ main(int argc, char *argv[])
|
|||||||
*((int *)&nonce[i]) = rand();
|
*((int *)&nonce[i]) = rand();
|
||||||
#else
|
#else
|
||||||
memset(nonce, 0, sizeof(nonce));
|
memset(nonce, 0, sizeof(nonce));
|
||||||
for (i = 0; i < sizeof(nonce); i += sizeof(u_int32_t))
|
for (i = 0; i < (int)sizeof(nonce); i += sizeof(u_int32_t))
|
||||||
*((u_int32_t *)&nonce[i]) = arc4random();
|
*((u_int32_t *)&nonce[i]) = arc4random();
|
||||||
#endif
|
#endif
|
||||||
optval = 1;
|
optval = 1;
|
||||||
@ -1009,7 +1008,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
|
#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
|
||||||
if (sockbufsize) {
|
if (sockbufsize) {
|
||||||
if (datalen > sockbufsize)
|
if (datalen > (size_t)sockbufsize)
|
||||||
warnx("you need -b to increase socket buffer size");
|
warnx("you need -b to increase socket buffer size");
|
||||||
if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &sockbufsize,
|
if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &sockbufsize,
|
||||||
sizeof(sockbufsize)) < 0)
|
sizeof(sockbufsize)) < 0)
|
||||||
@ -1222,7 +1221,7 @@ main(int argc, char *argv[])
|
|||||||
exit(nreceived == 0 ? 2 : 0);
|
exit(nreceived == 0 ? 2 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
onsignal(int sig)
|
onsignal(int sig)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1247,7 +1246,7 @@ onsignal(int sig)
|
|||||||
* of the data portion are used to hold a UNIX "timeval" struct in VAX
|
* of the data portion are used to hold a UNIX "timeval" struct in VAX
|
||||||
* byte-order, to compute the round-trip time.
|
* byte-order, to compute the round-trip time.
|
||||||
*/
|
*/
|
||||||
size_t
|
static size_t
|
||||||
pingerlen(void)
|
pingerlen(void)
|
||||||
{
|
{
|
||||||
size_t l;
|
size_t l;
|
||||||
@ -1266,7 +1265,7 @@ pingerlen(void)
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
pinger(void)
|
pinger(void)
|
||||||
{
|
{
|
||||||
struct icmp6_hdr *icp;
|
struct icmp6_hdr *icp;
|
||||||
@ -1381,7 +1380,7 @@ pinger(void)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
myechoreply(const struct icmp6_hdr *icp)
|
myechoreply(const struct icmp6_hdr *icp)
|
||||||
{
|
{
|
||||||
if (ntohs(icp->icmp6_id) == ident)
|
if (ntohs(icp->icmp6_id) == ident)
|
||||||
@ -1390,7 +1389,7 @@ myechoreply(const struct icmp6_hdr *icp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
mynireply(const struct icmp6_nodeinfo *nip)
|
mynireply(const struct icmp6_nodeinfo *nip)
|
||||||
{
|
{
|
||||||
if (memcmp(nip->icmp6_ni_nonce + sizeof(u_int16_t),
|
if (memcmp(nip->icmp6_ni_nonce + sizeof(u_int16_t),
|
||||||
@ -1401,7 +1400,7 @@ mynireply(const struct icmp6_nodeinfo *nip)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
dnsdecode(const u_char **sp, const u_char *ep, const u_char *base, char *buf,
|
dnsdecode(const u_char **sp, const u_char *ep, const u_char *base, char *buf,
|
||||||
size_t bufsiz)
|
size_t bufsiz)
|
||||||
/*base for compressed name*/
|
/*base for compressed name*/
|
||||||
@ -1445,7 +1444,7 @@ dnsdecode(const u_char **sp, const u_char *ep, const u_char *base, char *buf,
|
|||||||
while (i-- > 0 && cp < ep) {
|
while (i-- > 0 && cp < ep) {
|
||||||
l = snprintf(cresult, sizeof(cresult),
|
l = snprintf(cresult, sizeof(cresult),
|
||||||
isprint(*cp) ? "%c" : "\\%03o", *cp & 0xff);
|
isprint(*cp) ? "%c" : "\\%03o", *cp & 0xff);
|
||||||
if (l >= sizeof(cresult) || l < 0)
|
if ((size_t)l >= sizeof(cresult) || l < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (strlcat(buf, cresult, bufsiz) >= bufsiz)
|
if (strlcat(buf, cresult, bufsiz) >= bufsiz)
|
||||||
return NULL; /*result overrun*/
|
return NULL; /*result overrun*/
|
||||||
@ -1468,7 +1467,7 @@ dnsdecode(const u_char **sp, const u_char *ep, const u_char *base, char *buf,
|
|||||||
* which arrive ('tis only fair). This permits multiple copies of this
|
* which arrive ('tis only fair). This permits multiple copies of this
|
||||||
* program to be run without having intermingled output (or statistics!).
|
* program to be run without having intermingled output (or statistics!).
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
pr_pack(u_char *buf, int cc, struct msghdr *mhdr)
|
pr_pack(u_char *buf, int cc, struct msghdr *mhdr)
|
||||||
{
|
{
|
||||||
#define safeputc(c) printf((isprint((c)) ? "%c" : "\\%03o"), c)
|
#define safeputc(c) printf((isprint((c)) ? "%c" : "\\%03o"), c)
|
||||||
@ -1500,7 +1499,7 @@ pr_pack(u_char *buf, int cc, struct msghdr *mhdr)
|
|||||||
}
|
}
|
||||||
from = (struct sockaddr *)mhdr->msg_name;
|
from = (struct sockaddr *)mhdr->msg_name;
|
||||||
fromlen = mhdr->msg_namelen;
|
fromlen = mhdr->msg_namelen;
|
||||||
if (cc < sizeof(struct icmp6_hdr)) {
|
if (cc < (int)sizeof(struct icmp6_hdr)) {
|
||||||
if (options & F_VERBOSE)
|
if (options & F_VERBOSE)
|
||||||
warnx("packet too short (%d bytes) from %s", cc,
|
warnx("packet too short (%d bytes) from %s", cc,
|
||||||
pr_addr(from, fromlen));
|
pr_addr(from, fromlen));
|
||||||
@ -1754,7 +1753,7 @@ pr_pack(u_char *buf, int cc, struct msghdr *mhdr)
|
|||||||
#undef safeputc
|
#undef safeputc
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
pr_exthdrs(struct msghdr *mhdr)
|
pr_exthdrs(struct msghdr *mhdr)
|
||||||
{
|
{
|
||||||
ssize_t bufsize;
|
ssize_t bufsize;
|
||||||
@ -1792,7 +1791,7 @@ pr_exthdrs(struct msghdr *mhdr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RFC2292BIS
|
#ifdef USE_RFC2292BIS
|
||||||
void
|
static void
|
||||||
pr_ip6opt(void *extbuf, size_t bufsize)
|
pr_ip6opt(void *extbuf, size_t bufsize)
|
||||||
{
|
{
|
||||||
struct ip6_hbh *ext;
|
struct ip6_hbh *ext;
|
||||||
@ -1855,7 +1854,7 @@ pr_ip6opt(void *extbuf, size_t bufsize)
|
|||||||
}
|
}
|
||||||
#else /* !USE_RFC2292BIS */
|
#else /* !USE_RFC2292BIS */
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
void
|
static void
|
||||||
pr_ip6opt(void *extbuf, size_t bufsize __unused)
|
pr_ip6opt(void *extbuf, size_t bufsize __unused)
|
||||||
{
|
{
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
@ -1864,7 +1863,7 @@ pr_ip6opt(void *extbuf, size_t bufsize __unused)
|
|||||||
#endif /* USE_RFC2292BIS */
|
#endif /* USE_RFC2292BIS */
|
||||||
|
|
||||||
#ifdef USE_RFC2292BIS
|
#ifdef USE_RFC2292BIS
|
||||||
void
|
static void
|
||||||
pr_rthdr(void *extbuf, size_t bufsize)
|
pr_rthdr(void *extbuf, size_t bufsize)
|
||||||
{
|
{
|
||||||
struct in6_addr *in6;
|
struct in6_addr *in6;
|
||||||
@ -1921,7 +1920,7 @@ pr_rthdr(void *extbuf, size_t bufsize)
|
|||||||
|
|
||||||
#else /* !USE_RFC2292BIS */
|
#else /* !USE_RFC2292BIS */
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
void
|
static void
|
||||||
pr_rthdr(void *extbuf, size_t bufsize __unused)
|
pr_rthdr(void *extbuf, size_t bufsize __unused)
|
||||||
{
|
{
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
@ -1929,7 +1928,7 @@ pr_rthdr(void *extbuf, size_t bufsize __unused)
|
|||||||
}
|
}
|
||||||
#endif /* USE_RFC2292BIS */
|
#endif /* USE_RFC2292BIS */
|
||||||
|
|
||||||
int
|
static int
|
||||||
pr_bitrange(u_int32_t v, int soff, int ii)
|
pr_bitrange(u_int32_t v, int soff, int ii)
|
||||||
{
|
{
|
||||||
int off;
|
int off;
|
||||||
@ -1975,7 +1974,7 @@ pr_bitrange(u_int32_t v, int soff, int ii)
|
|||||||
return ii;
|
return ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
pr_suptypes(struct icmp6_nodeinfo *ni, size_t nilen)
|
pr_suptypes(struct icmp6_nodeinfo *ni, size_t nilen)
|
||||||
/* ni->qtype must be SUPTYPES */
|
/* ni->qtype must be SUPTYPES */
|
||||||
{
|
{
|
||||||
@ -2041,7 +2040,7 @@ pr_suptypes(struct icmp6_nodeinfo *ni, size_t nilen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
pr_nodeaddr(struct icmp6_nodeinfo *ni, int nilen)
|
pr_nodeaddr(struct icmp6_nodeinfo *ni, int nilen)
|
||||||
/* ni->qtype must be NODEADDR */
|
/* ni->qtype must be NODEADDR */
|
||||||
{
|
{
|
||||||
@ -2107,7 +2106,7 @@ pr_nodeaddr(struct icmp6_nodeinfo *ni, int nilen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
get_hoplim(struct msghdr *mhdr)
|
get_hoplim(struct msghdr *mhdr)
|
||||||
{
|
{
|
||||||
struct cmsghdr *cm;
|
struct cmsghdr *cm;
|
||||||
@ -2126,7 +2125,7 @@ get_hoplim(struct msghdr *mhdr)
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct in6_pktinfo *
|
static struct in6_pktinfo *
|
||||||
get_rcvpktinfo(struct msghdr *mhdr)
|
get_rcvpktinfo(struct msghdr *mhdr)
|
||||||
{
|
{
|
||||||
struct cmsghdr *cm;
|
struct cmsghdr *cm;
|
||||||
@ -2145,7 +2144,7 @@ get_rcvpktinfo(struct msghdr *mhdr)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
get_pathmtu(struct msghdr *mhdr)
|
get_pathmtu(struct msghdr *mhdr)
|
||||||
{
|
{
|
||||||
#ifdef IPV6_RECVPATHMTU
|
#ifdef IPV6_RECVPATHMTU
|
||||||
@ -2205,7 +2204,7 @@ get_pathmtu(struct msghdr *mhdr)
|
|||||||
* Subtract 2 timeval structs: out = out - in. Out is assumed to
|
* Subtract 2 timeval structs: out = out - in. Out is assumed to
|
||||||
* be >= in.
|
* be >= in.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
tvsub(struct timeval *out, struct timeval *in)
|
tvsub(struct timeval *out, struct timeval *in)
|
||||||
{
|
{
|
||||||
if ((out->tv_usec -= in->tv_usec) < 0) {
|
if ((out->tv_usec -= in->tv_usec) < 0) {
|
||||||
@ -2220,7 +2219,7 @@ tvsub(struct timeval *out, struct timeval *in)
|
|||||||
* SIGINT handler.
|
* SIGINT handler.
|
||||||
*/
|
*/
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
void
|
static void
|
||||||
onint(int notused __unused)
|
onint(int notused __unused)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -2235,7 +2234,7 @@ onint(int notused __unused)
|
|||||||
* summary --
|
* summary --
|
||||||
* Print out statistics.
|
* Print out statistics.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
summary(void)
|
summary(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2285,7 +2284,7 @@ static const char *nircode[] = {
|
|||||||
* pr_icmph --
|
* pr_icmph --
|
||||||
* Print a descriptive string about an ICMP header.
|
* Print a descriptive string about an ICMP header.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
pr_icmph(struct icmp6_hdr *icp, u_char *end)
|
pr_icmph(struct icmp6_hdr *icp, u_char *end)
|
||||||
{
|
{
|
||||||
char ntop_buf[INET6_ADDRSTRLEN];
|
char ntop_buf[INET6_ADDRSTRLEN];
|
||||||
@ -2515,7 +2514,7 @@ pr_icmph(struct icmp6_hdr *icp, u_char *end)
|
|||||||
* pr_iph --
|
* pr_iph --
|
||||||
* Print an IP6 header.
|
* Print an IP6 header.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
pr_iph(struct ip6_hdr *ip6)
|
pr_iph(struct ip6_hdr *ip6)
|
||||||
{
|
{
|
||||||
u_int32_t flow = ip6->ip6_flow & IPV6_FLOWLABEL_MASK;
|
u_int32_t flow = ip6->ip6_flow & IPV6_FLOWLABEL_MASK;
|
||||||
@ -2543,7 +2542,7 @@ pr_iph(struct ip6_hdr *ip6)
|
|||||||
* Return an ascii host address as a dotted quad and optionally with
|
* Return an ascii host address as a dotted quad and optionally with
|
||||||
* a hostname.
|
* a hostname.
|
||||||
*/
|
*/
|
||||||
const char *
|
static const char *
|
||||||
pr_addr(struct sockaddr *addr, int addrlen)
|
pr_addr(struct sockaddr *addr, int addrlen)
|
||||||
{
|
{
|
||||||
static char buf[NI_MAXHOST];
|
static char buf[NI_MAXHOST];
|
||||||
@ -2562,13 +2561,13 @@ pr_addr(struct sockaddr *addr, int addrlen)
|
|||||||
* pr_retip --
|
* pr_retip --
|
||||||
* Dump some info on a returned (via ICMPv6) IPv6 packet.
|
* Dump some info on a returned (via ICMPv6) IPv6 packet.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
pr_retip(struct ip6_hdr *ip6, u_char *end)
|
pr_retip(struct ip6_hdr *ip6, u_char *end)
|
||||||
{
|
{
|
||||||
u_char *cp = (u_char *)ip6, nh;
|
u_char *cp = (u_char *)ip6, nh;
|
||||||
int hlen;
|
int hlen;
|
||||||
|
|
||||||
if (end - (u_char *)ip6 < sizeof(*ip6)) {
|
if ((size_t)(end - (u_char *)ip6) < sizeof(*ip6)) {
|
||||||
printf("IP6");
|
printf("IP6");
|
||||||
goto trunc;
|
goto trunc;
|
||||||
}
|
}
|
||||||
@ -2642,7 +2641,7 @@ pr_retip(struct ip6_hdr *ip6, u_char *end)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
fill(char *bp, char *patp)
|
fill(char *bp, char *patp)
|
||||||
{
|
{
|
||||||
int ii, jj, kk;
|
int ii, jj, kk;
|
||||||
@ -2661,7 +2660,7 @@ fill(char *bp, char *patp)
|
|||||||
/* xxx */
|
/* xxx */
|
||||||
if (ii > 0)
|
if (ii > 0)
|
||||||
for (kk = 0;
|
for (kk = 0;
|
||||||
kk <= MAXDATALEN - (8 + sizeof(struct tv32) + ii);
|
(size_t)kk <= MAXDATALEN - 8 + sizeof(struct tv32) + ii;
|
||||||
kk += ii)
|
kk += ii)
|
||||||
for (jj = 0; jj < ii; ++jj)
|
for (jj = 0; jj < ii; ++jj)
|
||||||
bp[jj + kk] = pat[jj];
|
bp[jj + kk] = pat[jj];
|
||||||
@ -2675,7 +2674,7 @@ fill(char *bp, char *patp)
|
|||||||
|
|
||||||
#ifdef IPSEC
|
#ifdef IPSEC
|
||||||
#ifdef IPSEC_POLICY_IPSEC
|
#ifdef IPSEC_POLICY_IPSEC
|
||||||
int
|
static int
|
||||||
setpolicy(int so __unused, char *policy)
|
setpolicy(int so __unused, char *policy)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
@ -2696,7 +2695,7 @@ setpolicy(int so __unused, char *policy)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
nigroup(char *name, int nig_oldmcprefix)
|
nigroup(char *name, int nig_oldmcprefix)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
@ -2755,7 +2754,7 @@ nigroup(char *name, int nig_oldmcprefix)
|
|||||||
return strdup(hbuf);
|
return strdup(hbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
|
Loading…
Reference in New Issue
Block a user