KNF. No functional change.

This commit is contained in:
msaitoh 2022-09-02 06:25:43 +00:00
parent e8f73aaeb4
commit 0785ab37b7
9 changed files with 359 additions and 244 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: atalk.c,v 1.20 2022/09/01 10:10:20 msaitoh Exp $ */
/* $NetBSD: atalk.c,v 1.21 2022/09/02 06:25:43 msaitoh Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from @(#)atalk.c 1.1 (Whistle) 6/6/96";
#else
__RCSID("$NetBSD: atalk.c,v 1.20 2022/09/01 10:10:20 msaitoh Exp $");
__RCSID("$NetBSD: atalk.c,v 1.21 2022/09/02 06:25:43 msaitoh Exp $");
#endif
#endif /* not lint */
@ -244,9 +244,8 @@ atalkprotopr(u_long off, const char *name)
return;
next = ddpcb.ddp_next;
#if 0
if (!aflag && atalk_nullhost(ddpcb.ddp_lsat)) {
if (!aflag && atalk_nullhost(ddpcb.ddp_lsat))
continue;
}
#endif
if (kread((u_long)ddpcb.ddp_socket,
(char *)&sockb, sizeof(sockb)) < 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.98 2022/09/01 10:10:20 msaitoh Exp $ */
/* $NetBSD: if.c,v 1.99 2022/09/02 06:25:43 msaitoh Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
#else
__RCSID("$NetBSD: if.c,v 1.98 2022/09/01 10:10:20 msaitoh Exp $");
__RCSID("$NetBSD: if.c,v 1.99 2022/09/02 06:25:43 msaitoh Exp $");
#endif
#endif /* not lint */
@ -132,12 +132,10 @@ intpr(int interval, u_long ifnetaddr, void (*pfunc)(const char *))
return;
}
if (use_sysctl) {
if (use_sysctl)
intpr_sysctl();
} else {
else
intpr_kvm(ifnetaddr, pfunc);
}
}
static void
@ -214,9 +212,9 @@ intpr_sysctl(void)
get_rtaddrs(ifm->ifm_addrs, sa, rti_info);
sdl = (struct sockaddr_dl *)rti_info[RTAX_IFP];
if (sdl == NULL || sdl->sdl_family != AF_LINK) {
if (sdl == NULL || sdl->sdl_family != AF_LINK)
continue;
}
bzero(name, sizeof(name));
if (sdl->sdl_nlen >= IFNAMSIZ)
memcpy(name, sdl->sdl_data, IFNAMSIZ - 1);
@ -538,9 +536,8 @@ print_addr(const int ifindex, struct sockaddr *sa,
ia4_print(&inm.inm_addr);
multiaddr = (u_long)inm.inm_list.le_next;
}
} else {
} else
mc4_print(ifindex);
}
break;
#ifdef INET6
case AF_INET6:
@ -551,9 +548,9 @@ print_addr(const int ifindex, struct sockaddr *sa,
sin6->sin6_scope_id = 0;
#endif
if (use_sysctl) {
if (use_sysctl)
netmask6 = (struct sockaddr_in6 *)rtinfo[RTAX_NETMASK];
} else {
else {
struct in6_ifaddr *ifaddr_in6 = (void *)rtinfo;
netmask6 = &ifaddr_in6->ia_prefixmask;
}
@ -590,9 +587,8 @@ print_addr(const int ifindex, struct sockaddr *sa,
ia6_print(&inm.in6m_addr);
multiaddr = (u_long)inm.in6m_entry.le_next;
}
} else {
} else
mc6_print(ifindex);
}
break;
#endif /*INET6*/
#ifndef SMALL

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet.c,v 1.115 2022/09/01 10:10:20 msaitoh Exp $ */
/* $NetBSD: inet.c,v 1.116 2022/09/02 06:25:43 msaitoh Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
__RCSID("$NetBSD: inet.c,v 1.115 2022/09/01 10:10:20 msaitoh Exp $");
__RCSID("$NetBSD: inet.c,v 1.116 2022/09/02 06:25:43 msaitoh Exp $");
#endif
#endif /* not lint */
@ -365,8 +365,7 @@ protopr(u_long off, const char *name)
memcpy(&src, &pcblist[i].ki_s, sizeof(src));
memcpy(&dst, &pcblist[i].ki_d, sizeof(dst));
if (!aflag &&
inet_lnaof(dst.sin_addr) == INADDR_ANY)
if (!aflag && (inet_lnaof(dst.sin_addr) == INADDR_ANY))
continue;
if (first) {
@ -413,18 +412,18 @@ tcp_stats(u_long off, const char *name)
printf ("%s:\n", name);
#define ps(f, m) if (tcpstat[f] || sflag <= 1) \
printf(m, tcpstat[f])
#define p(f, m) if (tcpstat[f] || sflag <= 1) \
printf(m, tcpstat[f], plural(tcpstat[f]))
#define p2(f1, f2, m) if (tcpstat[f1] || tcpstat[f2] || sflag <= 1) \
printf(m, tcpstat[f1], plural(tcpstat[f1]), \
tcpstat[f2], plural(tcpstat[f2]))
#define p2s(f1, f2, m) if (tcpstat[f1] || tcpstat[f2] || sflag <= 1) \
printf(m, tcpstat[f1], plural(tcpstat[f1]), \
tcpstat[f2])
#define p3(f, m) if (tcpstat[f] || sflag <= 1) \
printf(m, tcpstat[f], plurales(tcpstat[f]))
#define ps(f, m) if (tcpstat[f] || sflag <= 1) \
printf(m, tcpstat[f])
#define p(f, m) if (tcpstat[f] || sflag <= 1) \
printf(m, tcpstat[f], plural(tcpstat[f]))
#define p2(f1, f2, m) if (tcpstat[f1] || tcpstat[f2] || sflag <= 1) \
printf(m, tcpstat[f1], plural(tcpstat[f1]), \
tcpstat[f2], plural(tcpstat[f2]))
#define p2s(f1, f2, m) if (tcpstat[f1] || tcpstat[f2] || sflag <= 1) \
printf(m, tcpstat[f1], plural(tcpstat[f1]), \
tcpstat[f2])
#define p3(f, m) if (tcpstat[f] || sflag <= 1) \
printf(m, tcpstat[f], plurales(tcpstat[f]))
p(TCP_STAT_SNDTOTAL, "\t%" PRIu64 " packet%s sent\n");
p2(TCP_STAT_SNDPACK,TCP_STAT_SNDBYTE,
@ -441,69 +440,84 @@ tcp_stats(u_long off, const char *name)
"\t\t%" PRIu64 " send attempt%s resulted in self-quench\n");
p(TCP_STAT_RCVTOTAL, "\t%" PRIu64 " packet%s received\n");
p2(TCP_STAT_RCVACKPACK, TCP_STAT_RCVACKBYTE,
"\t\t%" PRIu64 " ack%s (for %" PRIu64 " byte%s)\n");
"\t\t%" PRIu64 " ack%s (for %" PRIu64 " byte%s)\n");
p(TCP_STAT_RCVDUPACK, "\t\t%" PRIu64 " duplicate ack%s\n");
p(TCP_STAT_RCVACKTOOMUCH, "\t\t%" PRIu64 " ack%s for unsent data\n");
p2(TCP_STAT_RCVPACK, TCP_STAT_RCVBYTE,
"\t\t%" PRIu64 " packet%s (%" PRIu64 " byte%s) received in-sequence\n");
"\t\t%" PRIu64 " packet%s (%" PRIu64 " byte%s) received in-sequence\n");
p2(TCP_STAT_RCVDUPPACK, TCP_STAT_RCVDUPBYTE,
"\t\t%" PRIu64 " completely duplicate packet%s (%" PRIu64 " byte%s)\n");
"\t\t%" PRIu64 " completely duplicate packet%s (%" PRIu64 " byte%s)\n");
p(TCP_STAT_PAWSDROP, "\t\t%" PRIu64 " old duplicate packet%s\n");
p2(TCP_STAT_RCVPARTDUPPACK, TCP_STAT_RCVPARTDUPBYTE,
"\t\t%" PRIu64 " packet%s with some dup. data (%" PRIu64 " byte%s duped)\n");
"\t\t%" PRIu64 " packet%s with some dup. data (%" PRIu64 " byte%s duped)\n");
p2(TCP_STAT_RCVOOPACK, TCP_STAT_RCVOOBYTE,
"\t\t%" PRIu64 " out-of-order packet%s (%" PRIu64 " byte%s)\n");
"\t\t%" PRIu64 " out-of-order packet%s (%" PRIu64 " byte%s)\n");
p2(TCP_STAT_RCVPACKAFTERWIN, TCP_STAT_RCVBYTEAFTERWIN,
"\t\t%" PRIu64 " packet%s (%" PRIu64 " byte%s) of data after window\n");
"\t\t%" PRIu64 " packet%s (%" PRIu64 " byte%s) of data after window\n");
p(TCP_STAT_RCVWINPROBE, "\t\t%" PRIu64 " window probe%s\n");
p(TCP_STAT_RCVWINUPD, "\t\t%" PRIu64 " window update packet%s\n");
p(TCP_STAT_RCVAFTERCLOSE, "\t\t%" PRIu64 " packet%s received after close\n");
p(TCP_STAT_RCVBADSUM, "\t\t%" PRIu64 " discarded for bad checksum%s\n");
p(TCP_STAT_RCVBADOFF, "\t\t%" PRIu64 " discarded for bad header offset field%s\n");
ps(TCP_STAT_RCVSHORT, "\t\t%" PRIu64 " discarded because packet too short\n");
p(TCP_STAT_RCVAFTERCLOSE,
"\t\t%" PRIu64 " packet%s received after close\n");
p(TCP_STAT_RCVBADSUM,
"\t\t%" PRIu64 " discarded for bad checksum%s\n");
p(TCP_STAT_RCVBADOFF,
"\t\t%" PRIu64 " discarded for bad header offset field%s\n");
ps(TCP_STAT_RCVSHORT,
"\t\t%" PRIu64 " discarded because packet too short\n");
p(TCP_STAT_CONNATTEMPT, "\t%" PRIu64 " connection request%s\n");
p(TCP_STAT_ACCEPTS, "\t%" PRIu64 " connection accept%s\n");
p(TCP_STAT_CONNECTS,
"\t%" PRIu64 " connection%s established (including accepts)\n");
"\t%" PRIu64 " connection%s established (including accepts)\n");
p2(TCP_STAT_CLOSED, TCP_STAT_DROPS,
"\t%" PRIu64 " connection%s closed (including %" PRIu64 " drop%s)\n");
p(TCP_STAT_CONNDROPS, "\t%" PRIu64 " embryonic connection%s dropped\n");
"\t%" PRIu64 " connection%s closed (including %" PRIu64 " drop%s)\n");
p(TCP_STAT_CONNDROPS,
"\t%" PRIu64 " embryonic connection%s dropped\n");
p(TCP_STAT_DELAYED_FREE, "\t%" PRIu64 " delayed free%s of tcpcb\n");
p2(TCP_STAT_RTTUPDATED, TCP_STAT_SEGSTIMED,
"\t%" PRIu64 " segment%s updated rtt (of %" PRIu64 " attempt%s)\n");
"\t%" PRIu64 " segment%s updated rtt (of %" PRIu64 " attempt%s)\n");
p(TCP_STAT_REXMTTIMEO, "\t%" PRIu64 " retransmit timeout%s\n");
p(TCP_STAT_TIMEOUTDROP,
"\t\t%" PRIu64 " connection%s dropped by rexmit timeout\n");
"\t\t%" PRIu64 " connection%s dropped by rexmit timeout\n");
p2(TCP_STAT_PERSISTTIMEO, TCP_STAT_PERSISTDROPS,
"\t%" PRIu64 " persist timeout%s (resulting in %" PRIu64 " dropped "
"connection%s)\n");
p(TCP_STAT_KEEPTIMEO, "\t%" PRIu64 " keepalive timeout%s\n");
p(TCP_STAT_KEEPPROBE, "\t\t%" PRIu64 " keepalive probe%s sent\n");
p(TCP_STAT_KEEPDROPS, "\t\t%" PRIu64 " connection%s dropped by keepalive\n");
p(TCP_STAT_KEEPDROPS,
"\t\t%" PRIu64 " connection%s dropped by keepalive\n");
p(TCP_STAT_PREDACK, "\t%" PRIu64 " correct ACK header prediction%s\n");
p(TCP_STAT_PREDDAT, "\t%" PRIu64 " correct data packet header prediction%s\n");
p(TCP_STAT_PREDDAT,
"\t%" PRIu64 " correct data packet header prediction%s\n");
p3(TCP_STAT_PCBHASHMISS, "\t%" PRIu64 " PCB hash miss%s\n");
ps(TCP_STAT_NOPORT, "\t%" PRIu64 " dropped due to no socket\n");
p(TCP_STAT_CONNSDRAINED, "\t%" PRIu64 " connection%s drained due to memory "
"shortage\n");
p(TCP_STAT_PMTUBLACKHOLE, "\t%" PRIu64 " PMTUD blackhole%s detected\n");
p(TCP_STAT_CONNSDRAINED,
"\t%" PRIu64 " connection%s drained due to memory shortage\n");
p(TCP_STAT_PMTUBLACKHOLE,
"\t%" PRIu64 " PMTUD blackhole%s detected\n");
p(TCP_STAT_BADSYN, "\t%" PRIu64 " bad connection attempt%s\n");
ps(TCP_STAT_SC_ADDED, "\t%" PRIu64 " SYN cache entries added\n");
p(TCP_STAT_SC_COLLISIONS, "\t\t%" PRIu64 " hash collision%s\n");
ps(TCP_STAT_SC_COMPLETED, "\t\t%" PRIu64 " completed\n");
ps(TCP_STAT_SC_ABORTED, "\t\t%" PRIu64 " aborted (no space to build PCB)\n");
ps(TCP_STAT_SC_ABORTED,
"\t\t%" PRIu64 " aborted (no space to build PCB)\n");
ps(TCP_STAT_SC_TIMED_OUT, "\t\t%" PRIu64 " timed out\n");
ps(TCP_STAT_SC_OVERFLOWED, "\t\t%" PRIu64 " dropped due to overflow\n");
ps(TCP_STAT_SC_BUCKETOVERFLOW, "\t\t%" PRIu64 " dropped due to bucket overflow\n");
ps(TCP_STAT_SC_OVERFLOWED,
"\t\t%" PRIu64 " dropped due to overflow\n");
ps(TCP_STAT_SC_BUCKETOVERFLOW,
"\t\t%" PRIu64 " dropped due to bucket overflow\n");
ps(TCP_STAT_SC_RESET, "\t\t%" PRIu64 " dropped due to RST\n");
ps(TCP_STAT_SC_UNREACH, "\t\t%" PRIu64 " dropped due to ICMP unreachable\n");
ps(TCP_STAT_SC_DELAYED_FREE, "\t\t%" PRIu64 " delayed free of SYN cache "
"entries\n");
p(TCP_STAT_SC_RETRANSMITTED, "\t%" PRIu64 " SYN,ACK%s retransmitted\n");
p(TCP_STAT_SC_DUPESYN, "\t%" PRIu64 " duplicate SYN%s received for entries "
ps(TCP_STAT_SC_UNREACH,
"\t\t%" PRIu64 " dropped due to ICMP unreachable\n");
ps(TCP_STAT_SC_DELAYED_FREE,
"\t\t%" PRIu64 " delayed free of SYN cache entries\n");
p(TCP_STAT_SC_RETRANSMITTED,
"\t%" PRIu64 " SYN,ACK%s retransmitted\n");
p(TCP_STAT_SC_DUPESYN,
"\t%" PRIu64 " duplicate SYN%s received for entries "
"already in the cache\n");
p(TCP_STAT_SC_DROPPED, "\t%" PRIu64 " SYN%s dropped (no route or no space)\n");
p(TCP_STAT_SC_DROPPED,
"\t%" PRIu64 " SYN%s dropped (no route or no space)\n");
p(TCP_STAT_BADSIG, "\t%" PRIu64 " packet%s with bad signature\n");
p(TCP_STAT_GOODSIG, "\t%" PRIu64 " packet%s with good signature\n");
@ -540,21 +554,22 @@ udp_stats(u_long off, const char *name)
printf ("%s:\n", name);
#define ps(f, m) if (udpstat[f] || sflag <= 1) \
printf(m, udpstat[f])
#define p(f, m) if (udpstat[f] || sflag <= 1) \
printf(m, udpstat[f], plural(udpstat[f]))
#define p3(f, m) if (udpstat[f] || sflag <= 1) \
printf(m, udpstat[f], plurales(udpstat[f]))
#define ps(f, m) if (udpstat[f] || sflag <= 1) \
printf(m, udpstat[f])
#define p(f, m) if (udpstat[f] || sflag <= 1) \
printf(m, udpstat[f], plural(udpstat[f]))
#define p3(f, m) if (udpstat[f] || sflag <= 1) \
printf(m, udpstat[f], plurales(udpstat[f]))
p(UDP_STAT_IPACKETS, "\t%" PRIu64 " datagram%s received\n");
ps(UDP_STAT_HDROPS, "\t%" PRIu64 " with incomplete header\n");
ps(UDP_STAT_BADLEN, "\t%" PRIu64 " with bad data length field\n");
ps(UDP_STAT_BADSUM, "\t%" PRIu64 " with bad checksum\n");
ps(UDP_STAT_NOPORT, "\t%" PRIu64 " dropped due to no socket\n");
p(UDP_STAT_NOPORTBCAST,
"\t%" PRIu64 " broadcast/multicast datagram%s dropped due to no socket\n");
ps(UDP_STAT_FULLSOCK, "\t%" PRIu64 " dropped due to full socket buffers\n");
p(UDP_STAT_NOPORTBCAST, "\t%" PRIu64
" broadcast/multicast datagram%s dropped due to no socket\n");
ps(UDP_STAT_FULLSOCK, "\t%" PRIu64
" dropped due to full socket buffers\n");
delivered = udpstat[UDP_STAT_IPACKETS] -
udpstat[UDP_STAT_HDROPS] -
udpstat[UDP_STAT_BADLEN] -
@ -584,7 +599,7 @@ ip_stats(u_long off, const char *name)
size_t size = sizeof(ipstat);
if (prog_sysctlbyname("net.inet.ip.stats", ipstat, &size,
NULL, 0) == -1 && errno != ENOMEM)
NULL, 0) == -1 && errno != ENOMEM)
return;
} else {
warnx("%s stats not available via KVM.", name);
@ -593,28 +608,33 @@ ip_stats(u_long off, const char *name)
printf("%s:\n", name);
#define ps(f, m) if (ipstat[f] || sflag <= 1) \
printf(m, ipstat[f])
#define p(f, m) if (ipstat[f] || sflag <= 1) \
printf(m, ipstat[f], plural(ipstat[f]))
#define ps(f, m) if (ipstat[f] || sflag <= 1) \
printf(m, ipstat[f])
#define p(f, m) if (ipstat[f] || sflag <= 1) \
printf(m, ipstat[f], plural(ipstat[f]))
p(IP_STAT_TOTAL, "\t%" PRIu64 " total packet%s received\n");
p(IP_STAT_BADSUM, "\t%" PRIu64 " bad header checksum%s\n");
ps(IP_STAT_TOOSMALL, "\t%" PRIu64 " with size smaller than minimum\n");
ps(IP_STAT_TOOSHORT, "\t%" PRIu64 " with data size < data length\n");
ps(IP_STAT_TOOLONG, "\t%" PRIu64 " with length > max ip packet size\n");
ps(IP_STAT_TOOLONG,
"\t%" PRIu64 " with length > max ip packet size\n");
ps(IP_STAT_BADHLEN, "\t%" PRIu64 " with header length < data size\n");
ps(IP_STAT_BADLEN, "\t%" PRIu64 " with data length < header length\n");
ps(IP_STAT_BADOPTIONS, "\t%" PRIu64 " with bad options\n");
ps(IP_STAT_BADVERS, "\t%" PRIu64 " with incorrect version number\n");
p(IP_STAT_FRAGMENTS, "\t%" PRIu64 " fragment%s received\n");
p(IP_STAT_FRAGDROPPED, "\t%" PRIu64 " fragment%s dropped (dup or out of space)\n");
p(IP_STAT_RCVMEMDROP, "\t%" PRIu64 " fragment%s dropped (out of ipqent)\n");
p(IP_STAT_FRAGDROPPED,
"\t%" PRIu64 " fragment%s dropped (dup or out of space)\n");
p(IP_STAT_RCVMEMDROP,
"\t%" PRIu64 " fragment%s dropped (out of ipqent)\n");
p(IP_STAT_BADFRAGS, "\t%" PRIu64 " malformed fragment%s dropped\n");
p(IP_STAT_FRAGTIMEOUT, "\t%" PRIu64 " fragment%s dropped after timeout\n");
p(IP_STAT_FRAGTIMEOUT,
"\t%" PRIu64 " fragment%s dropped after timeout\n");
p(IP_STAT_REASSEMBLED, "\t%" PRIu64 " packet%s reassembled ok\n");
p(IP_STAT_DELIVERED, "\t%" PRIu64 " packet%s for this host\n");
p(IP_STAT_NOPROTO, "\t%" PRIu64 " packet%s for unknown/unsupported protocol\n");
p(IP_STAT_NOPROTO,
"\t%" PRIu64 " packet%s for unknown/unsupported protocol\n");
p(IP_STAT_FORWARD, "\t%" PRIu64 " packet%s forwarded");
p(IP_STAT_FASTFORWARD, " (%" PRIu64 " packet%s fast forwarded)");
if (ipstat[IP_STAT_FORWARD] || sflag <= 1)
@ -622,24 +642,39 @@ ip_stats(u_long off, const char *name)
p(IP_STAT_CANTFORWARD, "\t%" PRIu64 " packet%s not forwardable\n");
p(IP_STAT_REDIRECTSENT, "\t%" PRIu64 " redirect%s sent\n");
p(IP_STAT_NOGIF, "\t%" PRIu64 " packet%s no matching gif found\n");
p(IP_STAT_NOIPSEC, "\t%" PRIu64 " packet%s no matching ipsecif found\n");
p(IP_STAT_NOIPSEC,
"\t%" PRIu64 " packet%s no matching ipsecif found\n");
p(IP_STAT_LOCALOUT, "\t%" PRIu64 " packet%s sent from this host\n");
p(IP_STAT_RAWOUT, "\t%" PRIu64 " packet%s sent with fabricated ip header\n");
p(IP_STAT_ODROPPED, "\t%" PRIu64 " output packet%s dropped due to no bufs, etc.\n");
p(IP_STAT_NOROUTE, "\t%" PRIu64 " output packet%s discarded due to no route\n");
p(IP_STAT_RAWOUT,
"\t%" PRIu64 " packet%s sent with fabricated ip header\n");
p(IP_STAT_ODROPPED,
"\t%" PRIu64 " output packet%s dropped due to no bufs, etc.\n");
p(IP_STAT_NOROUTE,
"\t%" PRIu64 " output packet%s discarded due to no route\n");
p(IP_STAT_FRAGMENTED, "\t%" PRIu64 " output datagram%s fragmented\n");
p(IP_STAT_OFRAGMENTS, "\t%" PRIu64 " fragment%s created\n");
p(IP_STAT_CANTFRAG, "\t%" PRIu64 " datagram%s that can't be fragmented\n");
p(IP_STAT_BADADDR, "\t%" PRIu64 " datagram%s with bad address in header\n");
p(IP_STAT_PFILDROP_IN, "\t%" PRIu64 " input packet%s dropped by pfil\n");
p(IP_STAT_PFILDROP_OUT, "\t%" PRIu64 " output packet%s dropped by pfil\n");
p(IP_STAT_IPSECDROP_IN, "\t%" PRIu64 " input packet%s dropped by IPsec\n");
p(IP_STAT_IPSECDROP_OUT, "\t%" PRIu64 " output packet%s dropped by IPsec\n");
p(IP_STAT_IFDROP, "\t%" PRIu64 " input packet%s dropped due to interface state\n");
p(IP_STAT_TIMXCEED, "\t%" PRIu64 " packet%s dropped due to TTL exceeded\n");
p(IP_STAT_IFNOADDR, "\t%" PRIu64 " output packet%s dropped (no IP address)\n");
p(IP_STAT_RTREJECT, "\t%" PRIu64 " output packet%s discarded due to reject route\n");
p(IP_STAT_BCASTDENIED, "\t%" PRIu64 " output packet%s dropped (broadcast prohibited)\n");
p(IP_STAT_CANTFRAG,
"\t%" PRIu64 " datagram%s that can't be fragmented\n");
p(IP_STAT_BADADDR,
"\t%" PRIu64 " datagram%s with bad address in header\n");
p(IP_STAT_PFILDROP_IN,
"\t%" PRIu64 " input packet%s dropped by pfil\n");
p(IP_STAT_PFILDROP_OUT,
"\t%" PRIu64 " output packet%s dropped by pfil\n");
p(IP_STAT_IPSECDROP_IN,
"\t%" PRIu64 " input packet%s dropped by IPsec\n");
p(IP_STAT_IPSECDROP_OUT,
"\t%" PRIu64 " output packet%s dropped by IPsec\n");
p(IP_STAT_IFDROP,
"\t%" PRIu64 " input packet%s dropped due to interface state\n");
p(IP_STAT_TIMXCEED,
"\t%" PRIu64 " packet%s dropped due to TTL exceeded\n");
p(IP_STAT_IFNOADDR,
"\t%" PRIu64 " output packet%s dropped (no IP address)\n");
p(IP_STAT_RTREJECT,
"\t%" PRIu64 " output packet%s discarded due to reject route\n");
p(IP_STAT_BCASTDENIED,
"\t%" PRIu64 " output packet%s dropped (broadcast prohibited)\n");
#undef ps
#undef p
}
@ -670,8 +705,8 @@ icmp_stats(u_long off, const char *name)
printf(m, icmpstat[f], plural(icmpstat[f]))
p(ICMP_STAT_ERROR, "\t%" PRIu64 " call%s to icmp_error\n");
p(ICMP_STAT_OLDICMP,
"\t%" PRIu64 " error%s not generated because old message was icmp\n");
p(ICMP_STAT_OLDICMP, "\t%" PRIu64
" error%s not generated because old message was icmp\n");
for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++)
if (icmpstat[ICMP_STAT_OUTHIST + i] != 0) {
if (first) {
@ -685,8 +720,10 @@ icmp_stats(u_long off, const char *name)
p(ICMP_STAT_TOOSHORT, "\t%" PRIu64 " message%s < minimum length\n");
p(ICMP_STAT_CHECKSUM, "\t%" PRIu64 " bad checksum%s\n");
p(ICMP_STAT_BADLEN, "\t%" PRIu64 " message%s with bad length\n");
p(ICMP_STAT_BMCASTECHO, "\t%" PRIu64 " multicast echo request%s ignored\n");
p(ICMP_STAT_BMCASTTSTAMP, "\t%" PRIu64 " multicast timestamp request%s ignored\n");
p(ICMP_STAT_BMCASTECHO,
"\t%" PRIu64 " multicast echo request%s ignored\n");
p(ICMP_STAT_BMCASTTSTAMP,
"\t%" PRIu64 " multicast timestamp request%s ignored\n");
for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++)
if (icmpstat[ICMP_STAT_INHIST + i] != 0) {
if (first) {
@ -713,7 +750,7 @@ igmp_stats(u_long off, const char *name)
size_t size = sizeof(igmpstat);
if (prog_sysctlbyname("net.inet.igmp.stats", igmpstat, &size,
NULL, 0) == -1 && errno != ENOMEM)
NULL, 0) == -1 && errno != ENOMEM)
return;
} else {
warnx("%s stats not available via KVM.", name);
@ -722,19 +759,28 @@ igmp_stats(u_long off, const char *name)
printf("%s:\n", name);
#define p(f, m) if (igmpstat[f] || sflag <= 1) \
printf(m, igmpstat[f], plural(igmpstat[f]))
#define py(f, m) if (igmpstat[f] || sflag <= 1) \
printf(m, igmpstat[f], igmpstat[f] != 1 ? "ies" : "y")
#define p(f, m) if (igmpstat[f] || sflag <= 1) \
printf(m, igmpstat[f], plural(igmpstat[f]))
#define py(f, m) if (igmpstat[f] || sflag <= 1) \
printf(m, igmpstat[f], igmpstat[f] != 1 ? "ies" : "y")
p(IGMP_STAT_RCV_TOTAL, "\t%" PRIu64 " message%s received\n");
p(IGMP_STAT_RCV_TOOSHORT, "\t%" PRIu64 " message%s received with too few bytes\n");
p(IGMP_STAT_RCV_BADSUM, "\t%" PRIu64 " message%s received with bad checksum\n");
py(IGMP_STAT_RCV_QUERIES, "\t%" PRIu64 " membership quer%s received\n");
py(IGMP_STAT_RCV_BADQUERIES, "\t%" PRIu64 " membership quer%s received with invalid field(s)\n");
p(IGMP_STAT_RCV_REPORTS, "\t%" PRIu64 " membership report%s received\n");
p(IGMP_STAT_RCV_BADREPORTS, "\t%" PRIu64 " membership report%s received with invalid field(s)\n");
p(IGMP_STAT_RCV_OURREPORTS, "\t%" PRIu64 " membership report%s received for groups to which we belong\n");
p(IGMP_STAT_SND_REPORTS, "\t%" PRIu64 " membership report%s sent\n");
p(IGMP_STAT_RCV_TOOSHORT,
"\t%" PRIu64 " message%s received with too few bytes\n");
p(IGMP_STAT_RCV_BADSUM,
"\t%" PRIu64 " message%s received with bad checksum\n");
py(IGMP_STAT_RCV_QUERIES,
"\t%" PRIu64 " membership quer%s received\n");
py(IGMP_STAT_RCV_BADQUERIES,
"\t%" PRIu64 " membership quer%s received with invalid field(s)\n");
p(IGMP_STAT_RCV_REPORTS,
"\t%" PRIu64 " membership report%s received\n");
p(IGMP_STAT_RCV_BADREPORTS, "\t%" PRIu64
" membership report%s received with invalid field(s)\n");
p(IGMP_STAT_RCV_OURREPORTS, "\t%" PRIu64
" membership report%s received for groups to which we belong\n");
p(IGMP_STAT_SND_REPORTS,
"\t%" PRIu64 " membership report%s sent\n");
#undef p
#undef py
}
@ -772,17 +818,18 @@ carp_stats(u_long off, const char *name)
p(CARP_STAT_BADTTL,
"\t\t%" PRIu64 " packet%s discarded for wrong TTL\n");
p(CARP_STAT_HDROPS, "\t\t%" PRIu64 " packet%s shorter than header\n");
p(CARP_STAT_BADSUM, "\t\t%" PRIu64
" packet%s discarded for bad checksum\n");
p(CARP_STAT_BADSUM,
"\t\t%" PRIu64 " packet%s discarded for bad checksum\n");
p(CARP_STAT_BADVER,
"\t\t%" PRIu64 " packet%s discarded with a bad version\n");
p2(CARP_STAT_BADLEN,
"\t\t%" PRIu64 " discarded because packet was too short\n");
p(CARP_STAT_BADAUTH,
"\t\t%" PRIu64 " packet%s discarded for bad authentication\n");
p(CARP_STAT_BADVHID, "\t\t%" PRIu64 " packet%s discarded for bad vhid\n");
p(CARP_STAT_BADVHID,
"\t\t%" PRIu64 " packet%s discarded for bad vhid\n");
p(CARP_STAT_BADADDRS, "\t\t%" PRIu64
" packet%s discarded because of a bad address list\n");
" packet%s discarded because of a bad address list\n");
p(CARP_STAT_OPACKETS, "\t%" PRIu64 " packet%s sent (IPv4)\n");
p(CARP_STAT_OPACKETS6, "\t%" PRIu64 " packet%s sent (IPv6)\n");
p2(CARP_STAT_ONOMEM,
@ -813,15 +860,24 @@ pim_stats(u_long off, const char *name)
p(pims_rcv_total_msgs, "\t%" PRIu64 " message%s received\n");
p(pims_rcv_total_bytes, "\t%" PRIu64 " byte%s received\n");
p(pims_rcv_tooshort, "\t%" PRIu64 " message%s received with too few bytes\n");
p(pims_rcv_badsum, "\t%" PRIu64 " message%s received with bad checksum\n");
p(pims_rcv_badversion, "\t%" PRIu64 " message%s received with bad version\n");
p(pims_rcv_registers_msgs, "\t%" PRIu64 " data register message%s received\n");
p(pims_rcv_registers_bytes, "\t%" PRIu64 " data register byte%s received\n");
p(pims_rcv_registers_wrongiif, "\t%" PRIu64 " data register message%s received on wrong iif\n");
p(pims_rcv_badregisters, "\t%" PRIu64 " bad register%s received\n");
p(pims_snd_registers_msgs, "\t%" PRIu64 " data register message%s sent\n");
p(pims_snd_registers_bytes, "\t%" PRIu64 " data register byte%s sent\n");
p(pims_rcv_tooshort,
"\t%" PRIu64 " message%s received with too few bytes\n");
p(pims_rcv_badsum,
"\t%" PRIu64 " message%s received with bad checksum\n");
p(pims_rcv_badversion,
"\t%" PRIu64 " message%s received with bad version\n");
p(pims_rcv_registers_msgs,
"\t%" PRIu64 " data register message%s received\n");
p(pims_rcv_registers_bytes,
"\t%" PRIu64 " data register byte%s received\n");
p(pims_rcv_registers_wrongiif,
"\t%" PRIu64 " data register message%s received on wrong iif\n");
p(pims_rcv_badregisters,
"\t%" PRIu64 " bad register%s received\n");
p(pims_snd_registers_msgs,
"\t%" PRIu64 " data register message%s sent\n");
p(pims_snd_registers_bytes,
"\t%" PRIu64 " data register byte%s sent\n");
#undef p
}
@ -859,22 +915,33 @@ arp_stats(u_long off, const char *name)
p(ARP_STAT_RCVREPLY, "\t\t%" PRIu64 " reply packet%s\n");
p(ARP_STAT_RCVREQUEST, "\t\t%" PRIu64 " valid request packet%s\n");
p(ARP_STAT_RCVMCAST, "\t\t%" PRIu64 " broadcast/multicast packet%s\n");
p(ARP_STAT_RCVBADPROTO, "\t\t%" PRIu64 " packet%s with unknown protocol type\n");
p(ARP_STAT_RCVBADLEN, "\t\t%" PRIu64 " packet%s with bad (short) length\n");
p(ARP_STAT_RCVZEROTPA, "\t\t%" PRIu64 " packet%s with null target IP address\n");
p(ARP_STAT_RCVZEROSPA, "\t\t%" PRIu64 " packet%s with null source IP address\n");
ps(ARP_STAT_RCVNOINT, "\t\t%" PRIu64 " could not be mapped to an interface\n");
p(ARP_STAT_RCVLOCALSHA, "\t\t%" PRIu64 " packet%s sourced from a local hardware "
p(ARP_STAT_RCVBADPROTO,
"\t\t%" PRIu64 " packet%s with unknown protocol type\n");
p(ARP_STAT_RCVBADLEN,
"\t\t%" PRIu64 " packet%s with bad (short) length\n");
p(ARP_STAT_RCVZEROTPA,
"\t\t%" PRIu64 " packet%s with null target IP address\n");
p(ARP_STAT_RCVZEROSPA,
"\t\t%" PRIu64 " packet%s with null source IP address\n");
ps(ARP_STAT_RCVNOINT,
"\t\t%" PRIu64 " could not be mapped to an interface\n");
p(ARP_STAT_RCVLOCALSHA,
"\t\t%" PRIu64 " packet%s sourced from a local hardware "
"address\n");
p(ARP_STAT_RCVBCASTSHA, "\t\t%" PRIu64 " packet%s with a broadcast "
"source hardware address\n");
p(ARP_STAT_RCVLOCALSPA, "\t\t%" PRIu64 " duplicate%s for a local IP address\n");
p(ARP_STAT_RCVOVERPERM, "\t\t%" PRIu64 " attempt%s to overwrite a static entry\n");
p(ARP_STAT_RCVOVERINT, "\t\t%" PRIu64 " packet%s received on wrong interface\n");
p(ARP_STAT_RCVLOCALSPA,
"\t\t%" PRIu64 " duplicate%s for a local IP address\n");
p(ARP_STAT_RCVOVERPERM,
"\t\t%" PRIu64 " attempt%s to overwrite a static entry\n");
p(ARP_STAT_RCVOVERINT,
"\t\t%" PRIu64 " packet%s received on wrong interface\n");
p(ARP_STAT_RCVOVER, "\t\t%" PRIu64 " entry%s overwritten\n");
p(ARP_STAT_RCVLENCHG, "\t\t%" PRIu64 " change%s in hardware address length\n");
p(ARP_STAT_RCVLENCHG,
"\t\t%" PRIu64 " change%s in hardware address length\n");
p(ARP_STAT_DFRTOTAL, "\t%" PRIu64 " packet%s deferred pending ARP resolution\n");
p(ARP_STAT_DFRTOTAL,
"\t%" PRIu64 " packet%s deferred pending ARP resolution\n");
ps(ARP_STAT_DFRSENT, "\t\t%" PRIu64 " sent\n");
ps(ARP_STAT_DFRDROPPED, "\t\t%" PRIu64 " dropped\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet6.c,v 1.80 2022/09/01 10:10:20 msaitoh Exp $ */
/* $NetBSD: inet6.c,v 1.81 2022/09/02 06:25:43 msaitoh Exp $ */
/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
/*
@ -64,7 +64,7 @@
#if 0
static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
__RCSID("$NetBSD: inet6.c,v 1.80 2022/09/01 10:10:20 msaitoh Exp $");
__RCSID("$NetBSD: inet6.c,v 1.81 2022/09/02 06:25:43 msaitoh Exp $");
#endif
#endif /* not lint */
@ -435,47 +435,51 @@ tcp6_stats(u_long off, const char *name)
p(tcp6s_sndtotal, "\t%ld packet%s sent\n");
p2(tcp6s_sndpack,tcp6s_sndbyte,
"\t\t%ld data packet%s (%ld byte%s)\n");
"\t\t%ld data packet%s (%ld byte%s)\n");
p2(tcp6s_sndrexmitpack, tcp6s_sndrexmitbyte,
"\t\t%ld data packet%s (%ld byte%s) retransmitted\n");
"\t\t%ld data packet%s (%ld byte%s) retransmitted\n");
p2(tcp6s_sndacks, tcp6s_delack,
"\t\t%ld ack-only packet%s (%ld packet%s delayed)\n");
"\t\t%ld ack-only packet%s (%ld packet%s delayed)\n");
p(tcp6s_sndurg, "\t\t%ld URG only packet%s\n");
p(tcp6s_sndprobe, "\t\t%ld window probe packet%s\n");
p(tcp6s_sndwinup, "\t\t%ld window update packet%s\n");
p(tcp6s_sndctrl, "\t\t%ld control packet%s\n");
p(tcp6s_rcvtotal, "\t%ld packet%s received\n");
p2(tcp6s_rcvackpack, tcp6s_rcvackbyte, "\t\t%ld ack%s (for %ld byte%s)\n");
p2(tcp6s_rcvackpack, tcp6s_rcvackbyte,
"\t\t%ld ack%s (for %ld byte%s)\n");
p(tcp6s_rcvdupack, "\t\t%ld duplicate ack%s\n");
p(tcp6s_rcvacktoomuch, "\t\t%ld ack%s for unsent data\n");
p2(tcp6s_rcvpack, tcp6s_rcvbyte,
"\t\t%ld packet%s (%ld byte%s) received in-sequence\n");
"\t\t%ld packet%s (%ld byte%s) received in-sequence\n");
p2(tcp6s_rcvduppack, tcp6s_rcvdupbyte,
"\t\t%ld completely duplicate packet%s (%ld byte%s)\n");
"\t\t%ld completely duplicate packet%s (%ld byte%s)\n");
p(tcp6s_pawsdrop, "\t\t%ld old duplicate packet%s\n");
p2(tcp6s_rcvpartduppack, tcp6s_rcvpartdupbyte,
"\t\t%ld packet%s with some dup. data (%ld byte%s duped)\n");
"\t\t%ld packet%s with some dup. data (%ld byte%s duped)\n");
p2(tcp6s_rcvoopack, tcp6s_rcvoobyte,
"\t\t%ld out-of-order packet%s (%ld byte%s)\n");
"\t\t%ld out-of-order packet%s (%ld byte%s)\n");
p2(tcp6s_rcvpackafterwin, tcp6s_rcvbyteafterwin,
"\t\t%ld packet%s (%ld byte%s) of data after window\n");
"\t\t%ld packet%s (%ld byte%s) of data after window\n");
p(tcp6s_rcvwinprobe, "\t\t%ld window probe%s\n");
p(tcp6s_rcvwinupd, "\t\t%ld window update packet%s\n");
p(tcp6s_rcvafterclose, "\t\t%ld packet%s received after close\n");
p(tcp6s_rcvbadsum, "\t\t%ld discarded for bad checksum%s\n");
p(tcp6s_rcvbadoff, "\t\t%ld discarded for bad header offset field%s\n");
p(tcp6s_rcvbadoff,
"\t\t%ld discarded for bad header offset field%s\n");
p(tcp6s_rcvshort, "\t\t%ld discarded because packet%s too short\n");
p(tcp6s_connattempt, "\t%ld connection request%s\n");
p(tcp6s_accepts, "\t%ld connection accept%s\n");
p(tcp6s_badsyn, "\t%ld bad connection attempt%s\n");
p(tcp6s_connects, "\t%ld connection%s established (including accepts)\n");
p(tcp6s_connects,
"\t%ld connection%s established (including accepts)\n");
p2(tcp6s_closed, tcp6s_drops,
"\t%ld connection%s closed (including %ld drop%s)\n");
"\t%ld connection%s closed (including %ld drop%s)\n");
p(tcp6s_conndrops, "\t%ld embryonic connection%s dropped\n");
p2(tcp6s_rttupdated, tcp6s_segstimed,
"\t%ld segment%s updated rtt (of %ld attempt%s)\n");
"\t%ld segment%s updated rtt (of %ld attempt%s)\n");
p(tcp6s_rexmttimeo, "\t%ld retransmit timeout%s\n");
p(tcp6s_timeoutdrop, "\t\t%ld connection%s dropped by rexmit timeout\n");
p(tcp6s_timeoutdrop,
"\t\t%ld connection%s dropped by rexmit timeout\n");
p(tcp6s_persisttimeo, "\t%ld persist timeout%s\n");
p(tcp6s_persistdrop, "\t%ld connection%s timed out in persist\n");
p(tcp6s_keeptimeo, "\t%ld keepalive timeout%s\n");
@ -681,7 +685,8 @@ ip6_stats(u_long off, const char *name)
p(IP6_STAT_RAWOUT, "\t%llu packet%s sent with fabricated ip header\n");
p(IP6_STAT_ODROPPED,
"\t%llu output packet%s dropped due to no bufs, etc.\n");
p(IP6_STAT_NOROUTE, "\t%llu output packet%s discarded due to no route\n");
p(IP6_STAT_NOROUTE,
"\t%llu output packet%s discarded due to no route\n");
p(IP6_STAT_FRAGMENTED, "\t%llu output datagram%s fragmented\n");
p(IP6_STAT_OFRAGMENTS, "\t%llu fragment%s created\n");
p(IP6_STAT_CANTFRAG, "\t%llu datagram%s that can't be fragmented\n");
@ -724,7 +729,8 @@ ip6_stats(u_long off, const char *name)
p(IP6_STAT_EXTHDRTOOLONG,
"\t%llu packet%s whose headers are not continuous\n");
p(IP6_STAT_NOGIF, "\t%llu tunneling packet%s that can't find gif\n");
p(IP6_STAT_NOIPSEC, "\t%llu tunneling packet%s that can't find ipsecif\n");
p(IP6_STAT_NOIPSEC,
"\t%llu tunneling packet%s that can't find ipsecif\n");
p(IP6_STAT_TOOMANYHDR,
"\t%llu packet%s discarded due to too many headers\n");
@ -803,11 +809,15 @@ ip6_stats(u_long off, const char *name)
p(IP6_STAT_PFILDROP_OUT, "\t%llu output packet%s dropped by pfil\n");
p(IP6_STAT_IPSECDROP_IN, "\t%llu input packet%s dropped by IPsec\n");
p(IP6_STAT_IPSECDROP_OUT, "\t%llu output packet%s dropped by IPsec\n");
p(IP6_STAT_IFDROP, "\t%llu input packet%s dropped due to interface state\n");
p(IP6_STAT_IDROPPED, "\t%llu input packet%s dropped due to no bufs, etc.\n");
p(IP6_STAT_TIMXCEED, "\t%llu packet%s dropped due to hop limit exceeded\n");
p(IP6_STAT_IFDROP,
"\t%llu input packet%s dropped due to interface state\n");
p(IP6_STAT_IDROPPED,
"\t%llu input packet%s dropped due to no bufs, etc.\n");
p(IP6_STAT_TIMXCEED,
"\t%llu packet%s dropped due to hop limit exceeded\n");
p(IP6_STAT_TOOBIG, "\t%llu packet%s dropped (too big)\n");
p(IP6_STAT_RTREJECT, "\t%llu output packet%s discarded due to reject route\n");
p(IP6_STAT_RTREJECT,
"\t%llu output packet%s discarded due to reject route\n");
#undef p
#undef p1
}
@ -845,17 +855,19 @@ ip6_ifstats(const char *ifname)
p(ifs6_in_noroute, "\t%llu datagram%s with no route received\n");
p(ifs6_in_addrerr, "\t%llu datagram%s with invalid dst received\n");
p(ifs6_in_truncated, "\t%llu truncated datagram%s received\n");
p(ifs6_in_protounknown, "\t%llu datagram%s with unknown proto received\n");
p(ifs6_in_protounknown,
"\t%llu datagram%s with unknown proto received\n");
p(ifs6_in_discard, "\t%llu input datagram%s discarded\n");
p(ifs6_in_deliver,
"\t%llu datagram%s delivered to an upper layer protocol\n");
"\t%llu datagram%s delivered to an upper layer protocol\n");
p(ifs6_out_forward, "\t%llu datagram%s forwarded to this interface\n");
p(ifs6_out_request,
"\t%llu datagram%s sent from an upper layer protocol\n");
"\t%llu datagram%s sent from an upper layer protocol\n");
p(ifs6_out_discard, "\t%llu total discarded output datagram%s\n");
p(ifs6_out_fragok, "\t%llu output datagram%s fragmented\n");
p(ifs6_out_fragfail, "\t%llu output datagram%s failed on fragment\n");
p(ifs6_out_fragcreat, "\t%llu output datagram%s succeeded on fragment\n");
p(ifs6_out_fragcreat,
"\t%llu output datagram%s succeeded on fragment\n");
p(ifs6_reass_reqd, "\t%llu incoming datagram%s fragmented\n");
p(ifs6_reass_ok, "\t%llu datagram%s reassembled\n");
p(ifs6_reass_fail, "\t%llu datagram%s failed on reassembling\n");
@ -1186,27 +1198,38 @@ icmp6_stats(u_long off, const char *name)
}
printf("\tHistogram of error messages to be generated:\n");
p_oerr(ICMP6_ERRSTAT_DST_UNREACH_NOROUTE, "\t\t%llu no route\n");
p_oerr(ICMP6_ERRSTAT_DST_UNREACH_ADMIN, "\t\t%llu administratively prohibited\n");
p_oerr(ICMP6_ERRSTAT_DST_UNREACH_BEYONDSCOPE, "\t\t%llu beyond scope\n");
p_oerr(ICMP6_ERRSTAT_DST_UNREACH_ADDR, "\t\t%llu address unreachable\n");
p_oerr(ICMP6_ERRSTAT_DST_UNREACH_NOPORT, "\t\t%llu port unreachable\n");
p_oerr(ICMP6_ERRSTAT_DST_UNREACH_ADMIN,
"\t\t%llu administratively prohibited\n");
p_oerr(ICMP6_ERRSTAT_DST_UNREACH_BEYONDSCOPE,
"\t\t%llu beyond scope\n");
p_oerr(ICMP6_ERRSTAT_DST_UNREACH_ADDR,
"\t\t%llu address unreachable\n");
p_oerr(ICMP6_ERRSTAT_DST_UNREACH_NOPORT,
"\t\t%llu port unreachable\n");
p_oerr(ICMP6_ERRSTAT_PACKET_TOO_BIG, "\t\t%llu packet too big\n");
p_oerr(ICMP6_ERRSTAT_TIME_EXCEED_TRANSIT, "\t\t%llu time exceed transit\n");
p_oerr(ICMP6_ERRSTAT_TIME_EXCEED_REASSEMBLY, "\t\t%llu time exceed reassembly\n");
p_oerr(ICMP6_ERRSTAT_PARAMPROB_HEADER, "\t\t%llu erroneous header field\n");
p_oerr(ICMP6_ERRSTAT_PARAMPROB_NEXTHEADER, "\t\t%llu unrecognized next header\n");
p_oerr(ICMP6_ERRSTAT_PARAMPROB_OPTION, "\t\t%llu unrecognized option\n");
p_oerr(ICMP6_ERRSTAT_TIME_EXCEED_TRANSIT,
"\t\t%llu time exceed transit\n");
p_oerr(ICMP6_ERRSTAT_TIME_EXCEED_REASSEMBLY,
"\t\t%llu time exceed reassembly\n");
p_oerr(ICMP6_ERRSTAT_PARAMPROB_HEADER,
"\t\t%llu erroneous header field\n");
p_oerr(ICMP6_ERRSTAT_PARAMPROB_NEXTHEADER,
"\t\t%llu unrecognized next header\n");
p_oerr(ICMP6_ERRSTAT_PARAMPROB_OPTION,
"\t\t%llu unrecognized option\n");
p_oerr(ICMP6_ERRSTAT_REDIRECT, "\t\t%llu redirect\n");
p_oerr(ICMP6_ERRSTAT_UNKNOWN, "\t\t%llu unknown\n");
p(ICMP6_STAT_REFLECT, "\t%llu message response%s generated\n");
p(ICMP6_STAT_ND_TOOMANYOPT, "\t%llu message%s with too many ND options\n");
p(ICMP6_STAT_ND_TOOMANYOPT,
"\t%llu message%s with too many ND options\n");
p(ICMP6_STAT_ND_BADOPT, "\t%llu message%s with bad ND options\n");
p(ICMP6_STAT_BADNS, "\t%llu bad neighbor solicitation message%s\n");
p(ICMP6_STAT_BADNA, "\t%llu bad neighbor advertisement message%s\n");
p(ICMP6_STAT_BADRS, "\t%llu bad router solicitation message%s\n");
p(ICMP6_STAT_BADRA, "\t%llu bad router advertisement message%s\n");
p(ICMP6_STAT_DROPPED_RAROUTE, "\t%llu router advertisement route%s dropped\n");
p(ICMP6_STAT_DROPPED_RAROUTE,
"\t%llu router advertisement route%s dropped\n");
p(ICMP6_STAT_BADREDIRECT, "\t%llu bad redirect message%s\n");
p(ICMP6_STAT_PMTUCHG, "\t%llu path MTU change%s\n");
#undef p
@ -1240,8 +1263,10 @@ icmp6_ifstats(const char *ifname)
p(ifs6_in_msg, "\t%llu total input message%s\n");
p(ifs6_in_error, "\t%llu total input error message%s\n");
p(ifs6_in_dstunreach, "\t%llu input destination unreachable error%s\n");
p(ifs6_in_adminprohib, "\t%llu input administratively prohibited error%s\n");
p(ifs6_in_dstunreach,
"\t%llu input destination unreachable error%s\n");
p(ifs6_in_adminprohib,
"\t%llu input administratively prohibited error%s\n");
p(ifs6_in_timeexceed, "\t%llu input time exceeded error%s\n");
p(ifs6_in_paramprob, "\t%llu input parameter problem error%s\n");
p(ifs6_in_pkttoobig, "\t%llu input packet too big error%s\n");
@ -1258,8 +1283,10 @@ icmp6_ifstats(const char *ifname)
p(ifs6_out_msg, "\t%llu total output message%s\n");
p(ifs6_out_error, "\t%llu total output error message%s\n");
p(ifs6_out_dstunreach, "\t%llu output destination unreachable error%s\n");
p(ifs6_out_adminprohib, "\t%llu output administratively prohibited error%s\n");
p(ifs6_out_dstunreach,
"\t%llu output destination unreachable error%s\n");
p(ifs6_out_adminprohib,
"\t%llu output administratively prohibited error%s\n");
p(ifs6_out_timeexceed, "\t%llu output time exceeded error%s\n");
p(ifs6_out_paramprob, "\t%llu output parameter problem error%s\n");
p(ifs6_out_pkttoobig, "\t%llu output packet too big error%s\n");
@ -1303,9 +1330,12 @@ pim6_stats(u_long off, const char *name)
printf(m, (unsigned long long)pim6stat[f], plural(pim6stat[f]))
p(PIM6_STAT_RCV_TOTAL, "\t%llu message%s received\n");
p(PIM6_STAT_RCV_TOOSHORT, "\t%llu message%s received with too few bytes\n");
p(PIM6_STAT_RCV_BADSUM, "\t%llu message%s received with bad checksum\n");
p(PIM6_STAT_RCV_BADVERSION, "\t%llu message%s received with bad version\n");
p(PIM6_STAT_RCV_TOOSHORT,
"\t%llu message%s received with too few bytes\n");
p(PIM6_STAT_RCV_BADSUM,
"\t%llu message%s received with bad checksum\n");
p(PIM6_STAT_RCV_BADVERSION,
"\t%llu message%s received with bad version\n");
p(PIM6_STAT_RCV_REGISTERS, "\t%llu register%s received\n");
p(PIM6_STAT_RCV_BADREGISTERS, "\t%llu bad register%s received\n");
p(PIM6_STAT_SND_REGISTERS, "\t%llu register%s sent\n");
@ -1361,15 +1391,16 @@ rip6_stats(u_long off, const char *name)
void
inet6print(const struct in6_addr *in6, int port, const char *proto)
{
#define GETSERVBYPORT6(port, proto, ret)\
do {\
if (strcmp((proto), "tcp6") == 0)\
(ret) = getservbyport((int)(port), "tcp");\
else if (strcmp((proto), "udp6") == 0)\
(ret) = getservbyport((int)(port), "udp");\
else\
(ret) = getservbyport((int)(port), (proto));\
} while (0)
#define GETSERVBYPORT6(port, proto, ret) \
do { \
if (strcmp((proto), "tcp6") == 0) \
(ret) = getservbyport((int)(port), "tcp"); \
else if (strcmp((proto), "udp6") == 0) \
(ret) = getservbyport((int)(port), "udp"); \
else \
(ret) = getservbyport((int)(port), (proto)); \
} while (0)
struct servent *sp = 0;
char line[80], *cp;
int lwidth;

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.102 2022/09/01 10:10:20 msaitoh Exp $ */
/* $NetBSD: main.c,v 1.103 2022/09/02 06:25:43 msaitoh Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\
#if 0
static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94";
#else
__RCSID("$NetBSD: main.c,v 1.102 2022/09/01 10:10:20 msaitoh Exp $");
__RCSID("$NetBSD: main.c,v 1.103 2022/09/02 06:25:43 msaitoh Exp $");
#endif
#endif /* not lint */
@ -353,6 +353,7 @@ void
prepare(const char *nf, const char *mf, struct protox *tp)
{
char buf[_POSIX2_LINE_MAX];
/*
* Try to figure out if we can use sysctl or not.
*/
@ -383,7 +384,7 @@ prepare(const char *nf, const char *mf, struct protox *tp)
if (force_sysctl && !use_sysctl) {
/* Let the user know what's about to happen. */
warnx("forcing sysctl usage even though it might not be "\
warnx("forcing sysctl usage even though it might not be "
"supported");
use_sysctl = 1;
}
@ -485,8 +486,7 @@ main(int argc, char *argv[])
errno = 0;
pcbaddr = strtoul(optarg, &cp, 16);
if (*cp != '\0' || errno == ERANGE)
errx(1, "invalid PCB address %s",
optarg);
errx(1, "invalid PCB address %s", optarg);
Pflag = 1;
break;
case 'p':
@ -755,9 +755,8 @@ printproto(struct protox *tp, const char *name)
pr = tp->pr_cblocks;
off = nl[tp->pr_index].n_value;
}
if (pr != NULL && ((off || af != AF_UNSPEC) || use_sysctl)) {
if (pr != NULL && ((off || af != AF_UNSPEC) || use_sysctl))
(*pr)(off, name);
}
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pfkey.c,v 1.4 2022/09/01 10:10:20 msaitoh Exp $ */
/* $NetBSD: pfkey.c,v 1.5 2022/09/02 06:25:43 msaitoh Exp $ */
/* $KAME: ipsec.c,v 1.33 2003/07/25 09:54:32 itojun Exp $ */
/*
@ -65,7 +65,7 @@
static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
#ifdef __NetBSD__
__RCSID("$NetBSD: pfkey.c,v 1.4 2022/09/01 10:10:20 msaitoh Exp $");
__RCSID("$NetBSD: pfkey.c,v 1.5 2022/09/02 06:25:43 msaitoh Exp $");
#endif
#endif
#endif /* not lint */
@ -131,7 +131,7 @@ pfkey_stats(u_long off, const char *name)
printf ("%s:\n", name);
#define p(f, m) if (pfkeystat[f] || sflag <= 1) \
#define p(f, m) if (pfkeystat[f] || sflag <= 1) \
printf(m, (unsigned long long)pfkeystat[f], plural(pfkeystat[f]))
/* userland -> kernel */
@ -147,15 +147,24 @@ pfkey_stats(u_long off, const char *name)
printf("\t\t%s: %llu\n", pfkey_msgtype_names(type),
(unsigned long long)pfkeystat[PFKEY_STAT_OUT_MSGTYPE + type]);
}
p(PFKEY_STAT_OUT_INVLEN, "\t%llu message%s with invalid length field\n");
p(PFKEY_STAT_OUT_INVVER, "\t%llu message%s with invalid version field\n");
p(PFKEY_STAT_OUT_INVMSGTYPE, "\t%llu message%s with invalid message type field\n");
p(PFKEY_STAT_OUT_TOOSHORT, "\t%llu message%s too short\n");
p(PFKEY_STAT_OUT_NOMEM, "\t%llu message%s with memory allocation failure\n");
p(PFKEY_STAT_OUT_DUPEXT, "\t%llu message%s with duplicate extension\n");
p(PFKEY_STAT_OUT_INVEXTTYPE, "\t%llu message%s with invalid extension type\n");
p(PFKEY_STAT_OUT_INVSATYPE, "\t%llu message%s with invalid sa type\n");
p(PFKEY_STAT_OUT_INVADDR, "\t%llu message%s with invalid address extension\n");
p(PFKEY_STAT_OUT_INVLEN,
"\t%llu message%s with invalid length field\n");
p(PFKEY_STAT_OUT_INVVER,
"\t%llu message%s with invalid version field\n");
p(PFKEY_STAT_OUT_INVMSGTYPE,
"\t%llu message%s with invalid message type field\n");
p(PFKEY_STAT_OUT_TOOSHORT,
"\t%llu message%s too short\n");
p(PFKEY_STAT_OUT_NOMEM,
"\t%llu message%s with memory allocation failure\n");
p(PFKEY_STAT_OUT_DUPEXT,
"\t%llu message%s with duplicate extension\n");
p(PFKEY_STAT_OUT_INVEXTTYPE,
"\t%llu message%s with invalid extension type\n");
p(PFKEY_STAT_OUT_INVSATYPE,
"\t%llu message%s with invalid sa type\n");
p(PFKEY_STAT_OUT_INVADDR,
"\t%llu message%s with invalid address extension\n");
/* kernel -> userland */
p(PFKEY_STAT_IN_TOTAL, "\t%llu request%s sent to userland\n");
@ -176,7 +185,8 @@ pfkey_stats(u_long off, const char *name)
"\t%llu message%s toward all sockets\n");
p(PFKEY_STAT_IN_MSGTARGET + KEY_SENDUP_REGISTERED,
"\t%llu message%s toward registered sockets\n");
p(PFKEY_STAT_IN_NOMEM, "\t%llu message%s with memory allocation failure\n");
p(PFKEY_STAT_IN_NOMEM,
"\t%llu message%s with memory allocation failure\n");
#undef p
}
#endif /*IPSEC*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: pfsync.c,v 1.4 2022/09/01 10:10:20 msaitoh Exp $ */
/* $NetBSD: pfsync.c,v 1.5 2022/09/02 06:25:43 msaitoh Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: pfsync.c,v 1.4 2022/09/01 10:10:20 msaitoh Exp $");
__RCSID("$NetBSD: pfsync.c,v 1.5 2022/09/02 06:25:43 msaitoh Exp $");
#endif /* not lint */
#define _CALLOUT_PRIVATE /* for defs in sys/callout.h */
@ -99,20 +99,34 @@ pfsync_stats(u_long off, const char *name)
p(PFSYNC_STAT_IPACKETS, "\t%" PRIu64 " packet%s received (IPv4)\n");
p(PFSYNC_STAT_IPACKETS6,"\t%" PRIu64 " packet%s received (IPv6)\n");
p(PFSYNC_STAT_BADIF, "\t\t%" PRIu64 " packet%s discarded for bad interface\n");
p(PFSYNC_STAT_BADTTL, "\t\t%" PRIu64 " packet%s discarded for bad ttl\n");
p(PFSYNC_STAT_HDROPS, "\t\t%" PRIu64 " packet%s shorter than header\n");
p(PFSYNC_STAT_BADVER, "\t\t%" PRIu64 " packet%s discarded for bad version\n");
p(PFSYNC_STAT_BADAUTH, "\t\t%" PRIu64 " packet%s discarded for bad HMAC\n");
p(PFSYNC_STAT_BADACT,"\t\t%" PRIu64 " packet%s discarded for bad action\n");
p(PFSYNC_STAT_BADLEN, "\t\t%" PRIu64 " packet%s discarded for short packet\n");
p(PFSYNC_STAT_BADVAL, "\t\t%" PRIu64 " state%s discarded for bad values\n");
p(PFSYNC_STAT_STALE, "\t\t%" PRIu64 " stale state%s\n");
p(PFSYNC_STAT_BADSTATE, "\t\t%" PRIu64 " failed state lookup/insert%s\n");
p(PFSYNC_STAT_OPACKETS, "\t%" PRIu64 " packet%s sent (IPv4)\n");
p(PFSYNC_STAT_OPACKETS6, "\t%" PRIu64 " packet%s sent (IPv6)\n");
p2(PFSYNC_STAT_ONOMEM, "\t\t%" PRIu64 " send failed due to mbuf memory error\n");
p2(PFSYNC_STAT_OERRORS, "\t\t%" PRIu64 " send error\n");
p(PFSYNC_STAT_BADIF,
"\t\t%" PRIu64 " packet%s discarded for bad interface\n");
p(PFSYNC_STAT_BADTTL,
"\t\t%" PRIu64 " packet%s discarded for bad ttl\n");
p(PFSYNC_STAT_HDROPS,
"\t\t%" PRIu64 " packet%s shorter than header\n");
p(PFSYNC_STAT_BADVER,
"\t\t%" PRIu64 " packet%s discarded for bad version\n");
p(PFSYNC_STAT_BADAUTH,
"\t\t%" PRIu64 " packet%s discarded for bad HMAC\n");
p(PFSYNC_STAT_BADACT,
"\t\t%" PRIu64 " packet%s discarded for bad action\n");
p(PFSYNC_STAT_BADLEN,
"\t\t%" PRIu64 " packet%s discarded for short packet\n");
p(PFSYNC_STAT_BADVAL,
"\t\t%" PRIu64 " state%s discarded for bad values\n");
p(PFSYNC_STAT_STALE,
"\t\t%" PRIu64 " stale state%s\n");
p(PFSYNC_STAT_BADSTATE,
"\t\t%" PRIu64 " failed state lookup/insert%s\n");
p(PFSYNC_STAT_OPACKETS,
"\t%" PRIu64 " packet%s sent (IPv4)\n");
p(PFSYNC_STAT_OPACKETS6,
"\t%" PRIu64 " packet%s sent (IPv6)\n");
p2(PFSYNC_STAT_ONOMEM,
"\t\t%" PRIu64 " send failed due to mbuf memory error\n");
p2(PFSYNC_STAT_OERRORS,
"\t\t%" PRIu64 " send error\n");
#undef p
#undef p2
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: route.c,v 1.87 2022/09/01 10:10:20 msaitoh Exp $ */
/* $NetBSD: route.c,v 1.88 2022/09/02 06:25:43 msaitoh Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
__RCSID("$NetBSD: route.c,v 1.87 2022/09/01 10:10:20 msaitoh Exp $");
__RCSID("$NetBSD: route.c,v 1.88 2022/09/02 06:25:43 msaitoh Exp $");
#endif
#endif /* not lint */
@ -317,18 +317,18 @@ rt_stats(u_long off)
printf("routing:\n");
printf("\t%llu bad routing redirect%s\n",
(unsigned long long)rtstats.rts_badredirect,
plural(rtstats.rts_badredirect));
(unsigned long long)rtstats.rts_badredirect,
plural(rtstats.rts_badredirect));
printf("\t%llu dynamically created route%s\n",
(unsigned long long)rtstats.rts_dynamic,
plural(rtstats.rts_dynamic));
(unsigned long long)rtstats.rts_dynamic,
plural(rtstats.rts_dynamic));
printf("\t%llu new gateway%s due to redirects\n",
(unsigned long long)rtstats.rts_newgateway,
plural(rtstats.rts_newgateway));
(unsigned long long)rtstats.rts_newgateway,
plural(rtstats.rts_newgateway));
printf("\t%llu destination%s found unreachable\n",
(unsigned long long)rtstats.rts_unreach,
plural(rtstats.rts_unreach));
(unsigned long long)rtstats.rts_unreach,
plural(rtstats.rts_unreach));
printf("\t%llu use%s of a wildcard route\n",
(unsigned long long)rtstats.rts_wildcard,
plural(rtstats.rts_wildcard));
(unsigned long long)rtstats.rts_wildcard,
plural(rtstats.rts_wildcard));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: unix.c,v 1.36 2022/09/01 10:10:20 msaitoh Exp $ */
/* $NetBSD: unix.c,v 1.37 2022/09/02 06:25:43 msaitoh Exp $ */
/*-
* Copyright (c) 1983, 1988, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)unix.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: unix.c,v 1.36 2022/09/01 10:10:20 msaitoh Exp $");
__RCSID("$NetBSD: unix.c,v 1.37 2022/09/02 06:25:43 msaitoh Exp $");
#endif
#endif /* not lint */
@ -161,8 +161,7 @@ unixpr(u_long off)
for (mibname = mibnames; *mibname; mibname++) {
memset(mib, 0, sizeof(mib));
if (sysctlnametomib(*mibname, mib,
&namelen) == -1)
if (sysctlnametomib(*mibname, mib, &namelen) == -1)
err(1, "sysctlnametomib: %s", *mibname);
if (prog_sysctl(mib, sizeof(mib) / sizeof(*mib),
@ -212,7 +211,7 @@ unixpr(u_long off)
0, &ns_nfiles);
if (filebuf == 0) {
printf("file table read error: %s",
kvm_geterr(get_kvmd()));
kvm_geterr(get_kvmd()));
return;
}
file = (struct file *)(filebuf + sizeof(fp));