summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/netstat/atalk.c4
-rw-r--r--usr.bin/netstat/bpf.c8
-rw-r--r--usr.bin/netstat/if.c37
-rw-r--r--usr.bin/netstat/inet.c72
-rw-r--r--usr.bin/netstat/inet6.c114
-rw-r--r--usr.bin/netstat/ipsec.c27
-rw-r--r--usr.bin/netstat/ipx.c14
-rw-r--r--usr.bin/netstat/main.c56
-rw-r--r--usr.bin/netstat/mbuf.c4
-rw-r--r--usr.bin/netstat/mcast.c4
-rw-r--r--usr.bin/netstat/mroute.c8
-rw-r--r--usr.bin/netstat/mroute6.c5
-rw-r--r--usr.bin/netstat/netgraph.c6
-rw-r--r--usr.bin/netstat/netstat.h12
-rw-r--r--usr.bin/netstat/pfkey.c21
-rw-r--r--usr.bin/netstat/route.c36
-rw-r--r--usr.bin/netstat/sctp.c73
-rw-r--r--usr.bin/netstat/unix.c6
18 files changed, 251 insertions, 256 deletions
diff --git a/usr.bin/netstat/atalk.c b/usr.bin/netstat/atalk.c
index 7c19c56..9ed4820 100644
--- a/usr.bin/netstat/atalk.c
+++ b/usr.bin/netstat/atalk.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -260,7 +260,7 @@ atalkprotopr(u_long off __unused, const char *name, int af1 __unused,
}
}
-#define ANY(x,y,z) if (x || sflag <= 1) \
+#define ANY(x,y,z) if (x || sflag <= 1) \
printf("\t%lu %s%s%s\n",x,y,plural(x),z)
/*
diff --git a/usr.bin/netstat/bpf.c b/usr.bin/netstat/bpf.c
index 73cc018..0b79a76 100644
--- a/usr.bin/netstat/bpf.c
+++ b/usr.bin/netstat/bpf.c
@@ -22,9 +22,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/types.h>
#include <sys/protosw.h>
#include <sys/socket.h>
@@ -84,7 +86,7 @@ bpf_flags(struct xbpf_d *bd, char *flagbuf)
*flagbuf++ = bd->bd_async ? 'a' : '-';
*flagbuf++ = bd->bd_locked ? 'l' : '-';
*flagbuf++ = '\0';
-}
+}
void
bpf_stats(char *ifname)
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index 9acd37c..aa28a6f 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -82,7 +82,7 @@ static void catchalarm(int);
static char ntop_buf[INET6_ADDRSTRLEN]; /* for inet_ntop() */
#endif
-/*
+/*
* Dump pfsync statistics structure.
*/
void
@@ -105,9 +105,9 @@ pfsync_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
printf("%s:\n", name);
-#define p(f, m) if (pfsyncstat.f || sflag <= 1) \
+#define p(f, m) if (pfsyncstat.f || sflag <= 1) \
printf(m, (uintmax_t)pfsyncstat.f, plural(pfsyncstat.f))
-#define p2(f, m) if (pfsyncstat.f || sflag <= 1) \
+#define p2(f, m) if (pfsyncstat.f || sflag <= 1) \
printf(m, (uintmax_t)pfsyncstat.f)
p(pfsyncs_ipackets, "\t%ju packet%s received (IPv4)\n");
@@ -214,10 +214,10 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
sidewaysintpr(interval1, ifnetaddr);
return;
}
- if (kread(ifnetaddr, (char *)&ifnethead, sizeof ifnethead))
+ if (kread(ifnetaddr, (char *)&ifnethead, sizeof ifnethead) != 0)
return;
ifnetaddr = (u_long)TAILQ_FIRST(&ifnethead);
- if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet))
+ if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet) != 0)
return;
if (!pfunc) {
@@ -253,11 +253,11 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
if (ifaddraddr == 0) {
ifnetfound = ifnetaddr;
- if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet))
+ if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet) != 0)
return;
strlcpy(name, ifnet.if_xname, sizeof(name));
ifnetaddr = (u_long)TAILQ_NEXT(&ifnet, if_link);
- if (interface != 0 && (strcmp(name, interface) != 0))
+ if (interface != 0 && strcmp(name, interface) != 0)
continue;
cp = index(name, '\0');
@@ -298,11 +298,12 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
printf("%-13.13s ", "none");
printf("%-17.17s ", "none");
} else {
- if (kread(ifaddraddr, (char *)&ifaddr, sizeof ifaddr)) {
+ if (kread(ifaddraddr, (char *)&ifaddr, sizeof ifaddr)
+ != 0) {
ifaddraddr = 0;
continue;
}
-#define CP(x) ((char *)(x))
+#define CP(x) ((char *)(x))
cp = (CP(ifaddr.ifa.ifa_addr) - CP(ifaddraddr)) +
CP(&ifaddr);
sa = (struct sockaddr *)cp;
@@ -455,15 +456,15 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
TAILQ_FOREACH(multiaddr, &ifnet.if_multiaddrs, ifma_link) {
if (kread((u_long)multiaddr, (char *)&ifma,
- sizeof ifma))
+ sizeof ifma) != 0)
break;
multiaddr = &ifma;
if (kread((u_long)ifma.ifma_addr, (char *)&msa,
- sizeof msa))
+ sizeof msa) != 0)
break;
if (msa.sa.sa_family != sa->sa_family)
continue;
-
+
fmt = 0;
switch (msa.sa.sa_family) {
case AF_INET:
@@ -541,7 +542,7 @@ sidewaysintpr(int interval1, u_long off)
int oldmask, first;
u_long interesting_off;
- if (kread(off, (char *)&ifnethead, sizeof ifnethead))
+ if (kread(off, (char *)&ifnethead, sizeof ifnethead) != 0)
return;
firstifnet = (u_long)TAILQ_FIRST(&ifnethead);
@@ -556,7 +557,7 @@ sidewaysintpr(int interval1, u_long off)
for (off = firstifnet, ip = iftot; off;) {
char name[IFNAMSIZ];
- if (kread(off, (char *)&ifnet, sizeof ifnet))
+ if (kread(off, (char *)&ifnet, sizeof ifnet) != 0)
break;
strlcpy(name, ifnet.if_xname, sizeof(name));
if (interface && strcmp(name, interface) == 0) {
@@ -607,7 +608,7 @@ banner:
loop:
if (interesting != NULL) {
ip = interesting;
- if (kread(interesting_off, (char *)&ifnet, sizeof ifnet)) {
+ if (kread(interesting_off, (char *)&ifnet, sizeof ifnet) != 0) {
printf("???\n");
exit(1);
};
@@ -618,7 +619,7 @@ loop:
show_stat("lu", 10, ifnet.if_opackets - ip->ift_op, 1);
show_stat("lu", 5, ifnet.if_oerrors - ip->ift_oe, 1);
show_stat("lu", 10, ifnet.if_obytes - ip->ift_ob, 1);
- show_stat("NRSlu", 5,
+ show_stat("NRSlu", 5,
ifnet.if_collisions - ip->ift_co, 1);
if (dflag)
show_stat("LSu", 5,
@@ -644,7 +645,7 @@ loop:
for (off = firstifnet, ip = iftot;
off && SLIST_NEXT(ip, chain) != NULL;
ip = SLIST_NEXT(ip, chain)) {
- if (kread(off, (char *)&ifnet, sizeof ifnet)) {
+ if (kread(off, (char *)&ifnet, sizeof ifnet) != 0) {
off = 0;
continue;
}
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 7230d47..11d461b 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1983, 1988, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
@@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/tcp.h>
#include <netinet/tcpip.h>
#include <netinet/tcp_seq.h>
-#define TCPSTATES
+#define TCPSTATES
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
@@ -85,8 +85,8 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include "netstat.h"
-char *inetname (struct in_addr *);
-void inetprint (struct in_addr *, int, const char *, int);
+char *inetname(struct in_addr *);
+void inetprint(struct in_addr *, int, const char *, int);
#ifdef INET6
static int udp_done, tcp_done;
#endif /* INET6 */
@@ -210,7 +210,7 @@ pcblist_kvm(u_long off, char **bufp, int istcp)
}
p = buf;
-#define COPYOUT(obj, size) do { \
+#define COPYOUT(obj, size) do { \
if (len < (size)) { \
warnx("buffer size exceeded"); \
goto fail; \
@@ -220,7 +220,7 @@ pcblist_kvm(u_long off, char **bufp, int istcp)
p += (size); \
} while (0)
-#define KREAD(off, buf, len) do { \
+#define KREAD(off, buf, len) do { \
if (kread((uintptr_t)(off), (buf), (len)) != 0) \
goto fail; \
} while (0)
@@ -274,7 +274,7 @@ pcblist_kvm(u_long off, char **bufp, int istcp)
if (istcp)
COPYOUT(&xt, sizeof xt);
else
- COPYOUT(&xi, sizeof xi);
+ COPYOUT(&xi, sizeof xi);
}
/* Reread the pcbinfo and write out the footer. */
@@ -282,7 +282,7 @@ pcblist_kvm(u_long off, char **bufp, int istcp)
xig.xig_count = pcbinfo.ipi_count;
xig.xig_gen = pcbinfo.ipi_gencnt;
COPYOUT(&xig, sizeof xig);
-
+
*bufp = buf;
return (1);
@@ -613,7 +613,7 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
p2(tcps_closed, tcps_drops,
"\t%lu connection%s closed (including %lu drop%s)\n");
p(tcps_cachedrtt, "\t\t%lu connection%s updated cached RTT on close\n");
- p(tcps_cachedrttvar,
+ p(tcps_cachedrttvar,
"\t\t%lu connection%s updated cached RTT variance on close\n");
p(tcps_cachedssthresh,
"\t\t%lu connection%s updated cached ssthresh on close\n");
@@ -624,7 +624,7 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
p(tcps_timeoutdrop, "\t\t%lu connection%s dropped by rexmit timeout\n");
p(tcps_persisttimeo, "\t%lu persist timeout%s\n");
p(tcps_persistdrop, "\t\t%lu connection%s dropped by persist timeout\n");
- p(tcps_finwait2_drops, "\t%lu Connection%s (fin_wait_2) dropped because of timeout\n");
+ p(tcps_finwait2_drops, "\t%lu Connection%s (fin_wait_2) dropped because of timeout\n");
p(tcps_keeptimeo, "\t%lu keepalive timeout%s\n");
p(tcps_keepprobe, "\t\t%lu keepalive probe%s sent\n");
p(tcps_keepdrops, "\t\t%lu connection%s dropped by keepalive\n");
@@ -632,30 +632,30 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
p(tcps_preddat, "\t%lu correct data packet header prediction%s\n");
p3(tcps_sc_added, "\t%lu syncache entr%s added\n");
- p1a(tcps_sc_retransmitted, "\t\t%lu retransmitted\n");
- p1a(tcps_sc_dupsyn, "\t\t%lu dupsyn\n");
- p1a(tcps_sc_dropped, "\t\t%lu dropped\n");
- p1a(tcps_sc_completed, "\t\t%lu completed\n");
- p1a(tcps_sc_bucketoverflow, "\t\t%lu bucket overflow\n");
- p1a(tcps_sc_cacheoverflow, "\t\t%lu cache overflow\n");
- p1a(tcps_sc_reset, "\t\t%lu reset\n");
- p1a(tcps_sc_stale, "\t\t%lu stale\n");
- p1a(tcps_sc_aborted, "\t\t%lu aborted\n");
- p1a(tcps_sc_badack, "\t\t%lu badack\n");
- p1a(tcps_sc_unreach, "\t\t%lu unreach\n");
- p(tcps_sc_zonefail, "\t\t%lu zone failure%s\n");
- p(tcps_sc_sendcookie, "\t%lu cookie%s sent\n");
- p(tcps_sc_recvcookie, "\t%lu cookie%s received\n");
-
- p(tcps_sack_recovery_episode, "\t%lu SACK recovery episode%s\n");
+ p1a(tcps_sc_retransmitted, "\t\t%lu retransmitted\n");
+ p1a(tcps_sc_dupsyn, "\t\t%lu dupsyn\n");
+ p1a(tcps_sc_dropped, "\t\t%lu dropped\n");
+ p1a(tcps_sc_completed, "\t\t%lu completed\n");
+ p1a(tcps_sc_bucketoverflow, "\t\t%lu bucket overflow\n");
+ p1a(tcps_sc_cacheoverflow, "\t\t%lu cache overflow\n");
+ p1a(tcps_sc_reset, "\t\t%lu reset\n");
+ p1a(tcps_sc_stale, "\t\t%lu stale\n");
+ p1a(tcps_sc_aborted, "\t\t%lu aborted\n");
+ p1a(tcps_sc_badack, "\t\t%lu badack\n");
+ p1a(tcps_sc_unreach, "\t\t%lu unreach\n");
+ p(tcps_sc_zonefail, "\t\t%lu zone failure%s\n");
+ p(tcps_sc_sendcookie, "\t%lu cookie%s sent\n");
+ p(tcps_sc_recvcookie, "\t%lu cookie%s received\n");
+
+ p(tcps_sack_recovery_episode, "\t%lu SACK recovery episode%s\n");
p(tcps_sack_rexmits,
"\t%lu segment rexmit%s in SACK recovery episodes\n");
p(tcps_sack_rexmit_bytes,
- "\t%lu byte rexmit%s in SACK recovery episodes\n");
+ "\t%lu byte rexmit%s in SACK recovery episodes\n");
p(tcps_sack_rcv_blocks,
- "\t%lu SACK option%s (SACK blocks) received\n");
- p(tcps_sack_send_blocks, "\t%lu SACK option%s (SACK blocks) sent\n");
- p1a(tcps_sack_sboverflow, "\t%lu SACK scoreboard overflow\n");
+ "\t%lu SACK option%s (SACK blocks) received\n");
+ p(tcps_sack_send_blocks, "\t%lu SACK option%s (SACK blocks) sent\n");
+ p1a(tcps_sack_sboverflow, "\t%lu SACK scoreboard overflow\n");
#undef p
#undef p1a
@@ -724,7 +724,7 @@ udp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
#undef p1a
}
-/*
+/*
* Dump CARP statistics structure.
*/
void
@@ -750,9 +750,9 @@ carp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
printf("%s:\n", name);
-#define p(f, m) if (carpstat.f || sflag <= 1) \
+#define p(f, m) if (carpstat.f || sflag <= 1) \
printf(m, (uintmax_t)carpstat.f, plural(carpstat.f))
-#define p2(f, m) if (carpstat.f || sflag <= 1) \
+#define p2(f, m) if (carpstat.f || sflag <= 1) \
printf(m, (uintmax_t)carpstat.f)
p(carps_ipackets, "\t%ju packet%s received (IPv4)\n");
@@ -819,7 +819,7 @@ ip_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
p(ips_noproto, "\t%lu packet%s for unknown/unsupported protocol\n");
p(ips_forward, "\t%lu packet%s forwarded");
p(ips_fastforward, " (%lu packet%s fast forwarded)");
- if (ipstat.ips_forward || sflag <= 1)
+ if (ipstat.ips_forward || sflag <= 1)
putchar('\n');
p(ips_cantforward, "\t%lu packet%s not forwardable\n");
p(ips_notmember,
@@ -960,7 +960,7 @@ icmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
if (sysctlbyname("net.inet.icmp.maskrepl", &i, &len, NULL, 0) <
0)
return;
- printf("\tICMP address mask responses are %sabled\n",
+ printf("\tICMP address mask responses are %sabled\n",
i ? "en" : "dis");
}
}
@@ -1116,7 +1116,7 @@ inetname(struct in_addr *inp)
line[sizeof(line) - 1] = '\0';
} else {
inp->s_addr = ntohl(inp->s_addr);
-#define C(x) ((u_int)((x) & 0xff))
+#define C(x) ((u_int)((x) & 0xff))
sprintf(line, "%u.%u.%u.%u", C(inp->s_addr >> 24),
C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr));
}
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c
index 945075c..ef9bbca 100644
--- a/usr.bin/netstat/inet6.c
+++ b/usr.bin/netstat/inet6.c
@@ -1,5 +1,5 @@
/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
-/*
+/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -100,7 +100,7 @@ static const char *ip6nh[] = {
"#16",
"UDP",
"#18",
- "#19",
+ "#19",
"#20",
"#21",
"IDP",
@@ -110,7 +110,7 @@ static const char *ip6nh[] = {
"#26",
"#27",
"#28",
- "TP",
+ "TP",
"#30",
"#31",
"#32",
@@ -120,7 +120,7 @@ static const char *ip6nh[] = {
"#36",
"#37",
"#38",
- "#39",
+ "#39",
"#40",
"IP6",
"#42",
@@ -130,7 +130,7 @@ static const char *ip6nh[] = {
"#46",
"#47",
"#48",
- "#49",
+ "#49",
"ESP",
"AH",
"#52",
@@ -140,7 +140,7 @@ static const char *ip6nh[] = {
"#56",
"#57",
"ICMP6",
- "no next header",
+ "no next header",
"destination option",
"#61",
"mobility",
@@ -150,7 +150,7 @@ static const char *ip6nh[] = {
"#66",
"#67",
"#68",
- "#69",
+ "#69",
"#70",
"#71",
"#72",
@@ -160,7 +160,7 @@ static const char *ip6nh[] = {
"#76",
"#77",
"#78",
- "#79",
+ "#79",
"ISOIP",
"#81",
"#82",
@@ -170,7 +170,7 @@ static const char *ip6nh[] = {
"#86",
"#87",
"#88",
- "OSPF",
+ "OSPF",
"#80",
"#91",
"#92",
@@ -180,7 +180,7 @@ static const char *ip6nh[] = {
"#96",
"Ethernet",
"#98",
- "#99",
+ "#99",
"#100",
"#101",
"#102",
@@ -190,7 +190,7 @@ static const char *ip6nh[] = {
"#106",
"#107",
"#108",
- "#109",
+ "#109",
"#110",
"#111",
"#112",
@@ -200,7 +200,7 @@ static const char *ip6nh[] = {
"#116",
"#117",
"#118",
- "#119",
+ "#119",
"#120",
"#121",
"#122",
@@ -210,7 +210,7 @@ static const char *ip6nh[] = {
"#126",
"#127",
"#128",
- "#129",
+ "#129",
"#130",
"#131",
"#132",
@@ -220,7 +220,7 @@ static const char *ip6nh[] = {
"#136",
"#137",
"#138",
- "#139",
+ "#139",
"#140",
"#141",
"#142",
@@ -230,7 +230,7 @@ static const char *ip6nh[] = {
"#146",
"#147",
"#148",
- "#149",
+ "#149",
"#150",
"#151",
"#152",
@@ -240,7 +240,7 @@ static const char *ip6nh[] = {
"#156",
"#157",
"#158",
- "#159",
+ "#159",
"#160",
"#161",
"#162",
@@ -250,7 +250,7 @@ static const char *ip6nh[] = {
"#166",
"#167",
"#168",
- "#169",
+ "#169",
"#170",
"#171",
"#172",
@@ -260,7 +260,7 @@ static const char *ip6nh[] = {
"#176",
"#177",
"#178",
- "#179",
+ "#179",
"#180",
"#181",
"#182",
@@ -270,7 +270,7 @@ static const char *ip6nh[] = {
"#186",
"#187",
"#188",
- "#189",
+ "#189",
"#180",
"#191",
"#192",
@@ -280,7 +280,7 @@ static const char *ip6nh[] = {
"#196",
"#197",
"#198",
- "#199",
+ "#199",
"#200",
"#201",
"#202",
@@ -290,7 +290,7 @@ static const char *ip6nh[] = {
"#206",
"#207",
"#208",
- "#209",
+ "#209",
"#210",
"#211",
"#212",
@@ -300,7 +300,7 @@ static const char *ip6nh[] = {
"#216",
"#217",
"#218",
- "#219",
+ "#219",
"#220",
"#221",
"#222",
@@ -310,7 +310,7 @@ static const char *ip6nh[] = {
"#226",
"#227",
"#228",
- "#229",
+ "#229",
"#230",
"#231",
"#232",
@@ -320,7 +320,7 @@ static const char *ip6nh[] = {
"#236",
"#237",
"#238",
- "#239",
+ "#239",
"#240",
"#241",
"#242",
@@ -330,7 +330,7 @@ static const char *ip6nh[] = {
"#246",
"#247",
"#248",
- "#249",
+ "#249",
"#250",
"#251",
"#252",
@@ -423,7 +423,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
printf("\t\t%ju one mbuf\n", (uintmax_t)ip6stat.ip6s_m1);
for (first = 1, i = 0; i < 32; i++) {
char ifbuf[IFNAMSIZ];
- if (ip6stat.ip6s_m2m[i] != 0) {
+ if (ip6stat.ip6s_m2m[i] != 0) {
if (first) {
printf("\t\ttwo or more mbuf:\n");
first = 0;
@@ -436,7 +436,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
printf("\t\t%ju one ext mbuf\n",
(uintmax_t)ip6stat.ip6s_mext1);
printf("\t\t%ju two or more ext mbuf\n",
- (uintmax_t)ip6stat.ip6s_mext2m);
+ (uintmax_t)ip6stat.ip6s_mext2m);
p(ip6s_exthdrtoolong,
"\t%ju packet%s whose headers are not continuous\n");
p(ip6s_nogif, "\t%ju tunneling packet%s that can't find gif\n");
@@ -444,7 +444,7 @@ ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
"\t%ju packet%s discarded because of too many headers\n");
/* for debugging source address selection */
-#define PRINT_SCOPESTAT(s,i) do {\
+#define PRINT_SCOPESTAT(s,i) do {\
switch(i) { /* XXX hardcoding in each case */\
case 1:\
p(s, "\t\t%ju node-local%s\n");\
@@ -601,7 +601,7 @@ static const char *icmp6names[] = {
"#16",
"#17",
"#18",
- "#19",
+ "#19",
"#20",
"#21",
"#22",
@@ -611,7 +611,7 @@ static const char *icmp6names[] = {
"#26",
"#27",
"#28",
- "#29",
+ "#29",
"#30",
"#31",
"#32",
@@ -621,7 +621,7 @@ static const char *icmp6names[] = {
"#36",
"#37",
"#38",
- "#39",
+ "#39",
"#40",
"#41",
"#42",
@@ -631,7 +631,7 @@ static const char *icmp6names[] = {
"#46",
"#47",
"#48",
- "#49",
+ "#49",
"#50",
"#51",
"#52",
@@ -641,7 +641,7 @@ static const char *icmp6names[] = {
"#56",
"#57",
"#58",
- "#59",
+ "#59",
"#60",
"#61",
"#62",
@@ -651,7 +651,7 @@ static const char *icmp6names[] = {
"#66",
"#67",
"#68",
- "#69",
+ "#69",
"#70",
"#71",
"#72",
@@ -661,7 +661,7 @@ static const char *icmp6names[] = {
"#76",
"#77",
"#78",
- "#79",
+ "#79",
"#80",
"#81",
"#82",
@@ -671,7 +671,7 @@ static const char *icmp6names[] = {
"#86",
"#87",
"#88",
- "#89",
+ "#89",
"#80",
"#91",
"#92",
@@ -681,7 +681,7 @@ static const char *icmp6names[] = {
"#96",
"#97",
"#98",
- "#99",
+ "#99",
"#100",
"#101",
"#102",
@@ -691,7 +691,7 @@ static const char *icmp6names[] = {
"#106",
"#107",
"#108",
- "#109",
+ "#109",
"#110",
"#111",
"#112",
@@ -701,7 +701,7 @@ static const char *icmp6names[] = {
"#116",
"#117",
"#118",
- "#119",
+ "#119",
"#120",
"#121",
"#122",
@@ -711,7 +711,7 @@ static const char *icmp6names[] = {
"#126",
"#127",
"echo",
- "echo reply",
+ "echo reply",
"multicast listener query",
"multicast listener report",
"multicast listener done",
@@ -731,7 +731,7 @@ static const char *icmp6names[] = {
"#146",
"#147",
"#148",
- "#149",
+ "#149",
"#150",
"#151",
"#152",
@@ -741,7 +741,7 @@ static const char *icmp6names[] = {
"#156",
"#157",
"#158",
- "#159",
+ "#159",
"#160",
"#161",
"#162",
@@ -751,7 +751,7 @@ static const char *icmp6names[] = {
"#166",
"#167",
"#168",
- "#169",
+ "#169",
"#170",
"#171",
"#172",
@@ -761,7 +761,7 @@ static const char *icmp6names[] = {
"#176",
"#177",
"#178",
- "#179",
+ "#179",
"#180",
"#181",
"#182",
@@ -771,7 +771,7 @@ static const char *icmp6names[] = {
"#186",
"#187",
"#188",
- "#189",
+ "#189",
"#180",
"#191",
"#192",
@@ -781,7 +781,7 @@ static const char *icmp6names[] = {
"#196",
"#197",
"#198",
- "#199",
+ "#199",
"#200",
"#201",
"#202",
@@ -791,7 +791,7 @@ static const char *icmp6names[] = {
"#206",
"#207",
"#208",
- "#209",
+ "#209",
"#210",
"#211",
"#212",
@@ -801,7 +801,7 @@ static const char *icmp6names[] = {
"#216",
"#217",
"#218",
- "#219",
+ "#219",
"#220",
"#221",
"#222",
@@ -811,7 +811,7 @@ static const char *icmp6names[] = {
"#226",
"#227",
"#228",
- "#229",
+ "#229",
"#230",
"#231",
"#232",
@@ -821,7 +821,7 @@ static const char *icmp6names[] = {
"#236",
"#237",
"#238",
- "#239",
+ "#239",
"#240",
"#241",
"#242",
@@ -831,7 +831,7 @@ static const char *icmp6names[] = {
"#246",
"#247",
"#248",
- "#249",
+ "#249",
"#250",
"#251",
"#252",
@@ -866,14 +866,14 @@ icmp6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
#define p(f, m) if (icmp6stat.f || sflag <= 1) \
printf(m, (uintmax_t)icmp6stat.f, plural(icmp6stat.f))
-#define p_5(f, m) printf(m, (uintmax_t)icmp6stat.f)
+#define p_5(f, m) printf(m, (uintmax_t)icmp6stat.f)
p(icp6s_error, "\t%ju call%s to icmp6_error\n");
p(icp6s_canterror,
"\t%ju error%s not generated in response to an icmp6 message\n");
p(icp6s_toofreq,
"\t%ju error%s not generated because of rate limitation\n");
-#define NELEM (int)(sizeof(icmp6stat.icp6s_outhist)/sizeof(icmp6stat.icp6s_outhist[0]))
+#define NELEM (int)(sizeof(icmp6stat.icp6s_outhist)/sizeof(icmp6stat.icp6s_outhist[0]))
for (first = 1, i = 0; i < NELEM; i++)
if (icmp6stat.icp6s_outhist[i] != 0) {
if (first) {
@@ -888,7 +888,7 @@ icmp6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
p(icp6s_tooshort, "\t%ju message%s < minimum length\n");
p(icp6s_checksum, "\t%ju bad checksum%s\n");
p(icp6s_badlen, "\t%ju message%s with bad length\n");
-#define NELEM (int)(sizeof(icmp6stat.icp6s_inhist)/sizeof(icmp6stat.icp6s_inhist[0]))
+#define NELEM (int)(sizeof(icmp6stat.icp6s_inhist)/sizeof(icmp6stat.icp6s_inhist[0]))
for (first = 1, i = 0; i < NELEM; i++)
if (icmp6stat.icp6s_inhist[i] != 0) {
if (first) {
@@ -954,7 +954,7 @@ icmp6_ifstats(char *ifname)
}
p(ifs6_in_msg, "\t%ju total input message%s\n");
- p(ifs6_in_error, "\t%ju total input error message%s\n");
+ p(ifs6_in_error, "\t%ju total input error message%s\n");
p(ifs6_in_dstunreach, "\t%ju input destination unreachable error%s\n");
p(ifs6_in_adminprohib, "\t%ju input administratively prohibited error%s\n");
p(ifs6_in_timeexceed, "\t%ju input time exceeded error%s\n");
@@ -1080,7 +1080,7 @@ rip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
* Pretty print an Internet address (net address + port).
* Take numeric_addr and numeric_port into consideration.
*/
-#define GETSERVBYPORT6(port, proto, ret)\
+#define GETSERVBYPORT6(port, proto, ret)\
{\
if (strcmp((proto), "tcp6") == 0)\
(ret) = getservbyport((int)(port), "tcp");\
@@ -1147,7 +1147,7 @@ inet6name(struct in6_addr *in6p)
strcpy(line, "*");
else if (cp)
strcpy(line, cp);
- else
+ else
sprintf(line, "%s",
inet_ntop(AF_INET6, (void *)in6p, ntop_buf,
sizeof(ntop_buf)));
diff --git a/usr.bin/netstat/ipsec.c b/usr.bin/netstat/ipsec.c
index ef3e78f..bfd8ce0 100644
--- a/usr.bin/netstat/ipsec.c
+++ b/usr.bin/netstat/ipsec.c
@@ -1,10 +1,9 @@
-/* $FreeBSD$ */
/* $KAME: ipsec.c,v 1.33 2003/07/25 09:54:32 itojun Exp $ */
-/*
+/*-
* Copyright (c) 2005 NTT Multimedia Communications Laboratories, Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -26,11 +25,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
-/*
+/*-
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -42,7 +40,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -55,8 +53,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
-/*
+/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -217,7 +214,7 @@ print_ipsecstats(const struct ipsecstat *ipsecstat)
printf(m, (uintmax_t)ipsecstat->f, plural(ipsecstat->f))
#define pes(f, m) if (ipsecstat->f || sflag <= 1) \
printf(m, (uintmax_t)ipsecstat->f, plurales(ipsecstat->f))
-#define hist(f, n, t) \
+#define hist(f, n, t) \
ipsec_hist((f), sizeof(f)/sizeof(f[0]), (n), (t));
p(in_success, "\t%ju inbound packet%s processed successfully\n");
@@ -318,7 +315,7 @@ ipsec_hist_new(const u_int32_t *hist, size_t histmax,
}
}
}
-
+
static void
print_ahstats(const struct ahstat *ahstat)
{
@@ -326,7 +323,7 @@ print_ahstats(const struct ahstat *ahstat)
printf("\t%u" m, (unsigned int)ahstat->f, plural(ahstat->f))
#define p64(f, m) if (ahstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)ahstat->f, plural(ahstat->f))
-#define hist(f, n, t) \
+#define hist(f, n, t) \
ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
p32(ahs_hdrops, " packet%s shorter than header shows\n");
@@ -375,7 +372,7 @@ print_espstats(const struct espstat *espstat)
printf("\t%u" m, (unsigned int)espstat->f, plural(espstat->f))
#define p64(f, m) if (espstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)espstat->f, plural(espstat->f))
-#define hist(f, n, t) \
+#define hist(f, n, t) \
ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
p32(esps_hdrops, " packet%s shorter than header shows\n");
@@ -425,7 +422,7 @@ print_ipcompstats(const struct ipcompstat *ipcompstat)
printf("\t%u" m, (unsigned int)ipcompstat->f, plural(ipcompstat->f))
#define p64(f, m) if (ipcompstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)ipcompstat->f, plural(ipcompstat->f))
-#define hist(f, n, t) \
+#define hist(f, n, t) \
ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
p32(ipcomps_hdrops, " packet%s shorter than header shows\n");
diff --git a/usr.bin/netstat/ipx.c b/usr.bin/netstat/ipx.c
index 893dc75..b79a93b 100644
--- a/usr.bin/netstat/ipx.c
+++ b/usr.bin/netstat/ipx.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 2004, Robert N. M. Watson
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
#include <net/route.h>
-#define TCPSTATES
+#define TCPSTATES
#include <netinet/tcp_fsm.h>
#include <netipx/ipx.h>
@@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
#include <netipx/spx.h>
#include <netipx/spx_timer.h>
#include <netipx/spx_var.h>
-#define SANAMES
+#define SANAMES
#include <netipx/spx_debug.h>
#include <nlist.h>
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include "netstat.h"
-static char *ipx_prpr (struct ipx_addr *);
+static char *ipx_prpr(struct ipx_addr *);
/*
* Print a summary of connections related to a Network Systems
@@ -145,9 +145,9 @@ ipxprotopr(u_long off, const char *name, int af1 __unused, int proto __unused)
}
}
-#define ANY(x,y,z) \
+#define ANY(x,y,z) \
if (x || sflag <= 1) printf("\t%u %s%s%s\n", x, y, plural(x), z)
-#define ANYl(x,y,z) \
+#define ANYl(x,y,z) \
if (x || sflag <= 1) printf("\t%lu %s%s%s\n", x, y, plural(x), z)
/*
@@ -157,7 +157,7 @@ void
spx_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
{
struct spx_istat spx_istat;
-#define spxstat spx_istat.newstats
+#define spxstat spx_istat.newstats
if (off == 0)
return;
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 75edcb0..824b4e9 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1983, 1988, 1993
* Regents of the University of California. All rights reserved.
*
@@ -76,51 +76,51 @@ static struct nlist nl[] = {
{ .n_name = "_ifnet" },
#define N_RTSTAT 1
{ .n_name = "_rtstat" },
-#define N_RTREE 2
+#define N_RTREE 2
{ .n_name = "_rt_tables"},
-#define N_MRTSTAT 3
+#define N_MRTSTAT 3
{ .n_name = "_mrtstat" },
-#define N_MFCTABLE 4
+#define N_MFCTABLE 4
{ .n_name = "_mfctable" },
-#define N_VIFTABLE 5
+#define N_VIFTABLE 5
{ .n_name = "_viftable" },
-#define N_IPX 6
+#define N_IPX 6
{ .n_name = "_ipxpcb_list"},
-#define N_IPXSTAT 7
+#define N_IPXSTAT 7
{ .n_name = "_ipxstat"},
-#define N_SPXSTAT 8
+#define N_SPXSTAT 8
{ .n_name = "_spx_istat"},
-#define N_DDPSTAT 9
+#define N_DDPSTAT 9
{ .n_name = "_ddpstat"},
-#define N_DDPCB 10
+#define N_DDPCB 10
{ .n_name = "_ddpcb"},
-#define N_NGSOCKS 11
+#define N_NGSOCKS 11
{ .n_name = "_ngsocklist"},
-#define N_IP6STAT 12
+#define N_IP6STAT 12
{ .n_name = "_ip6stat" },
-#define N_ICMP6STAT 13
+#define N_ICMP6STAT 13
{ .n_name = "_icmp6stat" },
-#define N_IPSECSTAT 14
+#define N_IPSECSTAT 14
{ .n_name = "_ipsec4stat" },
-#define N_IPSEC6STAT 15
+#define N_IPSEC6STAT 15
{ .n_name = "_ipsec6stat" },
-#define N_PIM6STAT 16
+#define N_PIM6STAT 16
{ .n_name = "_pim6stat" },
-#define N_MRT6STAT 17
+#define N_MRT6STAT 17
{ .n_name = "_mrt6stat" },
-#define N_MF6CTABLE 18
+#define N_MF6CTABLE 18
{ .n_name = "_mf6ctable" },
-#define N_MIF6TABLE 19
+#define N_MIF6TABLE 19
{ .n_name = "_mif6table" },
-#define N_PFKEYSTAT 20
+#define N_PFKEYSTAT 20
{ .n_name = "_pfkeystat" },
-#define N_MBSTAT 21
+#define N_MBSTAT 21
{ .n_name = "_mbstat" },
-#define N_MBTYPES 22
+#define N_MBTYPES 22
{ .n_name = "_mbtypes" },
-#define N_NMBCLUSTERS 23
+#define N_NMBCLUSTERS 23
{ .n_name = "_nmbclusters" },
-#define N_NMBUFS 24
+#define N_NMBUFS 24
{ .n_name = "_nmbufs" },
#define N_MBHI 25
{ .n_name = "_mbuf_hiwm" },
@@ -138,9 +138,9 @@ static struct nlist nl[] = {
{ .n_name = "_mbuf_lowm" },
#define N_CLLO 32
{ .n_name = "_clust_lowm" },
-#define N_CARPSTAT 33
+#define N_CARPSTAT 33
{ .n_name = "_carpstats" },
-#define N_PFSYNCSTAT 34
+#define N_PFSYNCSTAT 34
{ .n_name = "_pfsyncstats" },
#define N_AHSTAT 35
{ .n_name = "_ahstat" },
@@ -427,7 +427,7 @@ main(int argc, char *argv[])
break;
case 'p':
if ((tp = name2protox(optarg)) == NULL) {
- errx(1,
+ errx(1,
"%s: unknown or uninstrumented protocol",
optarg);
}
@@ -618,7 +618,7 @@ printproto(tp, name)
printf("%s: no stats routine\n",
tp->pr_name);
return;
- }
+ }
if (tp->pr_usesysctl && live)
off = 0;
else if (tp->pr_sindex < 0) {
diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c
index 7e09a1e..7f65701 100644
--- a/usr.bin/netstat/mbuf.c
+++ b/usr.bin/netstat/mbuf.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California.
* Copyright (c) 2005 Robert N. M. Watson
@@ -300,7 +300,7 @@ mbpr(void *kvmd, u_long mbaddr)
goto out;
}
} else {
- if (kread(mbaddr, (char *)&mbstat, sizeof mbstat))
+ if (kread(mbaddr, (char *)&mbstat, sizeof mbstat) != 0)
goto out;
}
printf("%lu requests for sfbufs denied\n", mbstat.sf_allocfail);
diff --git a/usr.bin/netstat/mcast.c b/usr.bin/netstat/mcast.c
index 7348934..218d630 100644
--- a/usr.bin/netstat/mcast.c
+++ b/usr.bin/netstat/mcast.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 2007 Bruce M. Simpson <bms@FreeBSD.org>
* All rights reserved.
*
@@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$");
#include "netstat.h"
-#define __NETSTAT_BURN_BRIDGES
+#define __NETSTAT_BURN_BRIDGES
#ifdef __NETSTAT_BURN_BRIDGES
diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c
index d3cf740..dbce318 100644
--- a/usr.bin/netstat/mroute.c
+++ b/usr.bin/netstat/mroute.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1989 Stephen Deering
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -121,7 +121,7 @@ mroutepr(u_long mfcaddr, u_long vifaddr)
printf(" %2u %6u %4d %-15.15s",
/* opposite math of add_vif() */
- vifi, v->v_threshold, v->v_rate_limit * 1000 / 1024,
+ vifi, v->v_threshold, v->v_rate_limit * 1000 / 1024,
routename(v->v_lcl_addr.s_addr));
printf(" %-15.15s", (v->v_flags & VIFF_TUNNEL) ?
routename(v->v_rmt_addr.s_addr) : "");
@@ -151,7 +151,7 @@ mroutepr(u_long mfcaddr, u_long vifaddr)
printf(" %3d ", mfc.mfc_parent);
for (vifi = 0; vifi <= maxvif; vifi++) {
if (mfc.mfc_ttls[vifi] > 0)
- printf(" %u:%u", vifi,
+ printf(" %u:%u", vifi,
mfc.mfc_ttls[vifi]);
}
printf("\n");
@@ -160,7 +160,7 @@ mroutepr(u_long mfcaddr, u_long vifaddr)
{
struct bw_meter bw_meter, *bwm;
int banner_printed2 = 0;
-
+
bwm = mfc.mfc_bw_meter;
while (bwm) {
/* XXX KVM */
diff --git a/usr.bin/netstat/mroute6.c b/usr.bin/netstat/mroute6.c
index 6b4230d..c526d7c 100644
--- a/usr.bin/netstat/mroute6.c
+++ b/usr.bin/netstat/mroute6.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (C) 1998 WIDE Project.
* All rights reserved.
*
@@ -26,8 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
-/*
+/*-
* Copyright (c) 1989 Stephen Deering
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
diff --git a/usr.bin/netstat/netgraph.c b/usr.bin/netstat/netgraph.c
index 8ca9e5c..c4dd647 100644
--- a/usr.bin/netstat/netgraph.c
+++ b/usr.bin/netstat/netgraph.c
@@ -1,7 +1,7 @@
-/*
+/*-
* Copyright (c) 1996-1999 Whistle Communications, Inc.
* All rights reserved.
- *
+ *
* Subject to the following obligations and disclaimer of warranty, use and
* redistribution of this software, in source or object code forms, with or
* without modifications are expressly permitted by Whistle Communications;
@@ -12,7 +12,7 @@
* Communications, Inc. trademarks, including the mark "WHISTLE
* COMMUNICATIONS" on advertising, endorsements, or otherwise except as
* such appears in the above copyright notice or in the software.
- *
+ *
* THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h
index 0c6f733..24d8bf7 100644
--- a/usr.bin/netstat/netstat.h
+++ b/usr.bin/netstat/netstat.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1992, 1993
* Regents of the University of California. All rights reserved.
*
@@ -78,13 +78,13 @@ void ip_stats(u_long, const char *, int, int);
void icmp_stats(u_long, const char *, int, int);
void igmp_stats(u_long, const char *, int, int);
void pim_stats(u_long, const char *, int, int);
-void carp_stats (u_long, const char *, int, int);
-void pfsync_stats (u_long, const char *, int, int);
+void carp_stats(u_long, const char *, int, int);
+void pfsync_stats(u_long, const char *, int, int);
#ifdef IPSEC
void ipsec_stats(u_long, const char *, int, int);
-void esp_stats (u_long, const char *, int, int);
-void ah_stats (u_long, const char *, int, int);
-void ipcomp_stats (u_long, const char *, int, int);
+void esp_stats(u_long, const char *, int, int);
+void ah_stats(u_long, const char *, int, int);
+void ipcomp_stats(u_long, const char *, int, int);
#endif
#ifdef INET6
diff --git a/usr.bin/netstat/pfkey.c b/usr.bin/netstat/pfkey.c
index 47fccb7..2ab58e9 100644
--- a/usr.bin/netstat/pfkey.c
+++ b/usr.bin/netstat/pfkey.c
@@ -1,11 +1,9 @@
-/* $FreeBSD$ */
/* $NetBSD: inet.c,v 1.35.2.1 1999/04/29 14:57:08 perry Exp $ */
/* $KAME: ipsec.c,v 1.25 2001/03/12 09:04:39 itojun Exp $ */
-
-/*
+/*-
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -17,7 +15,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -30,8 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
-/*
+/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -64,14 +61,14 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#if 0
#ifndef lint
-/*
static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
-*/
-static const char rcsid[] =
- "$FreeBSD$";
#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/queue.h>
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index a0a8990..adab8e6 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include "netstat.h"
-#define kget(p, d) (kread((u_long)(p), (char *)&(d), sizeof (d)))
+#define kget(p, d) (kread((u_long)(p), (char *)&(d), sizeof (d)))
/*
* Definitions for showing gateway flags.
@@ -121,21 +121,21 @@ int NewTree = 0;
struct timespec uptime;
-static struct sockaddr *kgetsa (struct sockaddr *);
-static void size_cols (int ef, struct radix_node *rn);
-static void size_cols_tree (struct radix_node *rn);
-static void size_cols_rtentry (struct rtentry *rt);
-static void p_tree (struct radix_node *);
-static void p_rtnode (void);
-static void ntreestuff (void);
-static void np_rtentry (struct rt_msghdr *);
-static void p_sockaddr (struct sockaddr *, struct sockaddr *, int, int);
-static const char *fmt_sockaddr (struct sockaddr *sa, struct sockaddr *mask,
+static struct sockaddr *kgetsa(struct sockaddr *);
+static void size_cols(int ef, struct radix_node *rn);
+static void size_cols_tree(struct radix_node *rn);
+static void size_cols_rtentry(struct rtentry *rt);
+static void p_tree(struct radix_node *);
+static void p_rtnode(void);
+static void ntreestuff(void);
+static void np_rtentry(struct rt_msghdr *);
+static void p_sockaddr(struct sockaddr *, struct sockaddr *, int, int);
+static const char *fmt_sockaddr(struct sockaddr *sa, struct sockaddr *mask,
int flags);
-static void p_flags (int, const char *);
+static void p_flags(int, const char *);
static const char *fmt_flags(int f);
-static void p_rtentry (struct rtentry *);
-static void domask (char *, u_long, u_long);
+static void p_rtentry(struct rtentry *);
+static void domask(char *, u_long, u_long);
/*
* Print routing tables.
@@ -793,7 +793,7 @@ routename(u_long in)
strncpy(line, cp, sizeof(line) - 1);
line[sizeof(line) - 1] = '\0';
} else {
-#define C(x) ((x) & 0xff)
+#define C(x) ((x) & 0xff)
in = ntohl(in);
sprintf(line, "%lu.%lu.%lu.%lu",
C(in >> 24), C(in >> 16), C(in >> 8), C(in));
@@ -1045,10 +1045,10 @@ ipx_print(struct sockaddr *sa)
if (port) {
if (strcmp(host, "*") == 0)
host = "";
- if (sp)
+ if (sp)
snprintf(cport, sizeof(cport),
"%s%s", *host ? "." : "", sp->s_name);
- else
+ else
snprintf(cport, sizeof(cport),
"%s%x", *host ? "." : "", port);
} else
diff --git a/usr.bin/netstat/sctp.c b/usr.bin/netstat/sctp.c
index 70f54d2..a097938 100644
--- a/usr.bin/netstat/sctp.c
+++ b/usr.bin/netstat/sctp.c
@@ -28,7 +28,6 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#if 0
#ifndef lint
static char sccsid[] = "@(#)sctp.c 0.1 (Berkeley) 4/18/2007";
@@ -64,27 +63,27 @@ __FBSDID("$FreeBSD$");
#ifdef SCTP
-void inetprint (struct in_addr *, int, const char *, int);
+void inetprint(struct in_addr *, int, const char *, int);
static void sctp_statesprint(uint32_t state);
-#define NETSTAT_SCTP_STATES_CLOSED 0x0
-#define NETSTAT_SCTP_STATES_BOUND 0x1
-#define NETSTAT_SCTP_STATES_LISTEN 0x2
-#define NETSTAT_SCTP_STATES_COOKIE_WAIT 0x3
-#define NETSTAT_SCTP_STATES_COOKIE_ECHOED 0x4
-#define NETSTAT_SCTP_STATES_ESTABLISHED 0x5
-#define NETSTAT_SCTP_STATES_SHUTDOWN_SENT 0x6
-#define NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED 0x7
-#define NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT 0x8
-#define NETSTAT_SCTP_STATES_SHUTDOWN_PENDING 0x9
+#define NETSTAT_SCTP_STATES_CLOSED 0x0
+#define NETSTAT_SCTP_STATES_BOUND 0x1
+#define NETSTAT_SCTP_STATES_LISTEN 0x2
+#define NETSTAT_SCTP_STATES_COOKIE_WAIT 0x3
+#define NETSTAT_SCTP_STATES_COOKIE_ECHOED 0x4
+#define NETSTAT_SCTP_STATES_ESTABLISHED 0x5
+#define NETSTAT_SCTP_STATES_SHUTDOWN_SENT 0x6
+#define NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED 0x7
+#define NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT 0x8
+#define NETSTAT_SCTP_STATES_SHUTDOWN_PENDING 0x9
char *sctpstates[] = {
"CLOSED",
"BOUND",
- "LISTEN",
- "COOKIE_WAIT",
- "COOKIE_ECHOED",
- "ESTABLISHED",
+ "LISTEN",
+ "COOKIE_WAIT",
+ "COOKIE_ECHOED",
+ "ESTABLISHED",
"SHUTDOWN_SENT",
"SHUTDOWN_RECEIVED",
"SHUTDOWN_ACK_SENT",
@@ -117,7 +116,7 @@ sctp_skip_xinpcb_ifneed(char *buf, const size_t buflen, size_t *offset)
if (xladdr->last == 1)
break;
}
-
+
while (*offset < buflen) {
xstcb = (struct xsctp_tcb *)(buf + *offset);
*offset += sizeof(struct xsctp_tcb);
@@ -176,11 +175,11 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
*offset += sizeof(struct xsctp_laddr);
if (xladdr->last == 1)
break;
-
+
prev_xl = xl;
xl = malloc(sizeof(struct xladdr_entry));
if (xl == NULL) {
- warnx("malloc %lu bytes",
+ warnx("malloc %lu bytes",
(u_long)sizeof(struct xladdr_entry));
goto out;
}
@@ -191,17 +190,17 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
LIST_INSERT_AFTER(prev_xl, xl, xladdr_entries);
xl_total++;
}
-
+
while (*offset < buflen) {
xraddr = (struct xsctp_raddr *)(buf + *offset);
*offset += sizeof(struct xsctp_raddr);
if (xraddr->last == 1)
break;
-
+
prev_xr = xr;
xr = malloc(sizeof(struct xraddr_entry));
if (xr == NULL) {
- warnx("malloc %lu bytes",
+ warnx("malloc %lu bytes",
(u_long)sizeof(struct xraddr_entry));
goto out;
}
@@ -212,7 +211,7 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
LIST_INSERT_AFTER(prev_xr, xr, xraddr_entries);
xr_total++;
}
-
+
/*
* Let's print the address infos.
*/
@@ -222,12 +221,12 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
for (i = 0; i < x_max; i++) {
if (((*indent == 0) && i > 0) || *indent > 0)
printf("%-11s ", " ");
-
+
if (xl != NULL) {
sa = &(xl->xladdr->address.sa);
if ((sa->sa_family) == AF_INET)
- inetprint(&((struct sockaddr_in *)sa)->sin_addr,
- htons(xstcb->local_port),
+ inetprint(&((struct sockaddr_in *)sa)->sin_addr,
+ htons(xstcb->local_port),
name, numeric_port);
#ifdef INET6
else {
@@ -238,7 +237,7 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
}
#endif
}
-
+
if (xr != NULL && !Lflag) {
sa = &(xr->xraddr->address.sa);
if ((sa->sa_family) == AF_INET)
@@ -254,19 +253,19 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
}
#endif
}
-
+
if (xl != NULL)
xl = LIST_NEXT(xl, xladdr_entries);
if (xr != NULL)
xr = LIST_NEXT(xr, xraddr_entries);
-
+
if (i == 0 && !Lflag)
sctp_statesprint(xstcb->state);
-
+
if (i < x_max)
putchar('\n');
}
-
+
out:
/*
* Free the list which be used to handle the address.
@@ -277,7 +276,7 @@ out:
free(xl);
xl = xl_tmp;
}
-
+
xr = LIST_FIRST(&xraddr_head);
while (xr != NULL) {
xr_tmp = LIST_NEXT(xr, xraddr_entries);
@@ -363,19 +362,19 @@ sctp_process_inpcb(struct xsctp_inpcb *xinpcb, const char *name,
printf("%8lx ", (u_long)xinpcb);
printf("%-5.5s ", name);
-
+
if (xinpcb->flags & SCTP_PCB_FLAGS_TCPTYPE)
tname = "1to1";
else if (xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE)
tname = "1toN";
else
return;
-
+
printf("%-5.5s ", tname);
if (Lflag) {
char buf1[9];
-
+
snprintf(buf1, 9, "%hu/%hu", xinpcb->qlen, xinpcb->maxqlen);
printf("%-8.8s ", buf1);
}
@@ -399,7 +398,7 @@ sctp_process_inpcb(struct xsctp_inpcb *xinpcb, const char *name,
sa = &(xladdr->address.sa);
if ((sa->sa_family) == AF_INET)
- inetprint(&((struct sockaddr_in *)sa)->sin_addr,
+ inetprint(&((struct sockaddr_in *)sa)->sin_addr,
htons(xinpcb->local_port), name, numeric_port);
#ifdef INET6
else {
@@ -440,7 +439,7 @@ sctp_protopr(u_long off __unused,
size_t offset = 0;
size_t len = 0;
struct xsctp_inpcb *xinpcb;
-
+
if (proto != IPPROTO_SCTP)
return;
diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c
index 03bef85..0778bac 100644
--- a/usr.bin/netstat/unix.c
+++ b/usr.bin/netstat/unix.c
@@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
#include <kvm.h>
#include "netstat.h"
-static void unixdomainpr (struct xunpcb *, struct xsocket *);
+static void unixdomainpr(struct xunpcb *, struct xsocket *);
static const char *const socktype[] =
{ "#0", "stream", "dgram", "raw", "rdm", "seqpacket" };
@@ -124,7 +124,7 @@ pcblist_kvm(u_long count_off, u_long gencnt_off, u_long head_off, char **bufp)
}
p = buf;
-#define COPYOUT(obj, size) do { \
+#define COPYOUT(obj, size) do { \
if (len < (size)) { \
warnx("buffer size exceeded"); \
goto fail; \
@@ -134,7 +134,7 @@ pcblist_kvm(u_long count_off, u_long gencnt_off, u_long head_off, char **bufp)
p += (size); \
} while (0)
-#define KREAD(off, buf, len) do { \
+#define KREAD(off, buf, len) do { \
if (kread((uintptr_t)(off), (buf), (len)) != 0) \
goto fail; \
} while (0)
OpenPOWER on IntegriCloud