int main(void) { p1a(); p1b(); return 0; }
void kevt_stats(uint32_t off __unused, char *name, int af __unused) { static struct kevtstat pkevtstat; struct kevtstat kevtstat; size_t len = sizeof(struct kctlstat); const char *mibvar = "net.systm.kevt.stats"; if (sysctlbyname(mibvar, &kevtstat, &len, 0, 0) < 0) { warn("sysctl: %s", mibvar); return; } if (interval && vflag > 0) print_time(); printf ("%s:\n", name); #define STATDIFF(f) (kevtstat.f - pkevtstat.f) #define p(f, m) if (STATDIFF(f) || sflag <= 1) \ printf(m, STATDIFF(f), plural(STATDIFF(f))) #define p1a(f, m) if (STATDIFF(f) || sflag <= 1) \ printf(m, STATDIFF(f)) p(kes_pcbcount, "\t%llu current kernel control socket%s\n"); p1a(kes_gencnt, "\t%llu kernel control generation count\n"); p(kes_badvendor, "\t%llu bad vendor failure%s\n"); p(kes_toobig, "\t%llu message too big failure%s\n"); p(kes_nomem, "\t%llu out of memeory failure%s\n"); p(kes_fullsock, "\t%llu message%s dropped due to full socket buffers\n"); p(kes_posted, "\t%llu message posted%s\n"); if (interval > 0) bcopy(&kevtstat, &pkevtstat, len); }
void OSGDebugDrawInterface::AddAxes(const dtEntity::Matrix& m, const dtEntity::Vec4f& color, float size, float duration, bool depthTestEnabled) { float arroww = 0.1f; osg::Vec3 p0(0, 0, 0); osg::Vec3 p1(0, 0, 1); osg::Vec3 p2(0, 1, 0); osg::Vec3 p3(1, 0, 0); osg::Vec3 p1a(arroww, 0, 1 - arroww); osg::Vec3 p1b(-arroww, 0, 1 - arroww); osg::Vec3 p2a(arroww, 1 - arroww, 0); osg::Vec3 p2b(-arroww, 1 - arroww, 0); osg::Vec3 p3a(1 - arroww, 0, arroww); osg::Vec3 p3b(1 - arroww, 0, -arroww); std::vector<osg::Vec3> lines(18); lines[0] = m * p0; lines[1] = m * p1; lines[2] = m * p0; lines[3] = m * p2; lines[4] = m * p0; lines[5] = m * p3; lines[6] = m * p1; lines[7] = m * p1a; lines[8] = m * p1; lines[9] = m * p1b; lines[10] = m * p2; lines[11] = m * p2a; lines[12] = m * p2; lines[13] = m * p2b; lines[14] = m * p3; lines[15] = m * p3a; lines[16] = m * p3; lines[17] = m * p3b; AddLines(lines, color, size, duration, depthTestEnabled); }
/* * Dump UDP statistics structure. */ void udp_stats(u_long off __unused, const char *name, int af1 __unused) { struct udpstat udpstat, zerostat; size_t len = sizeof udpstat; u_long delivered; if (zflag) memset(&zerostat, 0, len); if (sysctlbyname("net.inet.udp.stats", &udpstat, &len, zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { warn("sysctl: net.inet.udp.stats"); return; } #ifdef INET6 if (udp_done != 0) return; else udp_done = 1; #endif printf("%s:\n", name); #define p(f, m) if (udpstat.f || sflag <= 1) \ printf(m, udpstat.f, plural(udpstat.f)) #define p1a(f, m) if (udpstat.f || sflag <= 1) \ printf(m, udpstat.f) p(udps_ipackets, "\t%lu datagram%s received\n"); p1a(udps_hdrops, "\t%lu with incomplete header\n"); p1a(udps_badlen, "\t%lu with bad data length field\n"); p1a(udps_badsum, "\t%lu with bad checksum\n"); p1a(udps_nosum, "\t%lu with no checksum\n"); p1a(udps_noport, "\t%lu dropped due to no socket\n"); p(udps_noportbcast, "\t%lu broadcast/multicast datagram%s dropped due to no socket\n"); p1a(udps_fullsock, "\t%lu dropped due to full socket buffers\n"); p1a(udpps_pcbhashmiss, "\t%lu not for hashed pcb\n"); delivered = udpstat.udps_ipackets - udpstat.udps_hdrops - udpstat.udps_badlen - udpstat.udps_badsum - udpstat.udps_noport - udpstat.udps_noportbcast - udpstat.udps_fullsock; if (delivered || sflag <= 1) printf("\t%lu delivered\n", delivered); p(udps_opackets, "\t%lu datagram%s output\n"); #undef p #undef p1a }
QPolygonF UBGeometryUtils::lineToPolygon(const QPointF& pStart, const QPointF& pEnd, const qreal& pStartWidth, const qreal& pEndWidth) { qreal x1 = pStart.x(); qreal y1 = pStart.y(); qreal x2 = pEnd.x(); qreal y2 = pEnd.y(); QLineF line(pStart, pEnd); qreal alpha = (90.0 - line.angle()) * PI / 180.0; qreal hypothenuseStart = pStartWidth / 2; qreal hypothenuseEnd = pEndWidth / 2; qreal sinAlpha = sin(alpha); qreal cosAlpha = cos(alpha); // TODO UB 4.x PERF cache sin/cos table qreal oppositeStart = sinAlpha * hypothenuseStart; qreal adjacentStart = cosAlpha * hypothenuseStart; QPointF p1a(x1 - adjacentStart, y1 - oppositeStart); QPointF p1b(x1 + adjacentStart, y1 + oppositeStart); qreal oppositeEnd = sinAlpha * hypothenuseEnd; qreal adjacentEnd = cosAlpha * hypothenuseEnd; QPointF p2a(x2 - adjacentEnd, y2 - oppositeEnd); QPainterPath painterPath; painterPath.moveTo(p1a); painterPath.lineTo(p2a); painterPath.arcTo(x2 - hypothenuseEnd, y2 - hypothenuseEnd, pEndWidth, pEndWidth, (90.0 + line.angle()), -180.0); painterPath.lineTo(p1b); painterPath.arcTo(x1 - hypothenuseStart, y1 - hypothenuseStart, pStartWidth, pStartWidth, -1 * (90.0 - line.angle()), -180.0); painterPath.closeSubpath(); return painterPath.toFillPolygon(); }
void kctl_stats(uint32_t off __unused, char *name, int af __unused) { static struct kctlstat pkctlstat; struct kctlstat kctlstat; size_t len = sizeof(struct kctlstat); const char *mibvar = "net.systm.kctl.stats"; if (sysctlbyname(mibvar, &kctlstat, &len, 0, 0) < 0) { warn("sysctl: %s", mibvar); return; } if (interval && vflag > 0) print_time(); printf ("%s:\n", name); #define STATDIFF(f) (kctlstat.f - pkctlstat.f) #define p(f, m) if (STATDIFF(f) || sflag <= 1) \ printf(m, STATDIFF(f), plural(STATDIFF(f))) #define p1a(f, m) if (STATDIFF(f) || sflag <= 1) \ printf(m, STATDIFF(f)) p(kcs_reg_total, "\t%llu total kernel control module%s registered\n"); p(kcs_reg_count, "\t%llu current kernel control module%s registered\n"); p(kcs_pcbcount, "\t%llu current kernel control socket%s\n"); p1a(kcs_gencnt, "\t%llu kernel control generation count\n"); p(kcs_connections, "\t%llu connection attempt%s\n"); p(kcs_conn_fail, "\t%llu connection failure%s\n"); p(kcs_send_fail, "\t%llu send failure%s\n"); p(kcs_send_list_fail, "\t%llu send list failure%s\n"); p(kcs_enqueue_fail, "\t%llu enqueus failure%s\n"); p(kcs_enqueue_fullsock, "\t%llu packet%s dropped due to full socket buffers\n"); #undef STATDIFF #undef p #undef p1a if (interval > 0) bcopy(&kctlstat, &pkctlstat, len); }
int mossa(int numero1, int numero2, int giocatore) { int risultato; if(giocatore==1) { risultato = p1a(numero1, numero2); risultato = p1b(risultato); } else { risultato = p2a(numero1, numero2); risultato = p2b(risultato); } giocatore=3-giocatore; if(decodifica1(risultato)<3 || decodifica2(risultato)<3) return giocatore; return mossa(decodifica1(risultato), decodifica2(risultato), giocatore); }
QPolygonF UBGeometryUtils::lineToPolygon(const QLineF& pLine, const qreal& pWidth) { qreal x1 = pLine.x1(); qreal y1 = pLine.y1(); qreal x2 = pLine.x2(); qreal y2 = pLine.y2(); qreal alpha = (90.0 - pLine.angle()) * PI / 180.0; qreal hypothenuse = pWidth / 2; // TODO UB 4.x PERF cache sin/cos table qreal opposite = sin(alpha) * hypothenuse; qreal adjacent = cos(alpha) * hypothenuse; QPointF p1a(x1 - adjacent, y1 - opposite); QPointF p1b(x1 + adjacent, y1 + opposite); QPointF p2a(x2 - adjacent, y2 - opposite); QPointF p2b(x2 + adjacent, y2 + opposite); QPainterPath painterPath; painterPath.moveTo(p1a); painterPath.lineTo(p2a); painterPath.arcTo(x2 - hypothenuse, y2 - hypothenuse, pWidth, pWidth, (90.0 + pLine.angle()), -180.0); //painterPath.lineTo(p2b); painterPath.lineTo(p1b); painterPath.arcTo(x1 - hypothenuse, y1 - hypothenuse, pWidth, pWidth, -1 * (90.0 - pLine.angle()), -180.0); painterPath.closeSubpath(); return painterPath.toFillPolygon(); }
/* * Dump UDP statistics structure. */ void udp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { struct udpstat udpstat; uint64_t delivered; #ifdef INET6 if (udp_done != 0) return; else udp_done = 1; #endif if (fetch_stats("net.inet.udp.stats", off, &udpstat, sizeof(udpstat), kread_counters) != 0) return; xo_open_container("udp"); xo_emit("{T:/%s}:\n", name); #define p(f, m) if (udpstat.f || sflag <= 1) \ xo_emit("\t" m, (uintmax_t)udpstat.f, plural(udpstat.f)) #define p1a(f, m) if (udpstat.f || sflag <= 1) \ xo_emit("\t" m, (uintmax_t)udpstat.f) p(udps_ipackets, "{:received-datagrams/%ju} " "{N:/datagram%s received}\n"); p1a(udps_hdrops, "{:dropped-incomplete-headers/%ju} " "{N:/with incomplete header}\n"); p1a(udps_badlen, "{:dropped-bad-data-length/%ju} " "{N:/with bad data length field}\n"); p1a(udps_badsum, "{:dropped-bad-checksum/%ju} " "{N:/with bad checksum}\n"); p1a(udps_nosum, "{:dropped-no-checksum/%ju} " "{N:/with no checksum}\n"); p1a(udps_noport, "{:dropped-no-socket/%ju} " "{N:/dropped due to no socket}\n"); p(udps_noportbcast, "{:dropped-broadcast-multicast/%ju} " "{N:/broadcast\\/multicast datagram%s undelivered}\n"); p1a(udps_fullsock, "{:dropped-full-socket-buffer/%ju} " "{N:/dropped due to full socket buffers}\n"); p1a(udpps_pcbhashmiss, "{:not-for-hashed-pcb/%ju} " "{N:/not for hashed pcb}\n"); delivered = udpstat.udps_ipackets - udpstat.udps_hdrops - udpstat.udps_badlen - udpstat.udps_badsum - udpstat.udps_noport - udpstat.udps_noportbcast - udpstat.udps_fullsock; if (delivered || sflag <= 1) xo_emit("\t{:delivered-packets/%ju} {N:/delivered}\n", (uint64_t)delivered); p(udps_opackets, "{:output-packets/%ju} {N:/datagram%s output}\n"); /* the next statistic is cumulative in udps_noportbcast */ p(udps_filtermcast, "{:multicast-source-filter-matches/%ju} " "{N:/time%s multicast source filter matched}\n"); #undef p #undef p1a xo_close_container("udp"); }
/* * Dump TCP statistics structure. */ void tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { struct tcpstat tcpstat; uint64_t tcps_states[TCP_NSTATES]; #ifdef INET6 if (tcp_done != 0) return; else tcp_done = 1; #endif if (fetch_stats("net.inet.tcp.stats", off, &tcpstat, sizeof(tcpstat), kread_counters) != 0) return; if (fetch_stats_ro("net.inet.tcp.states", nl[N_TCPS_STATES].n_value, &tcps_states, sizeof(tcps_states), kread_counters) != 0) return; xo_open_container("tcp"); xo_emit("{T:/%s}:\n", name); #define p(f, m) if (tcpstat.f || sflag <= 1) \ xo_emit(m, (uintmax_t )tcpstat.f, plural(tcpstat.f)) #define p1a(f, m) if (tcpstat.f || sflag <= 1) \ xo_emit(m, (uintmax_t )tcpstat.f) #define p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ xo_emit(m, (uintmax_t )tcpstat.f1, plural(tcpstat.f1), \ (uintmax_t )tcpstat.f2, plural(tcpstat.f2)) #define p2a(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ xo_emit(m, (uintmax_t )tcpstat.f1, plural(tcpstat.f1), \ (uintmax_t )tcpstat.f2) #define p3(f, m) if (tcpstat.f || sflag <= 1) \ xo_emit(m, (uintmax_t )tcpstat.f, pluralies(tcpstat.f)) p(tcps_sndtotal, "\t{:sent-packets/%ju} {N:/packet%s sent}\n"); p2(tcps_sndpack,tcps_sndbyte, "\t\t{:sent-data-packets/%ju} " "{N:/data packet%s} ({:sent-data-bytes/%ju} {N:/byte%s})\n"); p2(tcps_sndrexmitpack, tcps_sndrexmitbyte, "\t\t" "{:sent-retransmitted-packets/%ju} {N:/data packet%s} " "({:sent-retransmitted-bytes/%ju} {N:/byte%s}) " "{N:retransmitted}\n"); p(tcps_sndrexmitbad, "\t\t" "{:sent-unnecessary-retransmitted-packets/%ju} " "{N:/data packet%s unnecessarily retransmitted}\n"); p(tcps_mturesent, "\t\t{:sent-resends-by-mtu-discovery/%ju} " "{N:/resend%s initiated by MTU discovery}\n"); p2a(tcps_sndacks, tcps_delack, "\t\t{:sent-ack-only-packets/%ju} " "{N:/ack-only packet%s/} ({:sent-packets-delayed/%ju} " "{N:delayed})\n"); p(tcps_sndurg, "\t\t{:sent-urg-only-packets/%ju} " "{N:/URG only packet%s}\n"); p(tcps_sndprobe, "\t\t{:sent-window-probe-packets/%ju} " "{N:/window probe packet%s}\n"); p(tcps_sndwinup, "\t\t{:sent-window-update-packets/%ju} " "{N:/window update packet%s}\n"); p(tcps_sndctrl, "\t\t{:sent-control-packets/%ju} " "{N:/control packet%s}\n"); p(tcps_rcvtotal, "\t{:received-packets/%ju} " "{N:/packet%s received}\n"); p2(tcps_rcvackpack, tcps_rcvackbyte, "\t\t" "{:received-ack-packets/%ju} {N:/ack%s} " "{N:(for} {:received-ack-bytes/%ju} {N:/byte%s})\n"); p(tcps_rcvdupack, "\t\t{:received-duplicate-acks/%ju} " "{N:/duplicate ack%s}\n"); p(tcps_rcvacktoomuch, "\t\t{:received-acks-for-unsent-data/%ju} " "{N:/ack%s for unsent data}\n"); p2(tcps_rcvpack, tcps_rcvbyte, "\t\t" "{:received-in-sequence-packets/%ju} {N:/packet%s} " "({:received-in-sequence-bytes/%ju} {N:/byte%s}) " "{N:received in-sequence}\n"); p2(tcps_rcvduppack, tcps_rcvdupbyte, "\t\t" "{:received-completely-duplicate-packets/%ju} " "{N:/completely duplicate packet%s} " "({:received-completely-duplicate-bytes/%ju} {N:/byte%s})\n"); p(tcps_pawsdrop, "\t\t{:received-old-duplicate-packets/%ju} " "{N:/old duplicate packet%s}\n"); p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte, "\t\t" "{:received-some-duplicate-packets/%ju} " "{N:/packet%s with some dup. data} " "({:received-some-duplicate-bytes/%ju} {N:/byte%s duped/})\n"); p2(tcps_rcvoopack, tcps_rcvoobyte, "\t\t{:received-out-of-order/%ju} " "{N:/out-of-order packet%s} " "({:received-out-of-order-bytes/%ju} {N:/byte%s})\n"); p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin, "\t\t" "{:received-after-window-packets/%ju} {N:/packet%s} " "({:received-after-window-bytes/%ju} {N:/byte%s}) " "{N:of data after window}\n"); p(tcps_rcvwinprobe, "\t\t{:received-window-probes/%ju} " "{N:/window probe%s}\n"); p(tcps_rcvwinupd, "\t\t{:receive-window-update-packets/%ju} " "{N:/window update packet%s}\n"); p(tcps_rcvafterclose, "\t\t{:received-after-close-packets/%ju} " "{N:/packet%s received after close}\n"); p(tcps_rcvbadsum, "\t\t{:discard-bad-checksum/%ju} " "{N:/discarded for bad checksum%s}\n"); p(tcps_rcvbadoff, "\t\t{:discard-bad-header-offset/%ju} " "{N:/discarded for bad header offset field%s}\n"); p1a(tcps_rcvshort, "\t\t{:discard-too-short/%ju} " "{N:discarded because packet too short}\n"); p1a(tcps_rcvmemdrop, "\t\t{:discard-memory-problems/%ju} " "{N:discarded due to memory problems}\n"); p(tcps_connattempt, "\t{:connection-requests/%ju} " "{N:/connection request%s}\n"); p(tcps_accepts, "\t{:connections-accepts/%ju} " "{N:/connection accept%s}\n"); p(tcps_badsyn, "\t{:bad-connection-attempts/%ju} " "{N:/bad connection attempt%s}\n"); p(tcps_listendrop, "\t{:listen-queue-overflows/%ju} " "{N:/listen queue overflow%s}\n"); p(tcps_badrst, "\t{:ignored-in-window-resets/%ju} " "{N:/ignored RSTs in the window%s}\n"); p(tcps_connects, "\t{:connections-established/%ju} " "{N:/connection%s established (including accepts)}\n"); p(tcps_usedrtt, "\t\t{:connections-hostcache-rtt/%ju} " "{N:/time%s used RTT from hostcache}\n"); p(tcps_usedrttvar, "\t\t{:connections-hostcache-rttvar/%ju} " "{N:/time%s used RTT variance from hostcache}\n"); p(tcps_usedssthresh, "\t\t{:connections-hostcache-ssthresh/%ju} " "{N:/time%s used slow-start threshold from hostcache}\n"); p2(tcps_closed, tcps_drops, "\t{:connections-closed/%ju} " "{N:/connection%s closed (including} " "{:connection-drops/%ju} {N:/drop%s})\n"); p(tcps_cachedrtt, "\t\t{:connections-updated-rtt-on-close/%ju} " "{N:/connection%s updated cached RTT on close}\n"); p(tcps_cachedrttvar, "\t\t" "{:connections-updated-variance-on-close/%ju} " "{N:/connection%s updated cached RTT variance on close}\n"); p(tcps_cachedssthresh, "\t\t" "{:connections-updated-ssthresh-on-close/%ju} " "{N:/connection%s updated cached ssthresh on close}\n"); p(tcps_conndrops, "\t{:embryonic-connections-dropped/%ju} " "{N:/embryonic connection%s dropped}\n"); p2(tcps_rttupdated, tcps_segstimed, "\t{:segments-updated-rtt/%ju} " "{N:/segment%s updated rtt (of} " "{:segment-update-attempts/%ju} {N:/attempt%s})\n"); p(tcps_rexmttimeo, "\t{:retransmit-timeouts/%ju} " "{N:/retransmit timeout%s}\n"); p(tcps_timeoutdrop, "\t\t" "{:connections-dropped-by-retransmit-timeout/%ju} " "{N:/connection%s dropped by rexmit timeout}\n"); p(tcps_persisttimeo, "\t{:persist-timeout/%ju} " "{N:/persist timeout%s}\n"); p(tcps_persistdrop, "\t\t" "{:connections-dropped-by-persist-timeout/%ju} " "{N:/connection%s dropped by persist timeout}\n"); p(tcps_finwait2_drops, "\t" "{:connections-dropped-by-finwait2-timeout/%ju} " "{N:/Connection%s (fin_wait_2) dropped because of timeout}\n"); p(tcps_keeptimeo, "\t{:keepalive-timeout/%ju} " "{N:/keepalive timeout%s}\n"); p(tcps_keepprobe, "\t\t{:keepalive-probes/%ju} " "{N:/keepalive probe%s sent}\n"); p(tcps_keepdrops, "\t\t{:connections-dropped-by-keepalives/%ju} " "{N:/connection%s dropped by keepalive}\n"); p(tcps_predack, "\t{:ack-header-predictions/%ju} " "{N:/correct ACK header prediction%s}\n"); p(tcps_preddat, "\t{:data-packet-header-predictions/%ju} " "{N:/correct data packet header prediction%s}\n"); xo_open_container("syncache"); p3(tcps_sc_added, "\t{:entries-added/%ju} " "{N:/syncache entr%s added}\n"); p1a(tcps_sc_retransmitted, "\t\t{:retransmitted/%ju} " "{N:/retransmitted}\n"); p1a(tcps_sc_dupsyn, "\t\t{:duplicates/%ju} {N:/dupsyn}\n"); p1a(tcps_sc_dropped, "\t\t{:dropped/%ju} {N:/dropped}\n"); p1a(tcps_sc_completed, "\t\t{:completed/%ju} {N:/completed}\n"); p1a(tcps_sc_bucketoverflow, "\t\t{:bucket-overflow/%ju} " "{N:/bucket overflow}\n"); p1a(tcps_sc_cacheoverflow, "\t\t{:cache-overflow/%ju} " "{N:/cache overflow}\n"); p1a(tcps_sc_reset, "\t\t{:reset/%ju} {N:/reset}\n"); p1a(tcps_sc_stale, "\t\t{:stale/%ju} {N:/stale}\n"); p1a(tcps_sc_aborted, "\t\t{:aborted/%ju} {N:/aborted}\n"); p1a(tcps_sc_badack, "\t\t{:bad-ack/%ju} {N:/badack}\n"); p1a(tcps_sc_unreach, "\t\t{:unreachable/%ju} {N:/unreach}\n"); p(tcps_sc_zonefail, "\t\t{:zone-failures/%ju} {N:/zone failure%s}\n"); p(tcps_sc_sendcookie, "\t{:sent-cookies/%ju} {N:/cookie%s sent}\n"); p(tcps_sc_recvcookie, "\t{:receivd-cookies/%ju} " "{N:/cookie%s received}\n"); xo_close_container("syncache"); xo_open_container("hostcache"); p3(tcps_hc_added, "\t{:entries-added/%ju} " "{N:/hostcache entr%s added}\n"); p1a(tcps_hc_bucketoverflow, "\t\t{:buffer-overflows/%ju} " "{N:/bucket overflow}\n"); xo_close_container("hostcache"); xo_open_container("sack"); p(tcps_sack_recovery_episode, "\t{:recovery-episodes/%ju} " "{N:/SACK recovery episode%s}\n"); p(tcps_sack_rexmits, "\t{:segment-retransmits/%ju} " "{N:/segment rexmit%s in SACK recovery episodes}\n"); p(tcps_sack_rexmit_bytes, "\t{:byte-retransmits/%ju} " "{N:/byte rexmit%s in SACK recovery episodes}\n"); p(tcps_sack_rcv_blocks, "\t{:received-blocks/%ju} " "{N:/SACK option%s (SACK blocks) received}\n"); p(tcps_sack_send_blocks, "\t{:sent-option-blocks/%ju} " "{N:/SACK option%s (SACK blocks) sent}\n"); p1a(tcps_sack_sboverflow, "\t{:scoreboard-overflows/%ju} " "{N:/SACK scoreboard overflow}\n"); xo_close_container("sack"); xo_open_container("ecn"); p(tcps_ecn_ce, "\t{:ce-packets/%ju} " "{N:/packet%s with ECN CE bit set}\n"); p(tcps_ecn_ect0, "\t{:ect0-packets/%ju} " "{N:/packet%s with ECN ECT(0) bit set}\n"); p(tcps_ecn_ect1, "\t{:ect1-packets/%ju} " "{N:/packet%s with ECN ECT(1) bit set}\n"); p(tcps_ecn_shs, "\t{:handshakes/%ju} " "{N:/successful ECN handshake%s}\n"); p(tcps_ecn_rcwnd, "\t{:congestion-reductions/%ju} " "{N:/time%s ECN reduced the congestion window}\n"); xo_close_container("ecn"); xo_open_container("tcp-signature"); p(tcps_sig_rcvgoodsig, "\t{:received-good-signature/%ju} " "{N:/packet%s with matching signature received}\n"); p(tcps_sig_rcvbadsig, "\t{:received-bad-signature/%ju} " "{N:/packet%s with bad signature received}\n"); p(tcps_sig_err_buildsig, "\t{:failed-make-signature/%ju} " "{N:/time%s failed to make signature due to no SA}\n"); p(tcps_sig_err_sigopt, "\t{:no-signature-expected/%ju} " "{N:/time%s unexpected signature received}\n"); p(tcps_sig_err_nosigopt, "\t{:no-signature-provided/%ju} " "{N:/time%s no signature provided by segment}\n"); #undef p #undef p1a #undef p2 #undef p2a #undef p3 xo_close_container("tcp-signature"); xo_open_container("TCP connection count by state"); xo_emit("{T:/TCP connection count by state}:\n"); for (int i = 0; i < TCP_NSTATES; i++) { /* * XXXGL: is there a way in libxo to use %s * in the "content string" of a format * string? I failed to do that, that's why * a temporary buffer is used to construct * format string for xo_emit(). */ char fmtbuf[80]; if (sflag > 1 && tcps_states[i] == 0) continue; snprintf(fmtbuf, sizeof(fmtbuf), "\t{:%s/%%ju} " "{Np:/connection ,connections} in %s state\n", tcpstates[i], tcpstates[i]); xo_emit(fmtbuf, (uintmax_t )tcps_states[i]); } xo_close_container("TCP connection count by state"); xo_close_container("tcp"); }
/* * Dump ICMP statistics. */ void icmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { struct icmpstat icmpstat; size_t len; int i, first; if (fetch_stats("net.inet.icmp.stats", off, &icmpstat, sizeof(icmpstat), kread_counters) != 0) return; xo_open_container(name); xo_emit("{T:/%s}:\n", name); #define p(f, m) if (icmpstat.f || sflag <= 1) \ xo_emit(m, icmpstat.f, plural(icmpstat.f)) #define p1a(f, m) if (icmpstat.f || sflag <= 1) \ xo_emit(m, icmpstat.f) #define p2(f, m) if (icmpstat.f || sflag <= 1) \ xo_emit(m, icmpstat.f, plurales(icmpstat.f)) p(icps_error, "\t{:icmp-calls/%lu} " "{N:/call%s to icmp_error}\n"); p(icps_oldicmp, "\t{:errors-not-from-message/%lu} " "{N:/error%s not generated in response to an icmp message}\n"); for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++) { if (icmpstat.icps_outhist[i] != 0) { if (first) { xo_open_list("output-histogram"); xo_emit("\tOutput histogram:\n"); first = 0; } xo_open_instance("output-histogram"); if (icmpnames[i] != NULL) xo_emit("\t\t{k:name/%s}: {:count/%lu}\n", icmpnames[i], icmpstat.icps_outhist[i]); else xo_emit("\t\tunknown ICMP #{k:name/%d}: " "{:count/%lu}\n", i, icmpstat.icps_outhist[i]); xo_close_instance("output-histogram"); } } if (!first) xo_close_list("output-histogram"); p(icps_badcode, "\t{:dropped-bad-code/%lu} " "{N:/message%s with bad code fields}\n"); p(icps_tooshort, "\t{:dropped-too-short/%lu} " "{N:/message%s less than the minimum length}\n"); p(icps_checksum, "\t{:dropped-bad-checksum/%lu} " "{N:/message%s with bad checksum}\n"); p(icps_badlen, "\t{:dropped-bad-length/%lu} " "{N:/message%s with bad length}\n"); p1a(icps_bmcastecho, "\t{:dropped-multicast-echo/%lu} " "{N:/multicast echo requests ignored}\n"); p1a(icps_bmcasttstamp, "\t{:dropped-multicast-timestamp/%lu} " "{N:/multicast timestamp requests ignored}\n"); for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++) { if (icmpstat.icps_inhist[i] != 0) { if (first) { xo_open_list("input-histogram"); xo_emit("\tInput histogram:\n"); first = 0; } xo_open_instance("input-histogram"); if (icmpnames[i] != NULL) xo_emit("\t\t{k:name/%s}: {:count/%lu}\n", icmpnames[i], icmpstat.icps_inhist[i]); else xo_emit( "\t\tunknown ICMP #{k:name/%d}: {:count/%lu}\n", i, icmpstat.icps_inhist[i]); xo_close_instance("input-histogram"); } } if (!first) xo_close_list("input-histogram"); p(icps_reflect, "\t{:sent-packets/%lu} " "{N:/message response%s generated}\n"); p2(icps_badaddr, "\t{:discard-invalid-return-address/%lu} " "{N:/invalid return address%s}\n"); p(icps_noroute, "\t{:discard-no-route/%lu} " "{N:/no return route%s}\n"); #undef p #undef p1a #undef p2 if (live) { len = sizeof i; if (sysctlbyname("net.inet.icmp.maskrepl", &i, &len, NULL, 0) < 0) return; xo_emit("\tICMP address mask responses are " "{q:icmp-address-responses/%sabled}\n", i ? "en" : "dis"); } xo_close_container(name); }
/* * Dump IP6 statistics structure. */ void ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { struct ip6stat ip6stat, zerostat; int first, i; size_t len; len = sizeof ip6stat; if (live) { memset(&ip6stat, 0, len); if (zflag) memset(&zerostat, 0, len); if (sysctlbyname("net.inet6.ip6.stats", &ip6stat, &len, zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { if (errno != ENOENT) xo_warn("sysctl: net.inet6.ip6.stats"); return; } } else kread_counters(off, &ip6stat, len); xo_open_container(name); xo_emit("{T:/%s}:\n", name); #define p(f, m) if (ip6stat.f || sflag <= 1) \ xo_emit(m, (uintmax_t)ip6stat.f, plural(ip6stat.f)) #define p1a(f, m) if (ip6stat.f || sflag <= 1) \ xo_emit(m, (uintmax_t)ip6stat.f) p(ip6s_total, "\t{:received-packets/%ju} " "{N:/total packet%s received}\n"); p1a(ip6s_toosmall, "\t{:dropped-below-minimum-size/%ju} " "{N:/with size smaller than minimum}\n"); p1a(ip6s_tooshort, "\t{:dropped-short-packets/%ju} " "{N:/with data size < data length}\n"); p1a(ip6s_badoptions, "\t{:dropped-bad-options/%ju} " "{N:/with bad options}\n"); p1a(ip6s_badvers, "\t{:dropped-bad-version/%ju} " "{N:/with incorrect version number}\n"); p(ip6s_fragments, "\t{:received-fragments/%ju} " "{N:/fragment%s received}\n"); p(ip6s_fragdropped, "\t{:dropped-fragment/%ju} " "{N:/fragment%s dropped (dup or out of space)}\n"); p(ip6s_fragtimeout, "\t{:dropped-fragment-after-timeout/%ju} " "{N:/fragment%s dropped after timeout}\n"); p(ip6s_fragoverflow, "\t{:dropped-fragments-overflow/%ju} " "{N:/fragment%s that exceeded limit}\n"); p(ip6s_reassembled, "\t{:reassembled-packets/%ju} " "{N:/packet%s reassembled ok}\n"); p(ip6s_delivered, "\t{:received-local-packets/%ju} " "{N:/packet%s for this host}\n"); p(ip6s_forward, "\t{:forwarded-packets/%ju} " "{N:/packet%s forwarded}\n"); p(ip6s_cantforward, "\t{:packets-not-forwardable/%ju} " "{N:/packet%s not forwardable}\n"); p(ip6s_redirectsent, "\t{:sent-redirects/%ju} " "{N:/redirect%s sent}\n"); p(ip6s_localout, "\t{:sent-packets/%ju} " "{N:/packet%s sent from this host}\n"); p(ip6s_rawout, "\t{:send-packets-fabricated-header/%ju} " "{N:/packet%s sent with fabricated ip header}\n"); p(ip6s_odropped, "\t{:discard-no-mbufs/%ju} " "{N:/output packet%s dropped due to no bufs, etc.}\n"); p(ip6s_noroute, "\t{:discard-no-route/%ju} " "{N:/output packet%s discarded due to no route}\n"); p(ip6s_fragmented, "\t{:sent-fragments/%ju} " "{N:/output datagram%s fragmented}\n"); p(ip6s_ofragments, "\t{:fragments-created/%ju} " "{N:/fragment%s created}\n"); p(ip6s_cantfrag, "\t{:discard-cannot-fragment/%ju} " "{N:/datagram%s that can't be fragmented}\n"); p(ip6s_badscope, "\t{:discard-scope-violations/%ju} " "{N:/packet%s that violated scope rules}\n"); p(ip6s_notmember, "\t{:multicast-no-join-packets/%ju} " "{N:/multicast packet%s which we don't join}\n"); for (first = 1, i = 0; i < IP6S_HDRCNT; i++) if (ip6stat.ip6s_nxthist[i] != 0) { if (first) { xo_emit("\t{T:Input histogram}:\n"); xo_open_list("input-histogram"); first = 0; } xo_open_instance("input-histogram"); xo_emit("\t\t{k:name/%s}: {:count/%ju}\n", ip6nh[i], (uintmax_t)ip6stat.ip6s_nxthist[i]); xo_close_instance("input-histogram"); } if (!first) xo_close_list("input-histogram"); xo_open_container("mbuf-statistics"); xo_emit("\t{T:Mbuf statistics}:\n"); xo_emit("\t\t{:one-mbuf/%ju} {N:/one mbuf}\n", (uintmax_t)ip6stat.ip6s_m1); for (first = 1, i = 0; i < IP6S_M2MMAX; i++) { char ifbuf[IFNAMSIZ]; if (ip6stat.ip6s_m2m[i] != 0) { if (first) { xo_emit("\t\t{N:two or more mbuf}:\n"); xo_open_list("mbuf-data"); first = 0; } xo_open_instance("mbuf-data"); xo_emit("\t\t\t{k:name/%s}= {:count/%ju}\n", if_indextoname(i, ifbuf), (uintmax_t)ip6stat.ip6s_m2m[i]); xo_close_instance("mbuf-data"); } } if (!first) xo_close_list("mbuf-data"); xo_emit("\t\t{:one-extra-mbuf/%ju} {N:one ext mbuf}\n", (uintmax_t)ip6stat.ip6s_mext1); xo_emit("\t\t{:two-or-more-extra-mbufs/%ju} " "{N:/two or more ext mbuf}\n", (uintmax_t)ip6stat.ip6s_mext2m); xo_close_container("mbuf-statistics"); p(ip6s_exthdrtoolong, "\t{:dropped-header-too-long/%ju} " "{N:/packet%s whose headers are not contiguous}\n"); p(ip6s_nogif, "\t{:discard-tunnel-no-gif/%ju} " "{N:/tunneling packet%s that can't find gif}\n"); p(ip6s_toomanyhdr, "\t{:dropped-too-many-headers/%ju} " "{N:/packet%s discarded because of too many headers}\n"); /* for debugging source address selection */ #define PRINT_SCOPESTAT(s,i) do {\ switch(i) { /* XXX hardcoding in each case */\ case 1:\ p(s, "\t\t{ke:name/interface-locals}{:count/%ju} " \ "{N:/interface-local%s}\n"); \ break;\ case 2:\ p(s,"\t\t{ke:name/link-locals}{:count/%ju} " \ "{N:/link-local%s}\n"); \ break;\ case 5:\ p(s,"\t\t{ke:name/site-locals}{:count/%ju} " \ "{N:/site-local%s}\n");\ break;\ case 14:\ p(s,"\t\t{ke:name/globals}{:count/%ju} " \ "{N:/global%s}\n");\ break;\ default:\ xo_emit("\t\t{qke:name/%x}{:count/%ju} " \ "addresses scope=%x\n",\ i, (uintmax_t)ip6stat.s, i); \ }\ } while (0); xo_open_container("source-address-selection"); p(ip6s_sources_none, "\t{:address-selection-failures/%ju} " "{N:/failure%s of source address selection}\n"); for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_sameif[i]) { if (first) { xo_open_list("outgoing-interface"); xo_emit("\tsource addresses on an outgoing " "I/F\n"); first = 0; } xo_open_instance("outgoing-interface"); PRINT_SCOPESTAT(ip6s_sources_sameif[i], i); xo_close_instance("outgoing-interface"); } } if (!first) xo_close_list("outgoing-interface"); for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_otherif[i]) { if (first) { xo_open_list("non-outgoing-interface"); xo_emit("\tsource addresses on a non-outgoing " "I/F\n"); first = 0; } xo_open_instance("non-outgoing-interface"); PRINT_SCOPESTAT(ip6s_sources_otherif[i], i); xo_close_instance("non-outgoing-interface"); } } if (!first) xo_close_list("non-outgoing-interface"); for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_samescope[i]) { if (first) { xo_open_list("same-source"); xo_emit("\tsource addresses of same scope\n"); first = 0; } xo_open_instance("same-source"); PRINT_SCOPESTAT(ip6s_sources_samescope[i], i); xo_close_instance("same-source"); } } if (!first) xo_close_list("same-source"); for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_otherscope[i]) { if (first) { xo_open_list("different-scope"); xo_emit("\tsource addresses of a different " "scope\n"); first = 0; } xo_open_instance("different-scope"); PRINT_SCOPESTAT(ip6s_sources_otherscope[i], i); xo_close_instance("different-scope"); } } if (!first) xo_close_list("different-scope"); for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_deprecated[i]) { if (first) { xo_open_list("deprecated-source"); xo_emit("\tdeprecated source addresses\n"); first = 0; } xo_open_instance("deprecated-source"); PRINT_SCOPESTAT(ip6s_sources_deprecated[i], i); xo_close_instance("deprecated-source"); } } if (!first) xo_close_list("deprecated-source"); for (first = 1, i = 0; i < IP6S_RULESMAX; i++) { if (ip6stat.ip6s_sources_rule[i]) { if (first) { xo_open_list("rules-applied"); xo_emit("\t{T:Source addresses selection " "rule applied}:\n"); first = 0; } xo_open_instance("rules-applied"); xo_emit("\t\t{ke:name/%s}{:count/%ju} {d:name/%s}\n", srcrule_str[i], (uintmax_t)ip6stat.ip6s_sources_rule[i], srcrule_str[i]); xo_close_instance("rules-applied"); } } if (!first) xo_close_list("rules-applied"); xo_close_container("source-address-selection"); #undef p #undef p1a xo_close_container(name); }
/* * Dump IP6 statistics structure. */ void ip6_stats(u_long off __unused, const char *name, int af1 __unused) { struct ip6stat ip6stat; int first, i; int mib[4]; size_t len; mib[0] = CTL_NET; mib[1] = PF_INET6; mib[2] = IPPROTO_IPV6; mib[3] = IPV6CTL_STATS; len = sizeof ip6stat; memset(&ip6stat, 0, len); if (sysctl(mib, 4, &ip6stat, &len, NULL, 0) < 0) return; printf("%s:\n", name); #define p(f, m) if (ip6stat.f || sflag <= 1) \ printf(m, (unsigned long long)ip6stat.f, plural(ip6stat.f)) #define p1a(f, m) if (ip6stat.f || sflag <= 1) \ printf(m, (unsigned long long)ip6stat.f) p(ip6s_total, "\t%llu total packet%s received\n"); p1a(ip6s_toosmall, "\t%llu with size smaller than minimum\n"); p1a(ip6s_tooshort, "\t%llu with data size < data length\n"); p1a(ip6s_badoptions, "\t%llu with bad options\n"); p1a(ip6s_badvers, "\t%llu with incorrect version number\n"); p(ip6s_fragments, "\t%llu fragment%s received\n"); p(ip6s_fragdropped, "\t%llu fragment%s dropped (dup or out of space)\n"); p(ip6s_fragtimeout, "\t%llu fragment%s dropped after timeout\n"); p(ip6s_fragoverflow, "\t%llu fragment%s that exceeded limit\n"); p(ip6s_reassembled, "\t%llu packet%s reassembled ok\n"); p(ip6s_delivered, "\t%llu packet%s for this host\n"); p(ip6s_forward, "\t%llu packet%s forwarded\n"); p(ip6s_cantforward, "\t%llu packet%s not forwardable\n"); p(ip6s_redirectsent, "\t%llu redirect%s sent\n"); p(ip6s_localout, "\t%llu packet%s sent from this host\n"); p(ip6s_rawout, "\t%llu packet%s sent with fabricated ip header\n"); p(ip6s_odropped, "\t%llu output packet%s dropped due to no bufs, etc.\n"); p(ip6s_noroute, "\t%llu output packet%s discarded due to no route\n"); p(ip6s_fragmented, "\t%llu output datagram%s fragmented\n"); p(ip6s_ofragments, "\t%llu fragment%s created\n"); p(ip6s_cantfrag, "\t%llu datagram%s that can't be fragmented\n"); p(ip6s_badscope, "\t%llu packet%s that violated scope rules\n"); p(ip6s_notmember, "\t%llu multicast packet%s which we don't join\n"); for (first = 1, i = 0; i < 256; i++) if (ip6stat.ip6s_nxthist[i] != 0) { if (first) { printf("\tInput histogram:\n"); first = 0; } printf("\t\t%s: %llu\n", ip6nh[i], (unsigned long long)ip6stat.ip6s_nxthist[i]); } printf("\tMbuf statistics:\n"); printf("\t\t%llu one mbuf\n", (unsigned long long)ip6stat.ip6s_m1); for (first = 1, i = 0; i < 32; i++) { char ifbuf[IFNAMSIZ]; if (ip6stat.ip6s_m2m[i] != 0) { if (first) { printf("\t\ttwo or more mbuf:\n"); first = 0; } printf("\t\t\t%s= %llu\n", if_indextoname(i, ifbuf), (unsigned long long)ip6stat.ip6s_m2m[i]); } } printf("\t\t%llu one ext mbuf\n", (unsigned long long)ip6stat.ip6s_mext1); printf("\t\t%llu two or more ext mbuf\n", (unsigned long long)ip6stat.ip6s_mext2m); p(ip6s_exthdrtoolong, "\t%llu packet%s whose headers are not continuous\n"); p(ip6s_nogif, "\t%llu tunneling packet%s that can't find gif\n"); p(ip6s_toomanyhdr, "\t%llu packet%s discarded due to too may headers\n"); /* for debugging source address selection */ #define PRINT_SCOPESTAT(s,i) do {\ switch(i) { /* XXX hardcoding in each case */\ case 1:\ p(s, "\t\t%llu node-local%s\n");\ break;\ case 2:\ p(s,"\t\t%llu link-local%s\n");\ break;\ case 5:\ p(s,"\t\t%llu site-local%s\n");\ break;\ case 14:\ p(s,"\t\t%llu global%s\n");\ break;\ default:\ printf("\t\t%llu addresses scope=%x\n",\ (unsigned long long)ip6stat.s, i);\ }\ } while (0); p(ip6s_sources_none, "\t%llu failure%s of source address selection\n"); for (first = 1, i = 0; i < 16; i++) { if (ip6stat.ip6s_sources_sameif[i]) { if (first) { printf("\tsource addresses on an outgoing I/F\n"); first = 0; } PRINT_SCOPESTAT(ip6s_sources_sameif[i], i); } } for (first = 1, i = 0; i < 16; i++) { if (ip6stat.ip6s_sources_otherif[i]) { if (first) { printf("\tsource addresses on a non-outgoing I/F\n"); first = 0; } PRINT_SCOPESTAT(ip6s_sources_otherif[i], i); } } for (first = 1, i = 0; i < 16; i++) { if (ip6stat.ip6s_sources_samescope[i]) { if (first) { printf("\tsource addresses of same scope\n"); first = 0; } PRINT_SCOPESTAT(ip6s_sources_samescope[i], i); } } for (first = 1, i = 0; i < 16; i++) { if (ip6stat.ip6s_sources_otherscope[i]) { if (first) { printf("\tsource addresses of a different scope\n"); first = 0; } PRINT_SCOPESTAT(ip6s_sources_otherscope[i], i); } } for (first = 1, i = 0; i < 16; i++) { if (ip6stat.ip6s_sources_deprecated[i]) { if (first) { printf("\tdeprecated source addresses\n"); first = 0; } PRINT_SCOPESTAT(ip6s_sources_deprecated[i], i); } } p1a(ip6s_forward_cachehit, "\t%llu forward cache hit\n"); p1a(ip6s_forward_cachemiss, "\t%llu forward cache miss\n"); #undef p #undef p1a }
/* * Dump TCP statistics structure. */ void tcp_stats(u_long off __unused, const char *name, int af1 __unused) { struct tcp_stats tcpstat, *stattmp; struct tcp_stats zerostat[SMP_MAXCPU]; size_t len = sizeof(struct tcp_stats) * SMP_MAXCPU; int cpucnt; if (zflag) memset(zerostat, 0, len); if ((stattmp = malloc(len)) == NULL) { return; } else { if (sysctlbyname("net.inet.tcp.stats", stattmp, &len, zflag ? zerostat : NULL, zflag ? len : 0) < 0) { warn("sysctl: net.inet.tcp.stats"); free(stattmp); return; } else { if ((stattmp = realloc(stattmp, len)) == NULL) { warn("tcp_stats"); return; } } } cpucnt = len / sizeof(struct tcp_stats); tcp_stats_agg(stattmp, &tcpstat, cpucnt); #ifdef INET6 if (tcp_done != 0) return; else tcp_done = 1; #endif printf ("%s:\n", name); #define p(f, m) if (tcpstat.f || sflag <= 1) \ printf(m, tcpstat.f, plural(tcpstat.f)) #define p1a(f, m) if (tcpstat.f || sflag <= 1) \ printf(m, 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 p2a(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(tcps_sndtotal, "\t%lu packet%s sent\n"); p2(tcps_sndpack,tcps_sndbyte, "\t\t%lu data packet%s (%lu byte%s)\n"); p2(tcps_sndrexmitpack, tcps_sndrexmitbyte, "\t\t%lu data packet%s (%lu byte%s) retransmitted\n"); p2(tcps_sndsackrtopack, tcps_sndsackrtobyte, "\t\t%lu data packet%s (%lu byte%s) retransmitted by SACK\n"); p2(tcps_sndsackpack, tcps_sndsackbyte, "\t\t%lu data packet%s (%lu byte%s) sent by SACK recovery\n"); p2(tcps_sackrescue, tcps_sackrescue_try, "\t\t%lu SACK rescue packet%s sent (of %lu attempt%s)\n"); p2a(tcps_sndfastrexmit, tcps_sndearlyrexmit, "\t\t%lu Fast Retransmit%s (%lu early)\n"); p(tcps_sndlimited, "\t\t%lu packet%s sent by Limited Transmit\n"); p2(tcps_sndrtobad, tcps_eifelresponse, "\t\t%lu spurious RTO retransmit%s (%lu Eifel-response%s)\n"); p2a(tcps_sndfastrexmitbad, tcps_sndearlyrexmitbad, "\t\t%lu spurious Fast Retransmit%s (%lu early)\n"); p2a(tcps_eifeldetected, tcps_rttcantdetect, "\t\t%lu Eifel-detected spurious retransmit%s (%lu non-RTT)\n"); p(tcps_rttdetected, "\t\t%lu RTT-detected spurious retransmit%s\n"); p(tcps_mturesent, "\t\t%lu resend%s initiated by MTU discovery\n"); p(tcps_sndsackopt, "\t\t%lu SACK option%s sent\n"); p(tcps_snddsackopt, "\t\t%lu D-SACK option%s sent\n"); p2a(tcps_sndacks, tcps_delack, "\t\t%lu ack-only packet%s (%lu delayed)\n"); p(tcps_sndurg, "\t\t%lu URG only packet%s\n"); p(tcps_sndprobe, "\t\t%lu window probe packet%s\n"); p(tcps_sndwinup, "\t\t%lu window update packet%s\n"); p(tcps_sndctrl, "\t\t%lu control packet%s\n"); p(tcps_rcvtotal, "\t%lu packet%s received\n"); p2(tcps_rcvackpack, tcps_rcvackbyte, "\t\t%lu ack%s (for %lu byte%s)\n"); p(tcps_rcvdupack, "\t\t%lu duplicate ack%s\n"); p(tcps_rcvacktoomuch, "\t\t%lu ack%s for unsent data\n"); p2(tcps_rcvpack, tcps_rcvbyte, "\t\t%lu packet%s (%lu byte%s) received in-sequence\n"); p2(tcps_rcvduppack, tcps_rcvdupbyte, "\t\t%lu completely duplicate packet%s (%lu byte%s)\n"); p2(tcps_pawsdrop, tcps_pawsaccept, "\t\t%lu old duplicate packet%s (%lu packet%s accepted)\n"); p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte, "\t\t%lu packet%s with some dup. data (%lu byte%s duped)\n"); p2(tcps_rcvoopack, tcps_rcvoobyte, "\t\t%lu out-of-order packet%s (%lu byte%s)\n"); p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin, "\t\t%lu packet%s (%lu byte%s) of data after window\n"); p(tcps_rcvwinprobe, "\t\t%lu window probe%s\n"); p(tcps_rcvwinupd, "\t\t%lu window update packet%s\n"); p(tcps_rcvafterclose, "\t\t%lu packet%s received after close\n"); p(tcps_rcvbadsum, "\t\t%lu discarded for bad checksum%s\n"); p(tcps_rcvbadoff, "\t\t%lu discarded for bad header offset field%s\n"); p1a(tcps_rcvshort, "\t\t%lu discarded because packet too short\n"); p(tcps_rcvbadsackopt, "\t\t%lu bad SACK option%s\n"); p1a(tcps_sackrenege, "\t\t%lu other side reneged\n"); p(tcps_connattempt, "\t%lu connection request%s\n"); p(tcps_accepts, "\t%lu connection accept%s\n"); p(tcps_badsyn, "\t%lu bad connection attempt%s\n"); p(tcps_listendrop, "\t%lu listen queue overflow%s\n"); p(tcps_connects, "\t%lu connection%s established (including accepts)\n"); p2(tcps_closed, tcps_drops, "\t%lu connection%s closed (including %lu drop%s)\n"); p(tcps_cachedrtt, "\t\t%lu connection%s updated cached RTT on close\n"); p(tcps_cachedrttvar, "\t\t%lu connection%s updated cached RTT variance on close\n"); p(tcps_cachedssthresh, "\t\t%lu connection%s updated cached ssthresh on close\n"); p(tcps_conndrops, "\t%lu embryonic connection%s dropped\n"); p2(tcps_rttupdated, tcps_segstimed, "\t%lu segment%s updated rtt (of %lu attempt%s)\n"); p(tcps_rexmttimeo, "\t%lu retransmit timeout%s\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_persistdrop, "\t\t%lu connection%s dropped by persist timeout\n"); p(tcps_keeptimeo, "\t%lu keepalive timeout%s\n"); p(tcps_keepprobe, "\t\t%lu keepalive probe%s sent\n"); p(tcps_keepdrops, "\t\t%lu connection%s dropped by keepalive\n"); p(tcps_predack, "\t%lu correct ACK header prediction%s\n"); p(tcps_preddat, "\t%lu correct data packet header prediction%s\n"); p(tcps_sndidle, "\t%lu send idle%s\n"); p1a(tcps_sc_added, "\t%lu syncache entries added\n"); p1a(tcps_sc_retransmitted, "\t\t%lu retransmitted\n"); p1a(tcps_sc_dupsyn, "\t\t%lu dupsyn\n"); p1a(tcps_sc_dropped, "\t\t%lu dropped\n"); p1a(tcps_sc_completed, "\t\t%lu completed\n"); p1a(tcps_sc_bucketoverflow, "\t\t%lu bucket overflow\n"); p1a(tcps_sc_cacheoverflow, "\t\t%lu cache overflow\n"); p1a(tcps_sc_reset, "\t\t%lu reset\n"); p1a(tcps_sc_stale, "\t\t%lu stale\n"); p1a(tcps_sc_aborted, "\t\t%lu aborted\n"); p1a(tcps_sc_badack, "\t\t%lu badack\n"); p1a(tcps_sc_unreach, "\t\t%lu unreach\n"); p1a(tcps_sc_zonefail, "\t\t%lu zone failures\n"); p1a(tcps_sc_sendcookie, "\t\t%lu cookies sent\n"); p1a(tcps_sc_recvcookie, "\t\t%lu cookies received\n"); p(tcps_sacksbupdate, "\t%lu SACK scoreboard update%s\n"); p(tcps_sacksboverflow, "\t\t%lu overflow%s\n"); p(tcps_sacksbfailed, "\t\t%lu failure%s\n"); p(tcps_sacksbreused, "\t\t%lu record%s reused\n"); p(tcps_sacksbfast, "\t\t%lu record%s fast allocated\n"); free(stattmp); #undef p #undef p1a #undef p2 #undef p2a #undef p3 }
/* * Dump IP statistics structure. */ void ip_stats(u_long off __unused, const char *name, int af1 __unused) { struct ip_stats ipstat, *stattmp; struct ip_stats zerostat[SMP_MAXCPU]; size_t len = sizeof(struct ip_stats) * SMP_MAXCPU; int cpucnt; if (zflag) memset(zerostat, 0, len); if ((stattmp = malloc(len)) == NULL) { return; } else { if (sysctlbyname("net.inet.ip.stats", stattmp, &len, zflag ? zerostat : NULL, zflag ? len : 0) < 0) { warn("sysctl: net.inet.ip.stats"); free(stattmp); return; } else { if ((stattmp = realloc(stattmp, len)) == NULL) { warn("ip_stats"); return; } } } cpucnt = len / sizeof(struct ip_stats); ip_stats_agg(stattmp, &ipstat, cpucnt); printf("%s:\n", name); #define p(f, m) if (ipstat.f || sflag <= 1) \ printf(m, ipstat.f, plural(ipstat.f)) #define p1a(f, m) if (ipstat.f || sflag <= 1) \ printf(m, ipstat.f) p(ips_total, "\t%lu total packet%s received\n"); p(ips_badsum, "\t%lu bad header checksum%s\n"); p1a(ips_toosmall, "\t%lu with size smaller than minimum\n"); p1a(ips_tooshort, "\t%lu with data size < data length\n"); p1a(ips_toolong, "\t%lu with ip length > max ip packet size\n"); p1a(ips_badhlen, "\t%lu with header length < data size\n"); p1a(ips_badlen, "\t%lu with data length < header length\n"); p1a(ips_badoptions, "\t%lu with bad options\n"); p1a(ips_badvers, "\t%lu with incorrect version number\n"); p(ips_fragments, "\t%lu fragment%s received\n"); p(ips_fragdropped, "\t%lu fragment%s dropped (dup or out of space)\n"); p(ips_fragtimeout, "\t%lu fragment%s dropped after timeout\n"); p(ips_reassembled, "\t%lu packet%s reassembled ok\n"); p(ips_delivered, "\t%lu packet%s for this host\n"); p(ips_noproto, "\t%lu packet%s for unknown/unsupported protocol\n"); p(ips_forward, "\t%lu packet%s forwarded"); p(ips_fastforward, " (%lu packet%s fast forwarded)"); if (ipstat.ips_forward || sflag <= 1) putchar('\n'); p(ips_cantforward, "\t%lu packet%s not forwardable\n"); p(ips_notmember, "\t%lu packet%s received for unknown multicast group\n"); p(ips_redirectsent, "\t%lu redirect%s sent\n"); p(ips_localout, "\t%lu packet%s sent from this host\n"); p(ips_rawout, "\t%lu packet%s sent with fabricated ip header\n"); p(ips_odropped, "\t%lu output packet%s dropped due to no bufs, etc.\n"); p(ips_noroute, "\t%lu output packet%s discarded due to no route\n"); p(ips_fragmented, "\t%lu output datagram%s fragmented\n"); p(ips_ofragments, "\t%lu fragment%s created\n"); p(ips_cantfrag, "\t%lu datagram%s that can't be fragmented\n"); p(ips_nogif, "\t%lu tunneling packet%s that can't find gif\n"); p(ips_badaddr, "\t%lu datagram%s with bad address in header\n"); free(stattmp); #undef p #undef p1a }
/* * Dump IP statistics structure. */ void ip_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { struct ipstat ipstat; if (fetch_stats("net.inet.ip.stats", off, &ipstat, sizeof(ipstat), kread_counters) != 0) return; xo_open_container(name); xo_emit("{T:/%s}:\n", name); #define p(f, m) if (ipstat.f || sflag <= 1) \ xo_emit(m, (uintmax_t )ipstat.f, plural(ipstat.f)) #define p1a(f, m) if (ipstat.f || sflag <= 1) \ xo_emit(m, (uintmax_t )ipstat.f) p(ips_total, "\t{:received-packets/%ju} " "{N:/total packet%s received}\n"); p(ips_badsum, "\t{:dropped-bad-checksum/%ju} " "{N:/bad header checksum%s}\n"); p1a(ips_toosmall, "\t{:dropped-below-minimum-size/%ju} " "{N:/with size smaller than minimum}\n"); p1a(ips_tooshort, "\t{:dropped-short-packets/%ju} " "{N:/with data size < data length}\n"); p1a(ips_toolong, "\t{:dropped-too-long/%ju} " "{N:/with ip length > max ip packet size}\n"); p1a(ips_badhlen, "\t{:dropped-short-header-length/%ju} " "{N:/with header length < data size}\n"); p1a(ips_badlen, "\t{:dropped-short-data/%ju} " "{N:/with data length < header length}\n"); p1a(ips_badoptions, "\t{:dropped-bad-options/%ju} " "{N:/with bad options}\n"); p1a(ips_badvers, "\t{:dropped-bad-version/%ju} " "{N:/with incorrect version number}\n"); p(ips_fragments, "\t{:received-fragments/%ju} " "{N:/fragment%s received}\n"); p(ips_fragdropped, "\t{:dropped-fragments/%ju} " "{N:/fragment%s dropped (dup or out of space)}\n"); p(ips_fragtimeout, "\t{:dropped-fragments-after-timeout/%ju} " "{N:/fragment%s dropped after timeout}\n"); p(ips_reassembled, "\t{:reassembled-packets/%ju} " "{N:/packet%s reassembled ok}\n"); p(ips_delivered, "\t{:received-local-packets/%ju} " "{N:/packet%s for this host}\n"); p(ips_noproto, "\t{:dropped-unknown-protocol/%ju} " "{N:/packet%s for unknown\\/unsupported protocol}\n"); p(ips_forward, "\t{:forwarded-packets/%ju} " "{N:/packet%s forwarded}"); p(ips_fastforward, " ({:fast-forwarded-packets/%ju} " "{N:/packet%s fast forwarded})"); if (ipstat.ips_forward || sflag <= 1) xo_emit("\n"); p(ips_cantforward, "\t{:packets-cannot-forward/%ju} " "{N:/packet%s not forwardable}\n"); p(ips_notmember, "\t{:received-unknown-multicast-group/%ju} " "{N:/packet%s received for unknown multicast group}\n"); p(ips_redirectsent, "\t{:redirects-sent/%ju} " "{N:/redirect%s sent}\n"); p(ips_localout, "\t{:sent-packets/%ju} " "{N:/packet%s sent from this host}\n"); p(ips_rawout, "\t{:send-packets-fabricated-header/%ju} " "{N:/packet%s sent with fabricated ip header}\n"); p(ips_odropped, "\t{:discard-no-mbufs/%ju} " "{N:/output packet%s dropped due to no bufs, etc.}\n"); p(ips_noroute, "\t{:discard-no-route/%ju} " "{N:/output packet%s discarded due to no route}\n"); p(ips_fragmented, "\t{:sent-fragments/%ju} " "{N:/output datagram%s fragmented}\n"); p(ips_ofragments, "\t{:fragments-created/%ju} " "{N:/fragment%s created}\n"); p(ips_cantfrag, "\t{:discard-cannot-fragment/%ju} " "{N:/datagram%s that can't be fragmented}\n"); p(ips_nogif, "\t{:discard-tunnel-no-gif/%ju} " "{N:/tunneling packet%s that can't find gif}\n"); p(ips_badaddr, "\t{:discard-bad-address/%ju} " "{N:/datagram%s with bad address in header}\n"); #undef p #undef p1a xo_close_container(name); }
/* * Dump ICMP statistics. */ void icmp_stats(u_long off __unused, const char *name, int af1 __unused) { struct icmpstat icmpstat, zerostat; int i, first; int mib[4]; /* CTL_NET + PF_INET + IPPROTO_ICMP + req */ size_t len; mib[0] = CTL_NET; mib[1] = PF_INET; mib[2] = IPPROTO_ICMP; mib[3] = ICMPCTL_STATS; len = sizeof icmpstat; if (zflag) memset(&zerostat, 0, len); if (sysctl(mib, 4, &icmpstat, &len, zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { warn("sysctl: net.inet.icmp.stats"); return; } printf("%s:\n", name); #define p(f, m) if (icmpstat.f || sflag <= 1) \ printf(m, icmpstat.f, plural(icmpstat.f)) #define p1a(f, m) if (icmpstat.f || sflag <= 1) \ printf(m, icmpstat.f) #define p2(f, m) if (icmpstat.f || sflag <= 1) \ printf(m, icmpstat.f, plurales(icmpstat.f)) p(icps_error, "\t%lu call%s to icmp_error\n"); p(icps_oldicmp, "\t%lu error%s not generated 'cuz old message was icmp\n"); for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++) if (icmpstat.icps_outhist[i] != 0) { if (first) { printf("\tOutput histogram:\n"); first = 0; } printf("\t\t%s: %lu\n", icmpnames[i], icmpstat.icps_outhist[i]); } p(icps_badcode, "\t%lu message%s with bad code fields\n"); p(icps_tooshort, "\t%lu message%s < minimum length\n"); p(icps_checksum, "\t%lu bad checksum%s\n"); p(icps_badlen, "\t%lu message%s with bad length\n"); p1a(icps_bmcastecho, "\t%lu multicast echo requests ignored\n"); p1a(icps_bmcasttstamp, "\t%lu multicast timestamp requests ignored\n"); for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++) if (icmpstat.icps_inhist[i] != 0) { if (first) { printf("\tInput histogram:\n"); first = 0; } printf("\t\t%s: %lu\n", icmpnames[i], icmpstat.icps_inhist[i]); } p(icps_reflect, "\t%lu message response%s generated\n"); p2(icps_badaddr, "\t%lu invalid return address%s\n"); p(icps_noroute, "\t%lu no return route%s\n"); #undef p #undef p1a #undef p2 mib[3] = ICMPCTL_MASKREPL; len = sizeof i; if (sysctl(mib, 4, &i, &len, NULL, 0) < 0) return; printf("\tICMP address mask responses are %sabled\n", i ? "en" : "dis"); }
/* * Dump IP6 statistics structure. */ void ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { struct ip6stat ip6stat, zerostat; int first, i; size_t len; len = sizeof ip6stat; if (live) { memset(&ip6stat, 0, len); if (zflag) memset(&zerostat, 0, len); if (sysctlbyname("net.inet6.ip6.stats", &ip6stat, &len, zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { if (errno != ENOENT) warn("sysctl: net.inet6.ip6.stats"); return; } } else kread_counters(off, &ip6stat, len); printf("%s:\n", name); #define p(f, m) if (ip6stat.f || sflag <= 1) \ printf(m, (uintmax_t)ip6stat.f, plural(ip6stat.f)) #define p1a(f, m) if (ip6stat.f || sflag <= 1) \ printf(m, (uintmax_t)ip6stat.f) p(ip6s_total, "\t%ju total packet%s received\n"); p1a(ip6s_toosmall, "\t%ju with size smaller than minimum\n"); p1a(ip6s_tooshort, "\t%ju with data size < data length\n"); p1a(ip6s_badoptions, "\t%ju with bad options\n"); p1a(ip6s_badvers, "\t%ju with incorrect version number\n"); p(ip6s_fragments, "\t%ju fragment%s received\n"); p(ip6s_fragdropped, "\t%ju fragment%s dropped (dup or out of space)\n"); p(ip6s_fragtimeout, "\t%ju fragment%s dropped after timeout\n"); p(ip6s_fragoverflow, "\t%ju fragment%s that exceeded limit\n"); p(ip6s_reassembled, "\t%ju packet%s reassembled ok\n"); p(ip6s_delivered, "\t%ju packet%s for this host\n"); p(ip6s_forward, "\t%ju packet%s forwarded\n"); p(ip6s_cantforward, "\t%ju packet%s not forwardable\n"); p(ip6s_redirectsent, "\t%ju redirect%s sent\n"); p(ip6s_localout, "\t%ju packet%s sent from this host\n"); p(ip6s_rawout, "\t%ju packet%s sent with fabricated ip header\n"); p(ip6s_odropped, "\t%ju output packet%s dropped due to no bufs, etc.\n"); p(ip6s_noroute, "\t%ju output packet%s discarded due to no route\n"); p(ip6s_fragmented, "\t%ju output datagram%s fragmented\n"); p(ip6s_ofragments, "\t%ju fragment%s created\n"); p(ip6s_cantfrag, "\t%ju datagram%s that can't be fragmented\n"); p(ip6s_badscope, "\t%ju packet%s that violated scope rules\n"); p(ip6s_notmember, "\t%ju multicast packet%s which we don't join\n"); for (first = 1, i = 0; i < IP6S_HDRCNT; i++) if (ip6stat.ip6s_nxthist[i] != 0) { if (first) { printf("\tInput histogram:\n"); first = 0; } printf("\t\t%s: %ju\n", ip6nh[i], (uintmax_t)ip6stat.ip6s_nxthist[i]); } printf("\tMbuf statistics:\n"); printf("\t\t%ju one mbuf\n", (uintmax_t)ip6stat.ip6s_m1); for (first = 1, i = 0; i < IP6S_M2MMAX; i++) { char ifbuf[IFNAMSIZ]; if (ip6stat.ip6s_m2m[i] != 0) { if (first) { printf("\t\ttwo or more mbuf:\n"); first = 0; } printf("\t\t\t%s= %ju\n", if_indextoname(i, ifbuf), (uintmax_t)ip6stat.ip6s_m2m[i]); } } printf("\t\t%ju one ext mbuf\n", (uintmax_t)ip6stat.ip6s_mext1); printf("\t\t%ju two or more ext mbuf\n", (uintmax_t)ip6stat.ip6s_mext2m); p(ip6s_exthdrtoolong, "\t%ju packet%s whose headers are not contiguous\n"); p(ip6s_nogif, "\t%ju tunneling packet%s that can't find gif\n"); p(ip6s_toomanyhdr, "\t%ju packet%s discarded because of too many headers\n"); /* for debugging source address selection */ #define PRINT_SCOPESTAT(s,i) do {\ switch(i) { /* XXX hardcoding in each case */\ case 1:\ p(s, "\t\t%ju interface-local%s\n");\ break;\ case 2:\ p(s,"\t\t%ju link-local%s\n");\ break;\ case 5:\ p(s,"\t\t%ju site-local%s\n");\ break;\ case 14:\ p(s,"\t\t%ju global%s\n");\ break;\ default:\ printf("\t\t%ju addresses scope=%x\n",\ (uintmax_t)ip6stat.s, i);\ }\ } while (0); p(ip6s_sources_none, "\t%ju failure%s of source address selection\n"); for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_sameif[i]) { if (first) { printf("\tsource addresses on an outgoing I/F\n"); first = 0; } PRINT_SCOPESTAT(ip6s_sources_sameif[i], i); } } for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_otherif[i]) { if (first) { printf("\tsource addresses on a non-outgoing I/F\n"); first = 0; } PRINT_SCOPESTAT(ip6s_sources_otherif[i], i); } } for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_samescope[i]) { if (first) { printf("\tsource addresses of same scope\n"); first = 0; } PRINT_SCOPESTAT(ip6s_sources_samescope[i], i); } } for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_otherscope[i]) { if (first) { printf("\tsource addresses of a different scope\n"); first = 0; } PRINT_SCOPESTAT(ip6s_sources_otherscope[i], i); } } for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_deprecated[i]) { if (first) { printf("\tdeprecated source addresses\n"); first = 0; } PRINT_SCOPESTAT(ip6s_sources_deprecated[i], i); } } printf("\tSource addresses selection rule applied:\n"); for (i = 0; i < IP6S_RULESMAX; i++) { if (ip6stat.ip6s_sources_rule[i]) printf("\t\t%ju %s\n", (uintmax_t)ip6stat.ip6s_sources_rule[i], srcrule_str[i]); } #undef p #undef p1a }
/* * Dump SCTP statistics structure. */ void sctp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { struct sctpstat sctpstat, zerostat; size_t len = sizeof(sctpstat); if (live) { if (zflag) memset(&zerostat, 0, len); if (sysctlbyname("net.inet.sctp.stats", &sctpstat, &len, zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { if (errno != ENOENT) warn("sysctl: net.inet.sctp.stats"); return; } } else kread(off, &sctpstat, len); printf ("%s:\n", name); #define p(f, m) if (sctpstat.f || sflag <= 1) \ printf(m, (uintmax_t)sctpstat.f, plural(sctpstat.f)) #define p1a(f, m) if (sctpstat.f || sflag <= 1) \ printf(m, (uintmax_t)sctpstat.f) /* * input statistics */ p(sctps_recvpackets, "\t%ju input packet%s\n"); p(sctps_recvdatagrams, "\t\t%ju datagram%s\n"); p(sctps_recvpktwithdata, "\t\t%ju packet%s that had data\n"); p(sctps_recvsacks, "\t\t%ju input SACK chunk%s\n"); p(sctps_recvdata, "\t\t%ju input DATA chunk%s\n"); p(sctps_recvdupdata, "\t\t%ju duplicate DATA chunk%s\n"); p(sctps_recvheartbeat, "\t\t%ju input HB chunk%s\n"); p(sctps_recvheartbeatack, "\t\t%ju HB-ACK chunk%s\n"); p(sctps_recvecne, "\t\t%ju input ECNE chunk%s\n"); p(sctps_recvauth, "\t\t%ju input AUTH chunk%s\n"); p(sctps_recvauthmissing, "\t\t%ju chunk%s missing AUTH\n"); p(sctps_recvivalhmacid, "\t\t%ju invalid HMAC id%s received\n"); p(sctps_recvivalkeyid, "\t\t%ju invalid secret id%s received\n"); p1a(sctps_recvauthfailed, "\t\t%ju auth failed\n"); p1a(sctps_recvexpress, "\t\t%ju fast path receives all one chunk\n"); p1a(sctps_recvexpressm, "\t\t%ju fast path multi-part data\n"); /* * output statistics */ p(sctps_sendpackets, "\t%ju output packet%s\n"); p(sctps_sendsacks, "\t\t%ju output SACK%s\n"); p(sctps_senddata, "\t\t%ju output DATA chunk%s\n"); p(sctps_sendretransdata, "\t\t%ju retransmitted DATA chunk%s\n"); p(sctps_sendfastretrans, "\t\t%ju fast retransmitted DATA chunk%s\n"); p(sctps_sendmultfastretrans, "\t\t%ju FR'%s that happened more " "than once to same chunk\n"); p(sctps_sendheartbeat, "\t\t%ju output HB chunk%s\n"); p(sctps_sendecne, "\t\t%ju output ECNE chunk%s\n"); p(sctps_sendauth, "\t\t%ju output AUTH chunk%s\n"); p1a(sctps_senderrors, "\t\t%ju ip_output error counter\n"); /* * PCKDROPREP statistics */ printf("\tPacket drop statistics:\n"); p1a(sctps_pdrpfmbox, "\t\t%ju from middle box\n"); p1a(sctps_pdrpfehos, "\t\t%ju from end host\n"); p1a(sctps_pdrpmbda, "\t\t%ju with data\n"); p1a(sctps_pdrpmbct, "\t\t%ju non-data, non-endhost\n"); p1a(sctps_pdrpbwrpt, "\t\t%ju non-endhost, bandwidth rep only\n"); p1a(sctps_pdrpcrupt, "\t\t%ju not enough for chunk header\n"); p1a(sctps_pdrpnedat, "\t\t%ju not enough data to confirm\n"); p1a(sctps_pdrppdbrk, "\t\t%ju where process_chunk_drop said break\n"); p1a(sctps_pdrptsnnf, "\t\t%ju failed to find TSN\n"); p1a(sctps_pdrpdnfnd, "\t\t%ju attempt reverse TSN lookup\n"); p1a(sctps_pdrpdiwnp, "\t\t%ju e-host confirms zero-rwnd\n"); p1a(sctps_pdrpdizrw, "\t\t%ju midbox confirms no space\n"); p1a(sctps_pdrpbadd, "\t\t%ju data did not match TSN\n"); p(sctps_pdrpmark, "\t\t%ju TSN'%s marked for Fast Retran\n"); /* * Timeouts */ printf("\tTimeouts:\n"); p(sctps_timoiterator, "\t\t%ju iterator timer%s fired\n"); p(sctps_timodata, "\t\t%ju T3 data time out%s\n"); p(sctps_timowindowprobe, "\t\t%ju window probe (T3) timer%s fired\n"); p(sctps_timoinit, "\t\t%ju INIT timer%s fired\n"); p(sctps_timosack, "\t\t%ju sack timer%s fired\n"); p(sctps_timoshutdown, "\t\t%ju shutdown timer%s fired\n"); p(sctps_timoheartbeat, "\t\t%ju heartbeat timer%s fired\n"); p1a(sctps_timocookie, "\t\t%ju a cookie timeout fired\n"); p1a(sctps_timosecret, "\t\t%ju an endpoint changed its cookie" "secret\n"); p(sctps_timopathmtu, "\t\t%ju PMTU timer%s fired\n"); p(sctps_timoshutdownack, "\t\t%ju shutdown ack timer%s fired\n"); p(sctps_timoshutdownguard, "\t\t%ju shutdown guard timer%s fired\n"); p(sctps_timostrmrst, "\t\t%ju stream reset timer%s fired\n"); p(sctps_timoearlyfr, "\t\t%ju early FR timer%s fired\n"); p1a(sctps_timoasconf, "\t\t%ju an asconf timer fired\n"); p1a(sctps_timoautoclose, "\t\t%ju auto close timer fired\n"); p(sctps_timoassockill, "\t\t%ju asoc free timer%s expired\n"); p(sctps_timoinpkill, "\t\t%ju inp free timer%s expired\n"); #if 0 /* * Early fast retransmission counters */ p(sctps_earlyfrstart, "\t%ju TODO:sctps_earlyfrstart\n"); p(sctps_earlyfrstop, "\t%ju TODO:sctps_earlyfrstop\n"); p(sctps_earlyfrmrkretrans, "\t%ju TODO:sctps_earlyfrmrkretrans\n"); p(sctps_earlyfrstpout, "\t%ju TODO:sctps_earlyfrstpout\n"); p(sctps_earlyfrstpidsck1, "\t%ju TODO:sctps_earlyfrstpidsck1\n"); p(sctps_earlyfrstpidsck2, "\t%ju TODO:sctps_earlyfrstpidsck2\n"); p(sctps_earlyfrstpidsck3, "\t%ju TODO:sctps_earlyfrstpidsck3\n"); p(sctps_earlyfrstpidsck4, "\t%ju TODO:sctps_earlyfrstpidsck4\n"); p(sctps_earlyfrstrid, "\t%ju TODO:sctps_earlyfrstrid\n"); p(sctps_earlyfrstrout, "\t%ju TODO:sctps_earlyfrstrout\n"); p(sctps_earlyfrstrtmr, "\t%ju TODO:sctps_earlyfrstrtmr\n"); #endif /* * Others */ p1a(sctps_hdrops, "\t%ju packet shorter than header\n"); p1a(sctps_badsum, "\t%ju checksum error\n"); p1a(sctps_noport, "\t%ju no endpoint for port\n"); p1a(sctps_badvtag, "\t%ju bad v-tag\n"); p1a(sctps_badsid, "\t%ju bad SID\n"); p1a(sctps_nomem, "\t%ju no memory\n"); p1a(sctps_fastretransinrtt, "\t%ju number of multiple FR in a RTT " "window\n"); #if 0 p(sctps_markedretrans, "\t%ju TODO:sctps_markedretrans\n"); #endif p1a(sctps_naglesent, "\t%ju RFC813 allowed sending\n"); p1a(sctps_naglequeued, "\t%ju RFC813 does not allow sending\n"); p1a(sctps_maxburstqueued, "\t%ju times max burst prohibited sending\n"); p1a(sctps_ifnomemqueued, "\t%ju look ahead tells us no memory in " "interface\n"); p(sctps_windowprobed, "\t%ju number%s of window probes sent\n"); p(sctps_lowlevelerr, "\t%ju time%s an output error to clamp " "down on next user send\n"); p(sctps_lowlevelerrusr, "\t%ju time%s sctp_senderrors were " "caused from a user\n"); p(sctps_datadropchklmt, "\t%ju number of in data drop%s due to " "chunk limit reached\n"); p(sctps_datadroprwnd, "\t%ju number of in data drop%s due to rwnd " "limit reached\n"); p(sctps_ecnereducedcwnd, "\t%ju time%s a ECN reduced " "the cwnd\n"); p1a(sctps_vtagexpress, "\t%ju used express lookup via vtag\n"); p1a(sctps_vtagbogus, "\t%ju collision in express lookup\n"); p(sctps_primary_randry, "\t%ju time%s the sender ran dry " "of user data on primary\n"); p1a(sctps_cmt_randry, "\t%ju same for above\n"); p(sctps_slowpath_sack, "\t%ju sack%s the slow way\n"); p(sctps_wu_sacks_sent, "\t%ju window update only sack%s sent\n"); p(sctps_sends_with_flags, "\t%ju send%s with sinfo_flags !=0\n"); p(sctps_sends_with_unord, "\t%ju unordered send%s\n"); p(sctps_sends_with_eof, "\t%ju send%s with EOF flag set\n"); p(sctps_sends_with_abort, "\t%ju send%s with ABORT flag set\n"); p(sctps_protocol_drain_calls, "\t%ju time%s protocol drain called\n"); p(sctps_protocol_drains_done, "\t%ju time%s we did a protocol " "drain\n"); p(sctps_read_peeks, "\t%ju time%s recv was called with peek\n"); p(sctps_cached_chk, "\t%ju cached chunk%s used\n"); p1a(sctps_cached_strmoq, "\t%ju cached stream oq's used\n"); p(sctps_left_abandon, "\t%ju unread message%s abandonded by close\n"); p1a(sctps_send_burst_avoid, "\t%ju send burst avoidance, already " "max burst inflight to net\n"); p1a(sctps_send_cwnd_avoid, "\t%ju send cwnd full avoidance, already " "max burst inflight to net\n"); p(sctps_fwdtsn_map_over, "\t%ju number of map array over-run%s via " "fwd-tsn's\n"); #undef p #undef p1a }