+ kread is not a boolean, so check it as such
+ fix $FreeBSD$ Ids
+ denote copyrights with /*-
+ misc whitespace changes.
This commit is contained in:
David E. O'Brien 2008-01-02 23:26:11 +00:00
parent 24ecb0cb15
commit 65475bc8e6
18 changed files with 250 additions and 255 deletions

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1983, 1988, 1993 * Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved. * 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) printf("\t%lu %s%s%s\n",x,y,plural(x),z)
/* /*

View File

@ -22,9 +22,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * 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 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*
* $FreeBSD$
*/ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h> #include <sys/types.h>
#include <sys/protosw.h> #include <sys/protosw.h>
#include <sys/socket.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_async ? 'a' : '-';
*flagbuf++ = bd->bd_locked ? 'l' : '-'; *flagbuf++ = bd->bd_locked ? 'l' : '-';
*flagbuf++ = '\0'; *flagbuf++ = '\0';
} }
void void
bpf_stats(char *ifname) bpf_stats(char *ifname)

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1983, 1988, 1993 * Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved. * 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() */ static char ntop_buf[INET6_ADDRSTRLEN]; /* for inet_ntop() */
#endif #endif
/* /*
* Dump pfsync statistics structure. * Dump pfsync statistics structure.
*/ */
void void
@ -105,9 +105,9 @@ pfsync_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
printf("%s:\n", name); 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)) 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) printf(m, (uintmax_t)pfsyncstat.f)
p(pfsyncs_ipackets, "\t%ju packet%s received (IPv4)\n"); 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); sidewaysintpr(interval1, ifnetaddr);
return; return;
} }
if (kread(ifnetaddr, (char *)&ifnethead, sizeof ifnethead)) if (kread(ifnetaddr, (char *)&ifnethead, sizeof ifnethead) != 0)
return; return;
ifnetaddr = (u_long)TAILQ_FIRST(&ifnethead); ifnetaddr = (u_long)TAILQ_FIRST(&ifnethead);
if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet)) if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet) != 0)
return; return;
if (!pfunc) { if (!pfunc) {
@ -253,11 +253,11 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
if (ifaddraddr == 0) { if (ifaddraddr == 0) {
ifnetfound = ifnetaddr; ifnetfound = ifnetaddr;
if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet)) if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet) != 0)
return; return;
strlcpy(name, ifnet.if_xname, sizeof(name)); strlcpy(name, ifnet.if_xname, sizeof(name));
ifnetaddr = (u_long)TAILQ_NEXT(&ifnet, if_link); ifnetaddr = (u_long)TAILQ_NEXT(&ifnet, if_link);
if (interface != 0 && (strcmp(name, interface) != 0)) if (interface != 0 && strcmp(name, interface) != 0)
continue; continue;
cp = index(name, '\0'); cp = index(name, '\0');
@ -298,11 +298,12 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
printf("%-13.13s ", "none"); printf("%-13.13s ", "none");
printf("%-17.17s ", "none"); printf("%-17.17s ", "none");
} else { } else {
if (kread(ifaddraddr, (char *)&ifaddr, sizeof ifaddr)) { if (kread(ifaddraddr, (char *)&ifaddr, sizeof ifaddr)
!= 0) {
ifaddraddr = 0; ifaddraddr = 0;
continue; continue;
} }
#define CP(x) ((char *)(x)) #define CP(x) ((char *)(x))
cp = (CP(ifaddr.ifa.ifa_addr) - CP(ifaddraddr)) + cp = (CP(ifaddr.ifa.ifa_addr) - CP(ifaddraddr)) +
CP(&ifaddr); CP(&ifaddr);
sa = (struct sockaddr *)cp; 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) { TAILQ_FOREACH(multiaddr, &ifnet.if_multiaddrs, ifma_link) {
if (kread((u_long)multiaddr, (char *)&ifma, if (kread((u_long)multiaddr, (char *)&ifma,
sizeof ifma)) sizeof ifma) != 0)
break; break;
multiaddr = &ifma; multiaddr = &ifma;
if (kread((u_long)ifma.ifma_addr, (char *)&msa, if (kread((u_long)ifma.ifma_addr, (char *)&msa,
sizeof msa)) sizeof msa) != 0)
break; break;
if (msa.sa.sa_family != sa->sa_family) if (msa.sa.sa_family != sa->sa_family)
continue; continue;
fmt = 0; fmt = 0;
switch (msa.sa.sa_family) { switch (msa.sa.sa_family) {
case AF_INET: case AF_INET:
@ -541,7 +542,7 @@ sidewaysintpr(int interval1, u_long off)
int oldmask, first; int oldmask, first;
u_long interesting_off; u_long interesting_off;
if (kread(off, (char *)&ifnethead, sizeof ifnethead)) if (kread(off, (char *)&ifnethead, sizeof ifnethead) != 0)
return; return;
firstifnet = (u_long)TAILQ_FIRST(&ifnethead); firstifnet = (u_long)TAILQ_FIRST(&ifnethead);
@ -556,7 +557,7 @@ sidewaysintpr(int interval1, u_long off)
for (off = firstifnet, ip = iftot; off;) { for (off = firstifnet, ip = iftot; off;) {
char name[IFNAMSIZ]; char name[IFNAMSIZ];
if (kread(off, (char *)&ifnet, sizeof ifnet)) if (kread(off, (char *)&ifnet, sizeof ifnet) != 0)
break; break;
strlcpy(name, ifnet.if_xname, sizeof(name)); strlcpy(name, ifnet.if_xname, sizeof(name));
if (interface && strcmp(name, interface) == 0) { if (interface && strcmp(name, interface) == 0) {
@ -607,7 +608,7 @@ sidewaysintpr(int interval1, u_long off)
loop: loop:
if (interesting != NULL) { if (interesting != NULL) {
ip = interesting; ip = interesting;
if (kread(interesting_off, (char *)&ifnet, sizeof ifnet)) { if (kread(interesting_off, (char *)&ifnet, sizeof ifnet) != 0) {
printf("???\n"); printf("???\n");
exit(1); exit(1);
}; };
@ -618,7 +619,7 @@ sidewaysintpr(int interval1, u_long off)
show_stat("lu", 10, ifnet.if_opackets - ip->ift_op, 1); 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", 5, ifnet.if_oerrors - ip->ift_oe, 1);
show_stat("lu", 10, ifnet.if_obytes - ip->ift_ob, 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); ifnet.if_collisions - ip->ift_co, 1);
if (dflag) if (dflag)
show_stat("LSu", 5, show_stat("LSu", 5,
@ -644,7 +645,7 @@ sidewaysintpr(int interval1, u_long off)
for (off = firstifnet, ip = iftot; for (off = firstifnet, ip = iftot;
off && SLIST_NEXT(ip, chain) != NULL; off && SLIST_NEXT(ip, chain) != NULL;
ip = SLIST_NEXT(ip, chain)) { ip = SLIST_NEXT(ip, chain)) {
if (kread(off, (char *)&ifnet, sizeof ifnet)) { if (kread(off, (char *)&ifnet, sizeof ifnet) != 0) {
off = 0; off = 0;
continue; continue;
} }

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1983, 1988, 1993, 1995 * Copyright (c) 1983, 1988, 1993, 1995
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <netinet/tcpip.h> #include <netinet/tcpip.h>
#include <netinet/tcp_seq.h> #include <netinet/tcp_seq.h>
#define TCPSTATES #define TCPSTATES
#include <netinet/tcp_fsm.h> #include <netinet/tcp_fsm.h>
#include <netinet/tcp_timer.h> #include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h> #include <netinet/tcp_var.h>
@ -85,8 +85,8 @@ __FBSDID("$FreeBSD$");
#include <unistd.h> #include <unistd.h>
#include "netstat.h" #include "netstat.h"
char *inetname (struct in_addr *); char *inetname(struct in_addr *);
void inetprint (struct in_addr *, int, const char *, int); void inetprint(struct in_addr *, int, const char *, int);
#ifdef INET6 #ifdef INET6
static int udp_done, tcp_done; static int udp_done, tcp_done;
#endif /* INET6 */ #endif /* INET6 */
@ -210,7 +210,7 @@ pcblist_kvm(u_long off, char **bufp, int istcp)
} }
p = buf; p = buf;
#define COPYOUT(obj, size) do { \ #define COPYOUT(obj, size) do { \
if (len < (size)) { \ if (len < (size)) { \
warnx("buffer size exceeded"); \ warnx("buffer size exceeded"); \
goto fail; \ goto fail; \
@ -220,7 +220,7 @@ pcblist_kvm(u_long off, char **bufp, int istcp)
p += (size); \ p += (size); \
} while (0) } while (0)
#define KREAD(off, buf, len) do { \ #define KREAD(off, buf, len) do { \
if (kread((uintptr_t)(off), (buf), (len)) != 0) \ if (kread((uintptr_t)(off), (buf), (len)) != 0) \
goto fail; \ goto fail; \
} while (0) } while (0)
@ -274,7 +274,7 @@ pcblist_kvm(u_long off, char **bufp, int istcp)
if (istcp) if (istcp)
COPYOUT(&xt, sizeof xt); COPYOUT(&xt, sizeof xt);
else else
COPYOUT(&xi, sizeof xi); COPYOUT(&xi, sizeof xi);
} }
/* Reread the pcbinfo and write out the footer. */ /* 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_count = pcbinfo.ipi_count;
xig.xig_gen = pcbinfo.ipi_gencnt; xig.xig_gen = pcbinfo.ipi_gencnt;
COPYOUT(&xig, sizeof xig); COPYOUT(&xig, sizeof xig);
*bufp = buf; *bufp = buf;
return (1); 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, p2(tcps_closed, tcps_drops,
"\t%lu connection%s closed (including %lu drop%s)\n"); "\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_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"); "\t\t%lu connection%s updated cached RTT variance on close\n");
p(tcps_cachedssthresh, p(tcps_cachedssthresh,
"\t\t%lu connection%s updated cached ssthresh on close\n"); "\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_timeoutdrop, "\t\t%lu connection%s dropped by rexmit timeout\n");
p(tcps_persisttimeo, "\t%lu persist timeout%s\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_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_keeptimeo, "\t%lu keepalive timeout%s\n");
p(tcps_keepprobe, "\t\t%lu keepalive probe%s sent\n"); p(tcps_keepprobe, "\t\t%lu keepalive probe%s sent\n");
p(tcps_keepdrops, "\t\t%lu connection%s dropped by keepalive\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"); p(tcps_preddat, "\t%lu correct data packet header prediction%s\n");
p3(tcps_sc_added, "\t%lu syncache entr%s added\n"); p3(tcps_sc_added, "\t%lu syncache entr%s added\n");
p1a(tcps_sc_retransmitted, "\t\t%lu retransmitted\n"); p1a(tcps_sc_retransmitted, "\t\t%lu retransmitted\n");
p1a(tcps_sc_dupsyn, "\t\t%lu dupsyn\n"); p1a(tcps_sc_dupsyn, "\t\t%lu dupsyn\n");
p1a(tcps_sc_dropped, "\t\t%lu dropped\n"); p1a(tcps_sc_dropped, "\t\t%lu dropped\n");
p1a(tcps_sc_completed, "\t\t%lu completed\n"); p1a(tcps_sc_completed, "\t\t%lu completed\n");
p1a(tcps_sc_bucketoverflow, "\t\t%lu bucket overflow\n"); p1a(tcps_sc_bucketoverflow, "\t\t%lu bucket overflow\n");
p1a(tcps_sc_cacheoverflow, "\t\t%lu cache overflow\n"); p1a(tcps_sc_cacheoverflow, "\t\t%lu cache overflow\n");
p1a(tcps_sc_reset, "\t\t%lu reset\n"); p1a(tcps_sc_reset, "\t\t%lu reset\n");
p1a(tcps_sc_stale, "\t\t%lu stale\n"); p1a(tcps_sc_stale, "\t\t%lu stale\n");
p1a(tcps_sc_aborted, "\t\t%lu aborted\n"); p1a(tcps_sc_aborted, "\t\t%lu aborted\n");
p1a(tcps_sc_badack, "\t\t%lu badack\n"); p1a(tcps_sc_badack, "\t\t%lu badack\n");
p1a(tcps_sc_unreach, "\t\t%lu unreach\n"); p1a(tcps_sc_unreach, "\t\t%lu unreach\n");
p(tcps_sc_zonefail, "\t\t%lu zone failure%s\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_sendcookie, "\t%lu cookie%s sent\n");
p(tcps_sc_recvcookie, "\t%lu cookie%s received\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_recovery_episode, "\t%lu SACK recovery episode%s\n");
p(tcps_sack_rexmits, p(tcps_sack_rexmits,
"\t%lu segment rexmit%s in SACK recovery episodes\n"); "\t%lu segment rexmit%s in SACK recovery episodes\n");
p(tcps_sack_rexmit_bytes, 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, p(tcps_sack_rcv_blocks,
"\t%lu SACK option%s (SACK blocks) received\n"); "\t%lu SACK option%s (SACK blocks) received\n");
p(tcps_sack_send_blocks, "\t%lu SACK option%s (SACK blocks) sent\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"); p1a(tcps_sack_sboverflow, "\t%lu SACK scoreboard overflow\n");
#undef p #undef p
#undef p1a #undef p1a
@ -724,7 +724,7 @@ udp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
#undef p1a #undef p1a
} }
/* /*
* Dump CARP statistics structure. * Dump CARP statistics structure.
*/ */
void void
@ -750,9 +750,9 @@ carp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
printf("%s:\n", name); 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)) 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) printf(m, (uintmax_t)carpstat.f)
p(carps_ipackets, "\t%ju packet%s received (IPv4)\n"); 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_noproto, "\t%lu packet%s for unknown/unsupported protocol\n");
p(ips_forward, "\t%lu packet%s forwarded"); p(ips_forward, "\t%lu packet%s forwarded");
p(ips_fastforward, " (%lu packet%s fast forwarded)"); p(ips_fastforward, " (%lu packet%s fast forwarded)");
if (ipstat.ips_forward || sflag <= 1) if (ipstat.ips_forward || sflag <= 1)
putchar('\n'); putchar('\n');
p(ips_cantforward, "\t%lu packet%s not forwardable\n"); p(ips_cantforward, "\t%lu packet%s not forwardable\n");
p(ips_notmember, 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) < if (sysctlbyname("net.inet.icmp.maskrepl", &i, &len, NULL, 0) <
0) 0)
return; return;
printf("\tICMP address mask responses are %sabled\n", printf("\tICMP address mask responses are %sabled\n",
i ? "en" : "dis"); i ? "en" : "dis");
} }
} }
@ -1116,7 +1116,7 @@ inetname(struct in_addr *inp)
line[sizeof(line) - 1] = '\0'; line[sizeof(line) - 1] = '\0';
} else { } else {
inp->s_addr = ntohl(inp->s_addr); 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), 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)); C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr));
} }

View File

@ -1,5 +1,5 @@
/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */ /* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
/* /*-
* Copyright (c) 1983, 1988, 1993 * Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
@ -100,7 +100,7 @@ static const char *ip6nh[] = {
"#16", "#16",
"UDP", "UDP",
"#18", "#18",
"#19", "#19",
"#20", "#20",
"#21", "#21",
"IDP", "IDP",
@ -110,7 +110,7 @@ static const char *ip6nh[] = {
"#26", "#26",
"#27", "#27",
"#28", "#28",
"TP", "TP",
"#30", "#30",
"#31", "#31",
"#32", "#32",
@ -120,7 +120,7 @@ static const char *ip6nh[] = {
"#36", "#36",
"#37", "#37",
"#38", "#38",
"#39", "#39",
"#40", "#40",
"IP6", "IP6",
"#42", "#42",
@ -130,7 +130,7 @@ static const char *ip6nh[] = {
"#46", "#46",
"#47", "#47",
"#48", "#48",
"#49", "#49",
"ESP", "ESP",
"AH", "AH",
"#52", "#52",
@ -140,7 +140,7 @@ static const char *ip6nh[] = {
"#56", "#56",
"#57", "#57",
"ICMP6", "ICMP6",
"no next header", "no next header",
"destination option", "destination option",
"#61", "#61",
"mobility", "mobility",
@ -150,7 +150,7 @@ static const char *ip6nh[] = {
"#66", "#66",
"#67", "#67",
"#68", "#68",
"#69", "#69",
"#70", "#70",
"#71", "#71",
"#72", "#72",
@ -160,7 +160,7 @@ static const char *ip6nh[] = {
"#76", "#76",
"#77", "#77",
"#78", "#78",
"#79", "#79",
"ISOIP", "ISOIP",
"#81", "#81",
"#82", "#82",
@ -170,7 +170,7 @@ static const char *ip6nh[] = {
"#86", "#86",
"#87", "#87",
"#88", "#88",
"OSPF", "OSPF",
"#80", "#80",
"#91", "#91",
"#92", "#92",
@ -180,7 +180,7 @@ static const char *ip6nh[] = {
"#96", "#96",
"Ethernet", "Ethernet",
"#98", "#98",
"#99", "#99",
"#100", "#100",
"#101", "#101",
"#102", "#102",
@ -190,7 +190,7 @@ static const char *ip6nh[] = {
"#106", "#106",
"#107", "#107",
"#108", "#108",
"#109", "#109",
"#110", "#110",
"#111", "#111",
"#112", "#112",
@ -200,7 +200,7 @@ static const char *ip6nh[] = {
"#116", "#116",
"#117", "#117",
"#118", "#118",
"#119", "#119",
"#120", "#120",
"#121", "#121",
"#122", "#122",
@ -210,7 +210,7 @@ static const char *ip6nh[] = {
"#126", "#126",
"#127", "#127",
"#128", "#128",
"#129", "#129",
"#130", "#130",
"#131", "#131",
"#132", "#132",
@ -220,7 +220,7 @@ static const char *ip6nh[] = {
"#136", "#136",
"#137", "#137",
"#138", "#138",
"#139", "#139",
"#140", "#140",
"#141", "#141",
"#142", "#142",
@ -230,7 +230,7 @@ static const char *ip6nh[] = {
"#146", "#146",
"#147", "#147",
"#148", "#148",
"#149", "#149",
"#150", "#150",
"#151", "#151",
"#152", "#152",
@ -240,7 +240,7 @@ static const char *ip6nh[] = {
"#156", "#156",
"#157", "#157",
"#158", "#158",
"#159", "#159",
"#160", "#160",
"#161", "#161",
"#162", "#162",
@ -250,7 +250,7 @@ static const char *ip6nh[] = {
"#166", "#166",
"#167", "#167",
"#168", "#168",
"#169", "#169",
"#170", "#170",
"#171", "#171",
"#172", "#172",
@ -260,7 +260,7 @@ static const char *ip6nh[] = {
"#176", "#176",
"#177", "#177",
"#178", "#178",
"#179", "#179",
"#180", "#180",
"#181", "#181",
"#182", "#182",
@ -270,7 +270,7 @@ static const char *ip6nh[] = {
"#186", "#186",
"#187", "#187",
"#188", "#188",
"#189", "#189",
"#180", "#180",
"#191", "#191",
"#192", "#192",
@ -280,7 +280,7 @@ static const char *ip6nh[] = {
"#196", "#196",
"#197", "#197",
"#198", "#198",
"#199", "#199",
"#200", "#200",
"#201", "#201",
"#202", "#202",
@ -290,7 +290,7 @@ static const char *ip6nh[] = {
"#206", "#206",
"#207", "#207",
"#208", "#208",
"#209", "#209",
"#210", "#210",
"#211", "#211",
"#212", "#212",
@ -300,7 +300,7 @@ static const char *ip6nh[] = {
"#216", "#216",
"#217", "#217",
"#218", "#218",
"#219", "#219",
"#220", "#220",
"#221", "#221",
"#222", "#222",
@ -310,7 +310,7 @@ static const char *ip6nh[] = {
"#226", "#226",
"#227", "#227",
"#228", "#228",
"#229", "#229",
"#230", "#230",
"#231", "#231",
"#232", "#232",
@ -320,7 +320,7 @@ static const char *ip6nh[] = {
"#236", "#236",
"#237", "#237",
"#238", "#238",
"#239", "#239",
"#240", "#240",
"#241", "#241",
"#242", "#242",
@ -330,7 +330,7 @@ static const char *ip6nh[] = {
"#246", "#246",
"#247", "#247",
"#248", "#248",
"#249", "#249",
"#250", "#250",
"#251", "#251",
"#252", "#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); printf("\t\t%ju one mbuf\n", (uintmax_t)ip6stat.ip6s_m1);
for (first = 1, i = 0; i < 32; i++) { for (first = 1, i = 0; i < 32; i++) {
char ifbuf[IFNAMSIZ]; char ifbuf[IFNAMSIZ];
if (ip6stat.ip6s_m2m[i] != 0) { if (ip6stat.ip6s_m2m[i] != 0) {
if (first) { if (first) {
printf("\t\ttwo or more mbuf:\n"); printf("\t\ttwo or more mbuf:\n");
first = 0; 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", printf("\t\t%ju one ext mbuf\n",
(uintmax_t)ip6stat.ip6s_mext1); (uintmax_t)ip6stat.ip6s_mext1);
printf("\t\t%ju two or more ext mbuf\n", printf("\t\t%ju two or more ext mbuf\n",
(uintmax_t)ip6stat.ip6s_mext2m); (uintmax_t)ip6stat.ip6s_mext2m);
p(ip6s_exthdrtoolong, p(ip6s_exthdrtoolong,
"\t%ju packet%s whose headers are not continuous\n"); "\t%ju packet%s whose headers are not continuous\n");
p(ip6s_nogif, "\t%ju tunneling packet%s that can't find gif\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"); "\t%ju packet%s discarded because of too many headers\n");
/* for debugging source address selection */ /* for debugging source address selection */
#define PRINT_SCOPESTAT(s,i) do {\ #define PRINT_SCOPESTAT(s,i) do {\
switch(i) { /* XXX hardcoding in each case */\ switch(i) { /* XXX hardcoding in each case */\
case 1:\ case 1:\
p(s, "\t\t%ju node-local%s\n");\ p(s, "\t\t%ju node-local%s\n");\
@ -601,7 +601,7 @@ static const char *icmp6names[] = {
"#16", "#16",
"#17", "#17",
"#18", "#18",
"#19", "#19",
"#20", "#20",
"#21", "#21",
"#22", "#22",
@ -611,7 +611,7 @@ static const char *icmp6names[] = {
"#26", "#26",
"#27", "#27",
"#28", "#28",
"#29", "#29",
"#30", "#30",
"#31", "#31",
"#32", "#32",
@ -621,7 +621,7 @@ static const char *icmp6names[] = {
"#36", "#36",
"#37", "#37",
"#38", "#38",
"#39", "#39",
"#40", "#40",
"#41", "#41",
"#42", "#42",
@ -631,7 +631,7 @@ static const char *icmp6names[] = {
"#46", "#46",
"#47", "#47",
"#48", "#48",
"#49", "#49",
"#50", "#50",
"#51", "#51",
"#52", "#52",
@ -641,7 +641,7 @@ static const char *icmp6names[] = {
"#56", "#56",
"#57", "#57",
"#58", "#58",
"#59", "#59",
"#60", "#60",
"#61", "#61",
"#62", "#62",
@ -651,7 +651,7 @@ static const char *icmp6names[] = {
"#66", "#66",
"#67", "#67",
"#68", "#68",
"#69", "#69",
"#70", "#70",
"#71", "#71",
"#72", "#72",
@ -661,7 +661,7 @@ static const char *icmp6names[] = {
"#76", "#76",
"#77", "#77",
"#78", "#78",
"#79", "#79",
"#80", "#80",
"#81", "#81",
"#82", "#82",
@ -671,7 +671,7 @@ static const char *icmp6names[] = {
"#86", "#86",
"#87", "#87",
"#88", "#88",
"#89", "#89",
"#80", "#80",
"#91", "#91",
"#92", "#92",
@ -681,7 +681,7 @@ static const char *icmp6names[] = {
"#96", "#96",
"#97", "#97",
"#98", "#98",
"#99", "#99",
"#100", "#100",
"#101", "#101",
"#102", "#102",
@ -691,7 +691,7 @@ static const char *icmp6names[] = {
"#106", "#106",
"#107", "#107",
"#108", "#108",
"#109", "#109",
"#110", "#110",
"#111", "#111",
"#112", "#112",
@ -701,7 +701,7 @@ static const char *icmp6names[] = {
"#116", "#116",
"#117", "#117",
"#118", "#118",
"#119", "#119",
"#120", "#120",
"#121", "#121",
"#122", "#122",
@ -711,7 +711,7 @@ static const char *icmp6names[] = {
"#126", "#126",
"#127", "#127",
"echo", "echo",
"echo reply", "echo reply",
"multicast listener query", "multicast listener query",
"multicast listener report", "multicast listener report",
"multicast listener done", "multicast listener done",
@ -731,7 +731,7 @@ static const char *icmp6names[] = {
"#146", "#146",
"#147", "#147",
"#148", "#148",
"#149", "#149",
"#150", "#150",
"#151", "#151",
"#152", "#152",
@ -741,7 +741,7 @@ static const char *icmp6names[] = {
"#156", "#156",
"#157", "#157",
"#158", "#158",
"#159", "#159",
"#160", "#160",
"#161", "#161",
"#162", "#162",
@ -751,7 +751,7 @@ static const char *icmp6names[] = {
"#166", "#166",
"#167", "#167",
"#168", "#168",
"#169", "#169",
"#170", "#170",
"#171", "#171",
"#172", "#172",
@ -761,7 +761,7 @@ static const char *icmp6names[] = {
"#176", "#176",
"#177", "#177",
"#178", "#178",
"#179", "#179",
"#180", "#180",
"#181", "#181",
"#182", "#182",
@ -771,7 +771,7 @@ static const char *icmp6names[] = {
"#186", "#186",
"#187", "#187",
"#188", "#188",
"#189", "#189",
"#180", "#180",
"#191", "#191",
"#192", "#192",
@ -781,7 +781,7 @@ static const char *icmp6names[] = {
"#196", "#196",
"#197", "#197",
"#198", "#198",
"#199", "#199",
"#200", "#200",
"#201", "#201",
"#202", "#202",
@ -791,7 +791,7 @@ static const char *icmp6names[] = {
"#206", "#206",
"#207", "#207",
"#208", "#208",
"#209", "#209",
"#210", "#210",
"#211", "#211",
"#212", "#212",
@ -801,7 +801,7 @@ static const char *icmp6names[] = {
"#216", "#216",
"#217", "#217",
"#218", "#218",
"#219", "#219",
"#220", "#220",
"#221", "#221",
"#222", "#222",
@ -811,7 +811,7 @@ static const char *icmp6names[] = {
"#226", "#226",
"#227", "#227",
"#228", "#228",
"#229", "#229",
"#230", "#230",
"#231", "#231",
"#232", "#232",
@ -821,7 +821,7 @@ static const char *icmp6names[] = {
"#236", "#236",
"#237", "#237",
"#238", "#238",
"#239", "#239",
"#240", "#240",
"#241", "#241",
"#242", "#242",
@ -831,7 +831,7 @@ static const char *icmp6names[] = {
"#246", "#246",
"#247", "#247",
"#248", "#248",
"#249", "#249",
"#250", "#250",
"#251", "#251",
"#252", "#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) \ #define p(f, m) if (icmp6stat.f || sflag <= 1) \
printf(m, (uintmax_t)icmp6stat.f, plural(icmp6stat.f)) 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_error, "\t%ju call%s to icmp6_error\n");
p(icp6s_canterror, p(icp6s_canterror,
"\t%ju error%s not generated in response to an icmp6 message\n"); "\t%ju error%s not generated in response to an icmp6 message\n");
p(icp6s_toofreq, p(icp6s_toofreq,
"\t%ju error%s not generated because of rate limitation\n"); "\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++) for (first = 1, i = 0; i < NELEM; i++)
if (icmp6stat.icp6s_outhist[i] != 0) { if (icmp6stat.icp6s_outhist[i] != 0) {
if (first) { 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_tooshort, "\t%ju message%s < minimum length\n");
p(icp6s_checksum, "\t%ju bad checksum%s\n"); p(icp6s_checksum, "\t%ju bad checksum%s\n");
p(icp6s_badlen, "\t%ju message%s with bad length\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++) for (first = 1, i = 0; i < NELEM; i++)
if (icmp6stat.icp6s_inhist[i] != 0) { if (icmp6stat.icp6s_inhist[i] != 0) {
if (first) { if (first) {
@ -954,7 +954,7 @@ icmp6_ifstats(char *ifname)
} }
p(ifs6_in_msg, "\t%ju total input message%s\n"); 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_dstunreach, "\t%ju input destination unreachable error%s\n");
p(ifs6_in_adminprohib, "\t%ju input administratively prohibited 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"); 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). * Pretty print an Internet address (net address + port).
* Take numeric_addr and numeric_port into consideration. * Take numeric_addr and numeric_port into consideration.
*/ */
#define GETSERVBYPORT6(port, proto, ret)\ #define GETSERVBYPORT6(port, proto, ret)\
{\ {\
if (strcmp((proto), "tcp6") == 0)\ if (strcmp((proto), "tcp6") == 0)\
(ret) = getservbyport((int)(port), "tcp");\ (ret) = getservbyport((int)(port), "tcp");\
@ -1147,7 +1147,7 @@ inet6name(struct in6_addr *in6p)
strcpy(line, "*"); strcpy(line, "*");
else if (cp) else if (cp)
strcpy(line, cp); strcpy(line, cp);
else else
sprintf(line, "%s", sprintf(line, "%s",
inet_ntop(AF_INET6, (void *)in6p, ntop_buf, inet_ntop(AF_INET6, (void *)in6p, ntop_buf,
sizeof(ntop_buf))); sizeof(ntop_buf)));

View File

@ -1,10 +1,9 @@
/* $FreeBSD$ */
/* $KAME: ipsec.c,v 1.33 2003/07/25 09:54:32 itojun Exp $ */ /* $KAME: ipsec.c,v 1.33 2003/07/25 09:54:32 itojun Exp $ */
/* /*-
* Copyright (c) 2005 NTT Multimedia Communications Laboratories, Inc. * Copyright (c) 2005 NTT Multimedia Communications Laboratories, Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
@ -13,7 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * 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 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
/*-
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
@ -42,7 +40,7 @@
* 3. Neither the name of the project nor the names of its contributors * 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 * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * 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 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
/*-
/*
* Copyright (c) 1983, 1988, 1993 * Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved. * 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)) printf(m, (uintmax_t)ipsecstat->f, plural(ipsecstat->f))
#define pes(f, m) if (ipsecstat->f || sflag <= 1) \ #define pes(f, m) if (ipsecstat->f || sflag <= 1) \
printf(m, (uintmax_t)ipsecstat->f, plurales(ipsecstat->f)) 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)); ipsec_hist((f), sizeof(f)/sizeof(f[0]), (n), (t));
p(in_success, "\t%ju inbound packet%s processed successfully\n"); 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 static void
print_ahstats(const struct ahstat *ahstat) 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)) printf("\t%u" m, (unsigned int)ahstat->f, plural(ahstat->f))
#define p64(f, m) if (ahstat->f || sflag <= 1) \ #define p64(f, m) if (ahstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)ahstat->f, plural(ahstat->f)) 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)); ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
p32(ahs_hdrops, " packet%s shorter than header shows\n"); 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)) printf("\t%u" m, (unsigned int)espstat->f, plural(espstat->f))
#define p64(f, m) if (espstat->f || sflag <= 1) \ #define p64(f, m) if (espstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)espstat->f, plural(espstat->f)) 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)); ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
p32(esps_hdrops, " packet%s shorter than header shows\n"); 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)) printf("\t%u" m, (unsigned int)ipcompstat->f, plural(ipcompstat->f))
#define p64(f, m) if (ipcompstat->f || sflag <= 1) \ #define p64(f, m) if (ipcompstat->f || sflag <= 1) \
printf("\t%ju" m, (uintmax_t)ipcompstat->f, plural(ipcompstat->f)) 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)); ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
p32(ipcomps_hdrops, " packet%s shorter than header shows\n"); p32(ipcomps_hdrops, " packet%s shorter than header shows\n");

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 2004, Robert N. M. Watson * Copyright (c) 2004, Robert N. M. Watson
* Copyright (c) 1983, 1988, 1993 * Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
#include <net/route.h> #include <net/route.h>
#define TCPSTATES #define TCPSTATES
#include <netinet/tcp_fsm.h> #include <netinet/tcp_fsm.h>
#include <netipx/ipx.h> #include <netipx/ipx.h>
@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
#include <netipx/spx.h> #include <netipx/spx.h>
#include <netipx/spx_timer.h> #include <netipx/spx_timer.h>
#include <netipx/spx_var.h> #include <netipx/spx_var.h>
#define SANAMES #define SANAMES
#include <netipx/spx_debug.h> #include <netipx/spx_debug.h>
#include <nlist.h> #include <nlist.h>
@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
#include <string.h> #include <string.h>
#include "netstat.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 * 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) 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) 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) spx_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
{ {
struct spx_istat spx_istat; struct spx_istat spx_istat;
#define spxstat spx_istat.newstats #define spxstat spx_istat.newstats
if (off == 0) if (off == 0)
return; return;

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1983, 1988, 1993 * Copyright (c) 1983, 1988, 1993
* Regents of the University of California. All rights reserved. * Regents of the University of California. All rights reserved.
* *
@ -76,51 +76,51 @@ static struct nlist nl[] = {
{ .n_name = "_ifnet" }, { .n_name = "_ifnet" },
#define N_RTSTAT 1 #define N_RTSTAT 1
{ .n_name = "_rtstat" }, { .n_name = "_rtstat" },
#define N_RTREE 2 #define N_RTREE 2
{ .n_name = "_rt_tables"}, { .n_name = "_rt_tables"},
#define N_MRTSTAT 3 #define N_MRTSTAT 3
{ .n_name = "_mrtstat" }, { .n_name = "_mrtstat" },
#define N_MFCTABLE 4 #define N_MFCTABLE 4
{ .n_name = "_mfctable" }, { .n_name = "_mfctable" },
#define N_VIFTABLE 5 #define N_VIFTABLE 5
{ .n_name = "_viftable" }, { .n_name = "_viftable" },
#define N_IPX 6 #define N_IPX 6
{ .n_name = "_ipxpcb_list"}, { .n_name = "_ipxpcb_list"},
#define N_IPXSTAT 7 #define N_IPXSTAT 7
{ .n_name = "_ipxstat"}, { .n_name = "_ipxstat"},
#define N_SPXSTAT 8 #define N_SPXSTAT 8
{ .n_name = "_spx_istat"}, { .n_name = "_spx_istat"},
#define N_DDPSTAT 9 #define N_DDPSTAT 9
{ .n_name = "_ddpstat"}, { .n_name = "_ddpstat"},
#define N_DDPCB 10 #define N_DDPCB 10
{ .n_name = "_ddpcb"}, { .n_name = "_ddpcb"},
#define N_NGSOCKS 11 #define N_NGSOCKS 11
{ .n_name = "_ngsocklist"}, { .n_name = "_ngsocklist"},
#define N_IP6STAT 12 #define N_IP6STAT 12
{ .n_name = "_ip6stat" }, { .n_name = "_ip6stat" },
#define N_ICMP6STAT 13 #define N_ICMP6STAT 13
{ .n_name = "_icmp6stat" }, { .n_name = "_icmp6stat" },
#define N_IPSECSTAT 14 #define N_IPSECSTAT 14
{ .n_name = "_ipsec4stat" }, { .n_name = "_ipsec4stat" },
#define N_IPSEC6STAT 15 #define N_IPSEC6STAT 15
{ .n_name = "_ipsec6stat" }, { .n_name = "_ipsec6stat" },
#define N_PIM6STAT 16 #define N_PIM6STAT 16
{ .n_name = "_pim6stat" }, { .n_name = "_pim6stat" },
#define N_MRT6STAT 17 #define N_MRT6STAT 17
{ .n_name = "_mrt6stat" }, { .n_name = "_mrt6stat" },
#define N_MF6CTABLE 18 #define N_MF6CTABLE 18
{ .n_name = "_mf6ctable" }, { .n_name = "_mf6ctable" },
#define N_MIF6TABLE 19 #define N_MIF6TABLE 19
{ .n_name = "_mif6table" }, { .n_name = "_mif6table" },
#define N_PFKEYSTAT 20 #define N_PFKEYSTAT 20
{ .n_name = "_pfkeystat" }, { .n_name = "_pfkeystat" },
#define N_MBSTAT 21 #define N_MBSTAT 21
{ .n_name = "_mbstat" }, { .n_name = "_mbstat" },
#define N_MBTYPES 22 #define N_MBTYPES 22
{ .n_name = "_mbtypes" }, { .n_name = "_mbtypes" },
#define N_NMBCLUSTERS 23 #define N_NMBCLUSTERS 23
{ .n_name = "_nmbclusters" }, { .n_name = "_nmbclusters" },
#define N_NMBUFS 24 #define N_NMBUFS 24
{ .n_name = "_nmbufs" }, { .n_name = "_nmbufs" },
#define N_MBHI 25 #define N_MBHI 25
{ .n_name = "_mbuf_hiwm" }, { .n_name = "_mbuf_hiwm" },
@ -138,9 +138,9 @@ static struct nlist nl[] = {
{ .n_name = "_mbuf_lowm" }, { .n_name = "_mbuf_lowm" },
#define N_CLLO 32 #define N_CLLO 32
{ .n_name = "_clust_lowm" }, { .n_name = "_clust_lowm" },
#define N_CARPSTAT 33 #define N_CARPSTAT 33
{ .n_name = "_carpstats" }, { .n_name = "_carpstats" },
#define N_PFSYNCSTAT 34 #define N_PFSYNCSTAT 34
{ .n_name = "_pfsyncstats" }, { .n_name = "_pfsyncstats" },
#define N_AHSTAT 35 #define N_AHSTAT 35
{ .n_name = "_ahstat" }, { .n_name = "_ahstat" },
@ -427,7 +427,7 @@ main(int argc, char *argv[])
break; break;
case 'p': case 'p':
if ((tp = name2protox(optarg)) == NULL) { if ((tp = name2protox(optarg)) == NULL) {
errx(1, errx(1,
"%s: unknown or uninstrumented protocol", "%s: unknown or uninstrumented protocol",
optarg); optarg);
} }
@ -618,7 +618,7 @@ printproto(tp, name)
printf("%s: no stats routine\n", printf("%s: no stats routine\n",
tp->pr_name); tp->pr_name);
return; return;
} }
if (tp->pr_usesysctl && live) if (tp->pr_usesysctl && live)
off = 0; off = 0;
else if (tp->pr_sindex < 0) { else if (tp->pr_sindex < 0) {

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1983, 1988, 1993 * Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. * The Regents of the University of California.
* Copyright (c) 2005 Robert N. M. Watson * Copyright (c) 2005 Robert N. M. Watson
@ -300,7 +300,7 @@ mbpr(void *kvmd, u_long mbaddr)
goto out; goto out;
} }
} else { } else {
if (kread(mbaddr, (char *)&mbstat, sizeof mbstat)) if (kread(mbaddr, (char *)&mbstat, sizeof mbstat) != 0)
goto out; goto out;
} }
printf("%lu requests for sfbufs denied\n", mbstat.sf_allocfail); printf("%lu requests for sfbufs denied\n", mbstat.sf_allocfail);

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 2007 Bruce M. Simpson <bms@FreeBSD.org> * Copyright (c) 2007 Bruce M. Simpson <bms@FreeBSD.org>
* All rights reserved. * All rights reserved.
* *
@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$");
#include "netstat.h" #include "netstat.h"
#define __NETSTAT_BURN_BRIDGES #define __NETSTAT_BURN_BRIDGES
#ifdef __NETSTAT_BURN_BRIDGES #ifdef __NETSTAT_BURN_BRIDGES

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1989 Stephen Deering * Copyright (c) 1989 Stephen Deering
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved. * 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", printf(" %2u %6u %4d %-15.15s",
/* opposite math of add_vif() */ /* 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)); routename(v->v_lcl_addr.s_addr));
printf(" %-15.15s", (v->v_flags & VIFF_TUNNEL) ? printf(" %-15.15s", (v->v_flags & VIFF_TUNNEL) ?
routename(v->v_rmt_addr.s_addr) : ""); routename(v->v_rmt_addr.s_addr) : "");
@ -151,7 +151,7 @@ mroutepr(u_long mfcaddr, u_long vifaddr)
printf(" %3d ", mfc.mfc_parent); printf(" %3d ", mfc.mfc_parent);
for (vifi = 0; vifi <= maxvif; vifi++) { for (vifi = 0; vifi <= maxvif; vifi++) {
if (mfc.mfc_ttls[vifi] > 0) if (mfc.mfc_ttls[vifi] > 0)
printf(" %u:%u", vifi, printf(" %u:%u", vifi,
mfc.mfc_ttls[vifi]); mfc.mfc_ttls[vifi]);
} }
printf("\n"); printf("\n");
@ -160,7 +160,7 @@ mroutepr(u_long mfcaddr, u_long vifaddr)
{ {
struct bw_meter bw_meter, *bwm; struct bw_meter bw_meter, *bwm;
int banner_printed2 = 0; int banner_printed2 = 0;
bwm = mfc.mfc_bw_meter; bwm = mfc.mfc_bw_meter;
while (bwm) { while (bwm) {
/* XXX KVM */ /* XXX KVM */

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (C) 1998 WIDE Project. * Copyright (C) 1998 WIDE Project.
* All rights reserved. * All rights reserved.
* *
@ -26,8 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
/*-
/*
* Copyright (c) 1989 Stephen Deering * Copyright (c) 1989 Stephen Deering
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.

View File

@ -1,7 +1,7 @@
/* /*-
* Copyright (c) 1996-1999 Whistle Communications, Inc. * Copyright (c) 1996-1999 Whistle Communications, Inc.
* All rights reserved. * All rights reserved.
* *
* Subject to the following obligations and disclaimer of warranty, use and * Subject to the following obligations and disclaimer of warranty, use and
* redistribution of this software, in source or object code forms, with or * redistribution of this software, in source or object code forms, with or
* without modifications are expressly permitted by Whistle Communications; * without modifications are expressly permitted by Whistle Communications;
@ -12,7 +12,7 @@
* Communications, Inc. trademarks, including the mark "WHISTLE * Communications, Inc. trademarks, including the mark "WHISTLE
* COMMUNICATIONS" on advertising, endorsements, or otherwise except as * COMMUNICATIONS" on advertising, endorsements, or otherwise except as
* such appears in the above copyright notice or in the software. * such appears in the above copyright notice or in the software.
* *
* THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
* Regents of the University of California. All rights reserved. * 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 icmp_stats(u_long, const char *, int, int);
void igmp_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 pim_stats(u_long, const char *, int, int);
void carp_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 pfsync_stats(u_long, const char *, int, int);
#ifdef IPSEC #ifdef IPSEC
void ipsec_stats(u_long, const char *, int, int); void ipsec_stats(u_long, const char *, int, int);
void esp_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 ah_stats(u_long, const char *, int, int);
void ipcomp_stats (u_long, const char *, int, int); void ipcomp_stats(u_long, const char *, int, int);
#endif #endif
#ifdef INET6 #ifdef INET6

View File

@ -1,11 +1,9 @@
/* $FreeBSD$ */
/* $NetBSD: inet.c,v 1.35.2.1 1999/04/29 14:57:08 perry Exp $ */ /* $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 $ */ /* $KAME: ipsec.c,v 1.25 2001/03/12 09:04:39 itojun Exp $ */
/*-
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
@ -17,7 +15,7 @@
* 3. Neither the name of the project nor the names of its contributors * 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 * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * 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 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
/*-
/*
* Copyright (c) 1983, 1988, 1993 * Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
@ -64,14 +61,14 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/cdefs.h> #if 0
#ifndef lint #ifndef lint
/*
static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95"; static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
*/
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */ #endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h> #include <sys/param.h>
#include <sys/queue.h> #include <sys/queue.h>

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1983, 1988, 1993 * Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$");
#include <err.h> #include <err.h>
#include "netstat.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. * Definitions for showing gateway flags.
@ -121,21 +121,21 @@ int NewTree = 0;
struct timespec uptime; struct timespec uptime;
static struct sockaddr *kgetsa (struct sockaddr *); static struct sockaddr *kgetsa(struct sockaddr *);
static void size_cols (int ef, struct radix_node *rn); static void size_cols(int ef, struct radix_node *rn);
static void size_cols_tree (struct radix_node *rn); static void size_cols_tree(struct radix_node *rn);
static void size_cols_rtentry (struct rtentry *rt); static void size_cols_rtentry(struct rtentry *rt);
static void p_tree (struct radix_node *); static void p_tree(struct radix_node *);
static void p_rtnode (void); static void p_rtnode(void);
static void ntreestuff (void); static void ntreestuff(void);
static void np_rtentry (struct rt_msghdr *); static void np_rtentry(struct rt_msghdr *);
static void p_sockaddr (struct sockaddr *, struct sockaddr *, int, int); static void p_sockaddr(struct sockaddr *, struct sockaddr *, int, int);
static const char *fmt_sockaddr (struct sockaddr *sa, struct sockaddr *mask, static const char *fmt_sockaddr(struct sockaddr *sa, struct sockaddr *mask,
int flags); int flags);
static void p_flags (int, const char *); static void p_flags(int, const char *);
static const char *fmt_flags(int f); static const char *fmt_flags(int f);
static void p_rtentry (struct rtentry *); static void p_rtentry(struct rtentry *);
static void domask (char *, u_long, u_long); static void domask(char *, u_long, u_long);
/* /*
* Print routing tables. * Print routing tables.
@ -793,7 +793,7 @@ routename(u_long in)
strncpy(line, cp, sizeof(line) - 1); strncpy(line, cp, sizeof(line) - 1);
line[sizeof(line) - 1] = '\0'; line[sizeof(line) - 1] = '\0';
} else { } else {
#define C(x) ((x) & 0xff) #define C(x) ((x) & 0xff)
in = ntohl(in); in = ntohl(in);
sprintf(line, "%lu.%lu.%lu.%lu", sprintf(line, "%lu.%lu.%lu.%lu",
C(in >> 24), C(in >> 16), C(in >> 8), C(in)); C(in >> 24), C(in >> 16), C(in >> 8), C(in));
@ -1045,10 +1045,10 @@ ipx_print(struct sockaddr *sa)
if (port) { if (port) {
if (strcmp(host, "*") == 0) if (strcmp(host, "*") == 0)
host = ""; host = "";
if (sp) if (sp)
snprintf(cport, sizeof(cport), snprintf(cport, sizeof(cport),
"%s%s", *host ? "." : "", sp->s_name); "%s%s", *host ? "." : "", sp->s_name);
else else
snprintf(cport, sizeof(cport), snprintf(cport, sizeof(cport),
"%s%x", *host ? "." : "", port); "%s%x", *host ? "." : "", port);
} else } else

View File

@ -28,7 +28,6 @@
* THE POSSIBILITY OF SUCH DAMAGE. * THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#if 0 #if 0
#ifndef lint #ifndef lint
static char sccsid[] = "@(#)sctp.c 0.1 (Berkeley) 4/18/2007"; static char sccsid[] = "@(#)sctp.c 0.1 (Berkeley) 4/18/2007";
@ -64,27 +63,27 @@ __FBSDID("$FreeBSD$");
#ifdef SCTP #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); static void sctp_statesprint(uint32_t state);
#define NETSTAT_SCTP_STATES_CLOSED 0x0 #define NETSTAT_SCTP_STATES_CLOSED 0x0
#define NETSTAT_SCTP_STATES_BOUND 0x1 #define NETSTAT_SCTP_STATES_BOUND 0x1
#define NETSTAT_SCTP_STATES_LISTEN 0x2 #define NETSTAT_SCTP_STATES_LISTEN 0x2
#define NETSTAT_SCTP_STATES_COOKIE_WAIT 0x3 #define NETSTAT_SCTP_STATES_COOKIE_WAIT 0x3
#define NETSTAT_SCTP_STATES_COOKIE_ECHOED 0x4 #define NETSTAT_SCTP_STATES_COOKIE_ECHOED 0x4
#define NETSTAT_SCTP_STATES_ESTABLISHED 0x5 #define NETSTAT_SCTP_STATES_ESTABLISHED 0x5
#define NETSTAT_SCTP_STATES_SHUTDOWN_SENT 0x6 #define NETSTAT_SCTP_STATES_SHUTDOWN_SENT 0x6
#define NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED 0x7 #define NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED 0x7
#define NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT 0x8 #define NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT 0x8
#define NETSTAT_SCTP_STATES_SHUTDOWN_PENDING 0x9 #define NETSTAT_SCTP_STATES_SHUTDOWN_PENDING 0x9
char *sctpstates[] = { char *sctpstates[] = {
"CLOSED", "CLOSED",
"BOUND", "BOUND",
"LISTEN", "LISTEN",
"COOKIE_WAIT", "COOKIE_WAIT",
"COOKIE_ECHOED", "COOKIE_ECHOED",
"ESTABLISHED", "ESTABLISHED",
"SHUTDOWN_SENT", "SHUTDOWN_SENT",
"SHUTDOWN_RECEIVED", "SHUTDOWN_RECEIVED",
"SHUTDOWN_ACK_SENT", "SHUTDOWN_ACK_SENT",
@ -117,7 +116,7 @@ sctp_skip_xinpcb_ifneed(char *buf, const size_t buflen, size_t *offset)
if (xladdr->last == 1) if (xladdr->last == 1)
break; break;
} }
while (*offset < buflen) { while (*offset < buflen) {
xstcb = (struct xsctp_tcb *)(buf + *offset); xstcb = (struct xsctp_tcb *)(buf + *offset);
*offset += sizeof(struct xsctp_tcb); *offset += sizeof(struct xsctp_tcb);
@ -176,11 +175,11 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
*offset += sizeof(struct xsctp_laddr); *offset += sizeof(struct xsctp_laddr);
if (xladdr->last == 1) if (xladdr->last == 1)
break; break;
prev_xl = xl; prev_xl = xl;
xl = malloc(sizeof(struct xladdr_entry)); xl = malloc(sizeof(struct xladdr_entry));
if (xl == NULL) { if (xl == NULL) {
warnx("malloc %lu bytes", warnx("malloc %lu bytes",
(u_long)sizeof(struct xladdr_entry)); (u_long)sizeof(struct xladdr_entry));
goto out; goto out;
} }
@ -191,17 +190,17 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
LIST_INSERT_AFTER(prev_xl, xl, xladdr_entries); LIST_INSERT_AFTER(prev_xl, xl, xladdr_entries);
xl_total++; xl_total++;
} }
while (*offset < buflen) { while (*offset < buflen) {
xraddr = (struct xsctp_raddr *)(buf + *offset); xraddr = (struct xsctp_raddr *)(buf + *offset);
*offset += sizeof(struct xsctp_raddr); *offset += sizeof(struct xsctp_raddr);
if (xraddr->last == 1) if (xraddr->last == 1)
break; break;
prev_xr = xr; prev_xr = xr;
xr = malloc(sizeof(struct xraddr_entry)); xr = malloc(sizeof(struct xraddr_entry));
if (xr == NULL) { if (xr == NULL) {
warnx("malloc %lu bytes", warnx("malloc %lu bytes",
(u_long)sizeof(struct xraddr_entry)); (u_long)sizeof(struct xraddr_entry));
goto out; goto out;
} }
@ -212,7 +211,7 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
LIST_INSERT_AFTER(prev_xr, xr, xraddr_entries); LIST_INSERT_AFTER(prev_xr, xr, xraddr_entries);
xr_total++; xr_total++;
} }
/* /*
* Let's print the address infos. * 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++) { for (i = 0; i < x_max; i++) {
if (((*indent == 0) && i > 0) || *indent > 0) if (((*indent == 0) && i > 0) || *indent > 0)
printf("%-11s ", " "); printf("%-11s ", " ");
if (xl != NULL) { if (xl != NULL) {
sa = &(xl->xladdr->address.sa); sa = &(xl->xladdr->address.sa);
if ((sa->sa_family) == AF_INET) if ((sa->sa_family) == AF_INET)
inetprint(&((struct sockaddr_in *)sa)->sin_addr, inetprint(&((struct sockaddr_in *)sa)->sin_addr,
htons(xstcb->local_port), htons(xstcb->local_port),
name, numeric_port); name, numeric_port);
#ifdef INET6 #ifdef INET6
else { else {
@ -238,7 +237,7 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
} }
#endif #endif
} }
if (xr != NULL && !Lflag) { if (xr != NULL && !Lflag) {
sa = &(xr->xraddr->address.sa); sa = &(xr->xraddr->address.sa);
if ((sa->sa_family) == AF_INET) if ((sa->sa_family) == AF_INET)
@ -254,19 +253,19 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
} }
#endif #endif
} }
if (xl != NULL) if (xl != NULL)
xl = LIST_NEXT(xl, xladdr_entries); xl = LIST_NEXT(xl, xladdr_entries);
if (xr != NULL) if (xr != NULL)
xr = LIST_NEXT(xr, xraddr_entries); xr = LIST_NEXT(xr, xraddr_entries);
if (i == 0 && !Lflag) if (i == 0 && !Lflag)
sctp_statesprint(xstcb->state); sctp_statesprint(xstcb->state);
if (i < x_max) if (i < x_max)
putchar('\n'); putchar('\n');
} }
out: out:
/* /*
* Free the list which be used to handle the address. * Free the list which be used to handle the address.
@ -277,7 +276,7 @@ sctp_process_tcb(struct xsctp_tcb *xstcb, const char *name,
free(xl); free(xl);
xl = xl_tmp; xl = xl_tmp;
} }
xr = LIST_FIRST(&xraddr_head); xr = LIST_FIRST(&xraddr_head);
while (xr != NULL) { while (xr != NULL) {
xr_tmp = LIST_NEXT(xr, xraddr_entries); 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("%8lx ", (u_long)xinpcb);
printf("%-5.5s ", name); printf("%-5.5s ", name);
if (xinpcb->flags & SCTP_PCB_FLAGS_TCPTYPE) if (xinpcb->flags & SCTP_PCB_FLAGS_TCPTYPE)
tname = "1to1"; tname = "1to1";
else if (xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE) else if (xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE)
tname = "1toN"; tname = "1toN";
else else
return; return;
printf("%-5.5s ", tname); printf("%-5.5s ", tname);
if (Lflag) { if (Lflag) {
char buf1[9]; char buf1[9];
snprintf(buf1, 9, "%hu/%hu", xinpcb->qlen, xinpcb->maxqlen); snprintf(buf1, 9, "%hu/%hu", xinpcb->qlen, xinpcb->maxqlen);
printf("%-8.8s ", buf1); printf("%-8.8s ", buf1);
} }
@ -399,7 +398,7 @@ sctp_process_inpcb(struct xsctp_inpcb *xinpcb, const char *name,
sa = &(xladdr->address.sa); sa = &(xladdr->address.sa);
if ((sa->sa_family) == AF_INET) 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); htons(xinpcb->local_port), name, numeric_port);
#ifdef INET6 #ifdef INET6
else { else {
@ -440,7 +439,7 @@ sctp_protopr(u_long off __unused,
size_t offset = 0; size_t offset = 0;
size_t len = 0; size_t len = 0;
struct xsctp_inpcb *xinpcb; struct xsctp_inpcb *xinpcb;
if (proto != IPPROTO_SCTP) if (proto != IPPROTO_SCTP)
return; return;

View File

@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
#include <kvm.h> #include <kvm.h>
#include "netstat.h" #include "netstat.h"
static void unixdomainpr (struct xunpcb *, struct xsocket *); static void unixdomainpr(struct xunpcb *, struct xsocket *);
static const char *const socktype[] = static const char *const socktype[] =
{ "#0", "stream", "dgram", "raw", "rdm", "seqpacket" }; { "#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; p = buf;
#define COPYOUT(obj, size) do { \ #define COPYOUT(obj, size) do { \
if (len < (size)) { \ if (len < (size)) { \
warnx("buffer size exceeded"); \ warnx("buffer size exceeded"); \
goto fail; \ goto fail; \
@ -134,7 +134,7 @@ pcblist_kvm(u_long count_off, u_long gencnt_off, u_long head_off, char **bufp)
p += (size); \ p += (size); \
} while (0) } while (0)
#define KREAD(off, buf, len) do { \ #define KREAD(off, buf, len) do { \
if (kread((uintptr_t)(off), (buf), (len)) != 0) \ if (kread((uintptr_t)(off), (buf), (len)) != 0) \
goto fail; \ goto fail; \
} while (0) } while (0)