Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/ping6 static + __dead + G/C pathmtu
details: https://anonhg.NetBSD.org/src/rev/4f9f9c6cb2d8
branches: trunk
changeset: 768821:4f9f9c6cb2d8
user: joerg <joerg%NetBSD.org@localhost>
date: Sat Aug 27 18:43:24 2011 +0000
description:
static + __dead + G/C pathmtu
diffstat:
sbin/ping6/ping6.c | 183 ++++++++++++++++++++++++++--------------------------
1 files changed, 91 insertions(+), 92 deletions(-)
diffs (truncated from 421 to 300 lines):
diff -r 8fd751b38764 -r 4f9f9c6cb2d8 sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c Sat Aug 27 18:37:41 2011 +0000
+++ b/sbin/ping6/ping6.c Sat Aug 27 18:43:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ping6.c,v 1.74 2011/08/14 12:09:35 christos Exp $ */
+/* $NetBSD: ping6.c,v 1.75 2011/08/27 18:43:24 joerg Exp $ */
/* $KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $ */
/*
@@ -77,7 +77,7 @@
#else
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.74 2011/08/14 12:09:35 christos Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.75 2011/08/27 18:43:24 joerg Exp $");
#endif
#endif
@@ -189,7 +189,7 @@
#define F_SUPTYPES 0x80000
#define F_NOMINMTU 0x100000
#define F_NOUSERDATA (F_NODEADDR | F_FQDN | F_FQDNOLD | F_SUPTYPES)
-u_int options;
+static u_int options;
#define IN6LEN sizeof(struct in6_addr)
#define SA6LEN sizeof(struct sockaddr_in6)
@@ -203,81 +203,80 @@
* to 8192 for complete accuracy...
*/
#define MAX_DUP_CHK (8 * 8192)
-int mx_dup_ck = MAX_DUP_CHK;
-char rcvd_tbl[MAX_DUP_CHK / 8];
+static int mx_dup_ck = MAX_DUP_CHK;
+static char rcvd_tbl[MAX_DUP_CHK / 8];
-struct addrinfo *res;
-struct sockaddr_in6 dst; /* who to ping6 */
-struct sockaddr_in6 src; /* src addr of this packet */
-socklen_t srclen;
-int datalen = DEFDATALEN;
-int s; /* socket file descriptor */
-u_char outpack[MAXPACKETLEN];
-char BSPACE = '\b'; /* characters written for flood */
-char DOT = '.';
-char *hostname;
-int ident; /* process id to identify our packets */
-u_int8_t nonce[8]; /* nonce field for node information */
-int hoplimit = -1; /* hoplimit */
-int pathmtu = 0; /* path MTU for the destination. 0 = unspec. */
+static struct addrinfo *res;
+static struct sockaddr_in6 dst; /* who to ping6 */
+static struct sockaddr_in6 src; /* src addr of this packet */
+static socklen_t srclen;
+static int datalen = DEFDATALEN;
+static int s; /* socket file descriptor */
+static u_char outpack[MAXPACKETLEN];
+static char BSPACE = '\b'; /* characters written for flood */
+static char DOT = '.';
+static char *hostname;
+static int ident; /* process id to identify our packets */
+static u_int8_t nonce[8]; /* nonce field for node information */
+static int hoplimit = -1; /* hoplimit */
/* counters */
-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 */
-struct timeval interval = {1, 0}; /* interval between packets */
+static long npackets; /* max packets to transmit */
+static long nreceived; /* # of packets we got back */
+static long nrepeats; /* number of duplicates */
+static long ntransmitted; /* sequence # for outbound packets = #sent */
+static struct timeval interval = {1, 0}; /* interval between packets */
/* timing */
-int timing; /* flag to do timing */
-double tmin = 999999999.0; /* minimum round trip time */
-double tmax = 0.0; /* maximum round trip time */
-double tsum = 0.0; /* sum of all times, for doing average */
-double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
+static int timing; /* flag to do timing */
+static double tmin = 999999999.0; /* minimum round trip time */
+static double tmax = 0.0; /* maximum round trip time */
+static double tsum = 0.0; /* sum of all times, for doing average */
+static double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
/* for node addresses */
-u_short naflags;
+static u_short naflags;
/* for ancillary data(advanced API) */
-struct msghdr smsghdr;
-struct iovec smsgiov;
-char *scmsg = 0;
+static struct msghdr smsghdr;
+static struct iovec smsgiov;
+static char *scmsg = 0;
-volatile sig_atomic_t seenalrm;
-volatile sig_atomic_t seenint;
+static volatile sig_atomic_t seenalrm;
+static volatile sig_atomic_t seenint;
#ifdef SIGINFO
-volatile sig_atomic_t seeninfo;
+static volatile sig_atomic_t seeninfo;
#endif
-void fill(char *, char *);
-int get_hoplim(struct msghdr *);
-int get_pathmtu(struct msghdr *);
-struct in6_pktinfo *get_rcvpktinfo(struct msghdr *);
-void onsignal(int);
-void retransmit(void);
-void onint(int);
-size_t pingerlen(void);
-int pinger(void);
-const char *pr_addr(struct sockaddr *, int);
-void pr_icmph(struct icmp6_hdr *, u_char *);
-void pr_iph(struct ip6_hdr *);
-void pr_suptypes(struct icmp6_nodeinfo *, size_t);
-void pr_nodeaddr(struct icmp6_nodeinfo *, int);
-int myechoreply(const struct icmp6_hdr *);
-int mynireply(const struct icmp6_nodeinfo *);
-char *dnsdecode(const u_char **, const u_char *, const u_char *,
+static void fill(char *, char *);
+static int get_hoplim(struct msghdr *);
+static int get_pathmtu(struct msghdr *);
+static struct in6_pktinfo *get_rcvpktinfo(struct msghdr *);
+static void onsignal(int);
+static void retransmit(void);
+__dead static void onint(int);
+static size_t pingerlen(void);
+static int pinger(void);
+static const char *pr_addr(struct sockaddr *, int);
+static void pr_icmph(struct icmp6_hdr *, u_char *);
+static void pr_iph(struct ip6_hdr *);
+static void pr_suptypes(struct icmp6_nodeinfo *, size_t);
+static void pr_nodeaddr(struct icmp6_nodeinfo *, int);
+static int myechoreply(const struct icmp6_hdr *);
+static int mynireply(const struct icmp6_nodeinfo *);
+static char *dnsdecode(const u_char **, const u_char *, const u_char *,
char *, size_t);
-void pr_pack(u_char *, int, struct msghdr *);
-void pr_exthdrs(struct msghdr *);
-void pr_ip6opt(void *);
-void pr_rthdr(void *);
-int pr_bitrange(u_int32_t, int, int);
-void pr_retip(struct ip6_hdr *, u_char *);
-void summary(void);
-void tvsub(struct timeval *, struct timeval *);
-int setpolicy(int, char *);
-char *nigroup(char *);
-void usage(void);
+static void pr_pack(u_char *, int, struct msghdr *);
+static void pr_exthdrs(struct msghdr *);
+static void pr_ip6opt(void *);
+static void pr_rthdr(void *);
+static int pr_bitrange(u_int32_t, int, int);
+static void pr_retip(struct ip6_hdr *, u_char *);
+static void summary(void);
+static void tvsub(struct timeval *, struct timeval *);
+static int setpolicy(int, char *);
+static char *nigroup(char *);
+__dead static void usage(void);
int
main(int argc, char *argv[])
@@ -1107,7 +1106,7 @@
exit(nreceived == 0);
}
-void
+static void
onsignal(int sig)
{
@@ -1130,7 +1129,7 @@
* retransmit --
* This routine transmits another ping6.
*/
-void
+static void
retransmit(void)
{
struct itimerval itimer;
@@ -1166,7 +1165,7 @@
* of the data portion are used to hold a UNIX "timeval" struct in VAX
* byte-order, to compute the round-trip time.
*/
-size_t
+static size_t
pingerlen(void)
{
size_t l;
@@ -1185,7 +1184,7 @@
return l;
}
-int
+static int
pinger(void)
{
struct icmp6_hdr *icp;
@@ -1287,7 +1286,7 @@
return(0);
}
-int
+static int
myechoreply(const struct icmp6_hdr *icp)
{
if (ntohs(icp->icmp6_id) == ident)
@@ -1296,7 +1295,7 @@
return 0;
}
-int
+static int
mynireply(const struct icmp6_nodeinfo *nip)
{
if (memcmp(nip->icmp6_ni_nonce + sizeof(u_int16_t),
@@ -1307,7 +1306,7 @@
return 0;
}
-char *
+static char *
dnsdecode(const u_char **sp, const u_char *ep, const u_char *base, char *buf,
size_t bufsiz)
{
@@ -1375,7 +1374,7 @@
* which arrive ('tis only fair). This permits multiple copies of this
* program to be run without having intermingled output (or statistics!).
*/
-void
+static void
pr_pack(u_char *buf, int cc, struct msghdr *mhdr)
{
#define safeputc(c) printf((isprint((c)) ? "%c" : "\\%03o"), c)
@@ -1654,7 +1653,7 @@
#undef safeputc
}
-void
+static void
pr_exthdrs(struct msghdr *mhdr)
{
struct cmsghdr *cm;
@@ -1684,7 +1683,7 @@
}
}
-void
+static void
pr_ip6opt(void *extbuf)
{
struct ip6_hbh *ext;
@@ -1736,7 +1735,7 @@
return;
}
-void
+static void
pr_rthdr(void *extbuf)
{
struct in6_addr *in6;
@@ -1769,7 +1768,7 @@
}
-int
+static int
pr_bitrange(u_int32_t v, int soff, int ii)
{
int off;
@@ -1815,7 +1814,7 @@
return ii;
}
-void
+static void
pr_suptypes(struct icmp6_nodeinfo *ni /* ni->qtype must be SUPTYPES */,
size_t nilen)
{
@@ -1881,7 +1880,7 @@
}
}
-void
+static void
pr_nodeaddr(struct icmp6_nodeinfo *ni, /* ni->qtype must be NODEADDR */
int nilen)
{
@@ -1947,7 +1946,7 @@
}
}
-int
Home |
Main Index |
Thread Index |
Old Index