[BACK]Return to inet.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / netstat

Annotation of src/usr.bin/netstat/inet.c, Revision 1.68

1.68    ! tedu        1: /*     $OpenBSD: inet.c,v 1.67 2003/09/04 03:20:17 deraadt Exp $       */
1.1       deraadt     2: /*     $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $        */
                      3:
                      4: /*
                      5:  * Copyright (c) 1983, 1988, 1993
                      6:  *     The Regents of the University of California.  All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
1.65      millert    16:  * 3. Neither the name of the University nor the names of its contributors
1.1       deraadt    17:  *    may be used to endorse or promote products derived from this software
                     18:  *    without specific prior written permission.
                     19:  *
                     20:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     21:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     22:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     23:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     24:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     25:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     26:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     27:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     28:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     29:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     30:  * SUCH DAMAGE.
                     31:  */
                     32:
                     33: #ifndef lint
                     34: #if 0
                     35: static char sccsid[] = "from: @(#)inet.c       8.4 (Berkeley) 4/20/94";
                     36: #else
1.68    ! tedu       37: static char *rcsid = "$OpenBSD: inet.c,v 1.67 2003/09/04 03:20:17 deraadt Exp $";
1.1       deraadt    38: #endif
                     39: #endif /* not lint */
                     40:
                     41: #include <sys/param.h>
                     42: #include <sys/queue.h>
                     43: #include <sys/socket.h>
                     44: #include <sys/socketvar.h>
                     45: #include <sys/mbuf.h>
                     46: #include <sys/protosw.h>
                     47:
                     48: #include <net/route.h>
                     49: #include <netinet/in.h>
                     50: #include <netinet/in_systm.h>
                     51: #include <netinet/ip.h>
                     52: #include <netinet/in_pcb.h>
                     53: #include <netinet/ip_icmp.h>
                     54: #include <netinet/icmp_var.h>
                     55: #include <netinet/igmp_var.h>
                     56: #include <netinet/ip_var.h>
                     57: #include <netinet/tcp.h>
                     58: #include <netinet/tcpip.h>
                     59: #include <netinet/tcp_seq.h>
                     60: #define TCPSTATES
                     61: #include <netinet/tcp_fsm.h>
                     62: #include <netinet/tcp_timer.h>
                     63: #include <netinet/tcp_var.h>
                     64: #include <netinet/tcp_debug.h>
                     65: #include <netinet/udp.h>
                     66: #include <netinet/udp_var.h>
1.30      angelos    67: #include <netinet/ip_ipsp.h>
1.10      angelos    68: #include <netinet/ip_ah.h>
                     69: #include <netinet/ip_esp.h>
1.45      angelos    70: #include <netinet/ip_ipip.h>
1.52      angelos    71: #include <netinet/ip_ipcomp.h>
1.34      angelos    72: #include <netinet/ip_ether.h>
1.1       deraadt    73:
                     74: #include <arpa/inet.h>
1.18      millert    75: #include <limits.h>
1.1       deraadt    76: #include <netdb.h>
                     77: #include <stdio.h>
                     78: #include <string.h>
                     79: #include <unistd.h>
1.14      dgregor    80: #include <stdlib.h>
1.1       deraadt    81: #include "netstat.h"
                     82:
1.5       deraadt    83: #include <rpc/rpc.h>
                     84: #include <rpc/pmap_prot.h>
                     85: #include <rpc/pmap_clnt.h>
                     86:
1.1       deraadt    87: struct inpcb inpcb;
                     88: struct tcpcb tcpcb;
                     89: struct socket sockb;
                     90:
1.56      millert    91: static void protopr0(u_long, char *, int);
1.48      itojun     92:
1.56      millert    93: char   *inetname(struct in_addr *);
1.63      deraadt    94: void   inetprint(struct in_addr *, in_port_t, char *, int);
1.38      itojun     95: #ifdef INET6
1.56      millert    96: char   *inet6name(struct in6_addr *);
                     97: void   inet6print(struct in6_addr *, int, char *, int);
1.38      itojun     98: #endif
1.1       deraadt    99:
                    100: /*
                    101:  * Print a summary of connections related to an Internet
                    102:  * protocol.  For TCP, also give state of connection.
                    103:  * Listening processes (aflag) are suppressed unless the
                    104:  * -a (all) flag is specified.
                    105:  */
                    106: void
1.63      deraadt   107: protopr(u_long off, char *name)
1.1       deraadt   108: {
1.48      itojun    109:        protopr0(off, name, AF_INET);
                    110: }
                    111:
                    112: #ifdef INET6
                    113: void
1.63      deraadt   114: ip6protopr(u_long off, char *name)
1.48      itojun    115: {
                    116:        protopr0(off, name, AF_INET6);
                    117: }
                    118: #endif
                    119:
                    120: static void
1.63      deraadt   121: protopr0(u_long off, char *name, int af)
1.48      itojun    122: {
1.1       deraadt   123:        struct inpcbtable table;
1.54      mpech     124:        struct inpcb *head, *next, *prev;
1.1       deraadt   125:        struct inpcb inpcb;
                    126:        int istcp;
1.54      mpech     127:        int first = 1;
1.38      itojun    128:        char *name0;
                    129:        char namebuf[20];
1.1       deraadt   130:
1.38      itojun    131:        name0 = name;
1.1       deraadt   132:        if (off == 0)
                    133:                return;
                    134:        istcp = strcmp(name, "tcp") == 0;
                    135:        kread(off, (char *)&table, sizeof table);
                    136:        prev = head =
                    137:            (struct inpcb *)&((struct inpcbtable *)off)->inpt_queue.cqh_first;
                    138:        next = table.inpt_queue.cqh_first;
                    139:
                    140:        while (next != head) {
                    141:                kread((u_long)next, (char *)&inpcb, sizeof inpcb);
                    142:                if (inpcb.inp_queue.cqe_prev != prev) {
                    143:                        printf("???\n");
                    144:                        break;
                    145:                }
                    146:                prev = next;
                    147:                next = inpcb.inp_queue.cqe_next;
1.48      itojun    148:
                    149:                switch (af) {
                    150:                case AF_INET:
                    151:                        if ((inpcb.inp_flags & INP_IPV6) != 0)
                    152:                                continue;
                    153:                        break;
                    154:                case AF_INET6:
                    155:                        if ((inpcb.inp_flags & INP_IPV6) == 0)
                    156:                                continue;
                    157:                        break;
                    158:                default:
                    159:                        break;
                    160:                }
1.1       deraadt   161:
                    162:                if (!aflag &&
                    163:                    inet_lnaof(inpcb.inp_laddr) == INADDR_ANY)
                    164:                        continue;
                    165:                kread((u_long)inpcb.inp_socket, (char *)&sockb, sizeof (sockb));
                    166:                if (istcp) {
                    167:                        kread((u_long)inpcb.inp_ppcb,
                    168:                            (char *)&tcpcb, sizeof (tcpcb));
                    169:                }
                    170:                if (first) {
                    171:                        printf("Active Internet connections");
                    172:                        if (aflag)
                    173:                                printf(" (including servers)");
                    174:                        putchar('\n');
                    175:                        if (Aflag)
1.29      deraadt   176:                                printf("%-*.*s %-5.5s %-6.6s %-6.6s  %-18.18s %-18.18s %s\n",
1.18      millert   177:                                    PLEN, PLEN, "PCB", "Proto", "Recv-Q",
1.29      deraadt   178:                                    "Send-Q", "Local Address",
                    179:                                    "Foreign Address", "(state)");
1.18      millert   180:                        else
                    181:                                printf("%-5.5s %-6.6s %-6.6s  %-22.22s %-22.22s %s\n",
                    182:                                    "Proto", "Recv-Q", "Send-Q",
                    183:                                    "Local Address", "Foreign Address",
                    184:                                    "(state)");
1.1       deraadt   185:                        first = 0;
                    186:                }
1.38      itojun    187:                if (Aflag) {
1.1       deraadt   188:                        if (istcp)
1.18      millert   189:                                printf("%*p ", PLEN, inpcb.inp_ppcb);
1.1       deraadt   190:                        else
1.18      millert   191:                                printf("%*p ", PLEN, prev);
1.38      itojun    192:                }
                    193: #ifdef INET6
                    194:                if (inpcb.inp_flags & INP_IPV6) {
1.60      deraadt   195:                        strlcpy(namebuf, name0, sizeof namebuf);
                    196:                        strlcat(namebuf, "6", sizeof namebuf);
1.38      itojun    197:                        name = namebuf;
                    198:                } else
                    199:                        name = name0;
                    200: #endif
1.16      millert   201:                printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc,
1.63      deraadt   202:                    sockb.so_snd.sb_cc);
1.38      itojun    203: #ifdef INET6
                    204:                if (inpcb.inp_flags & INP_IPV6) {
                    205:                        inet6print(&inpcb.inp_laddr6, (int)inpcb.inp_lport,
1.63      deraadt   206:                            name, 1);
1.38      itojun    207:                        inet6print(&inpcb.inp_faddr6, (int)inpcb.inp_fport,
1.63      deraadt   208:                            name, 0);
1.38      itojun    209:                } else
                    210: #endif
                    211:                {
                    212:                        inetprint(&inpcb.inp_laddr, (int)inpcb.inp_lport,
1.63      deraadt   213:                            name, 1);
1.38      itojun    214:                        inetprint(&inpcb.inp_faddr, (int)inpcb.inp_fport,
1.63      deraadt   215:                            name, 0);
1.38      itojun    216:                }
1.1       deraadt   217:                if (istcp) {
                    218:                        if (tcpcb.t_state < 0 || tcpcb.t_state >= TCP_NSTATES)
                    219:                                printf(" %d", tcpcb.t_state);
                    220:                        else
                    221:                                printf(" %s", tcpstates[tcpcb.t_state]);
                    222:                }
                    223:                putchar('\n');
                    224:        }
                    225: }
                    226:
                    227: /*
                    228:  * Dump TCP statistics structure.
                    229:  */
                    230: void
1.63      deraadt   231: tcp_stats(u_long off, char *name)
1.1       deraadt   232: {
                    233:        struct tcpstat tcpstat;
                    234:
                    235:        if (off == 0)
                    236:                return;
1.63      deraadt   237:        printf("%s:\n", name);
1.1       deraadt   238:        kread(off, (char *)&tcpstat, sizeof (tcpstat));
                    239:
                    240: #define        p(f, m) if (tcpstat.f || sflag <= 1) \
1.60      deraadt   241:        printf(m, tcpstat.f, plural(tcpstat.f))
1.38      itojun    242: #define        p1(f, m) if (tcpstat.f || sflag <= 1) \
1.60      deraadt   243:        printf(m, tcpstat.f)
1.1       deraadt   244: #define        p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \
1.60      deraadt   245:        printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2, plural(tcpstat.f2))
1.38      itojun    246: #define        p2a(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \
1.60      deraadt   247:        printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2)
1.1       deraadt   248: #define        p3(f, m) if (tcpstat.f || sflag <= 1) \
1.60      deraadt   249:        printf(m, tcpstat.f, plurales(tcpstat.f))
1.1       deraadt   250:
1.38      itojun    251:        p(tcps_sndtotal, "\t%u packet%s sent\n");
1.1       deraadt   252:        p2(tcps_sndpack,tcps_sndbyte,
1.60      deraadt   253:            "\t\t%u data packet%s (%qd byte%s)\n");
1.1       deraadt   254:        p2(tcps_sndrexmitpack, tcps_sndrexmitbyte,
1.60      deraadt   255:            "\t\t%u data packet%s (%qd byte%s) retransmitted\n");
1.26      provos    256:        p(tcps_sndrexmitfast, "\t\t%qd fast retransmitted packet%s\n");
1.38      itojun    257:        p2a(tcps_sndacks, tcps_delack,
1.60      deraadt   258:            "\t\t%u ack-only packet%s (%u delayed)\n");
1.38      itojun    259:        p(tcps_sndurg, "\t\t%u URG only packet%s\n");
                    260:        p(tcps_sndprobe, "\t\t%u window probe packet%s\n");
                    261:        p(tcps_sndwinup, "\t\t%u window update packet%s\n");
                    262:        p(tcps_sndctrl, "\t\t%u control packet%s\n");
1.50      angelos   263:        p(tcps_outhwcsum, "\t\t%u packet%s hardware-checksummed\n");
1.38      itojun    264:        p(tcps_rcvtotal, "\t%u packet%s received\n");
                    265:        p2(tcps_rcvackpack, tcps_rcvackbyte, "\t\t%u ack%s (for %qd byte%s)\n");
                    266:        p(tcps_rcvdupack, "\t\t%u duplicate ack%s\n");
                    267:        p(tcps_rcvacktoomuch, "\t\t%u ack%s for unsent data\n");
1.1       deraadt   268:        p2(tcps_rcvpack, tcps_rcvbyte,
1.60      deraadt   269:            "\t\t%u packet%s (%qu byte%s) received in-sequence\n");
1.1       deraadt   270:        p2(tcps_rcvduppack, tcps_rcvdupbyte,
1.60      deraadt   271:            "\t\t%u completely duplicate packet%s (%qd byte%s)\n");
1.38      itojun    272:        p(tcps_pawsdrop, "\t\t%u old duplicate packet%s\n");
1.1       deraadt   273:        p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte,
1.62      jsyn      274:            "\t\t%u packet%s with some duplicate data (%qd byte%s duplicated)\n");
1.1       deraadt   275:        p2(tcps_rcvoopack, tcps_rcvoobyte,
1.60      deraadt   276:            "\t\t%u out-of-order packet%s (%qd byte%s)\n");
1.1       deraadt   277:        p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin,
1.60      deraadt   278:            "\t\t%u packet%s (%qd byte%s) of data after window\n");
1.38      itojun    279:        p(tcps_rcvwinprobe, "\t\t%u window probe%s\n");
                    280:        p(tcps_rcvwinupd, "\t\t%u window update packet%s\n");
                    281:        p(tcps_rcvafterclose, "\t\t%u packet%s received after close\n");
                    282:        p(tcps_rcvbadsum, "\t\t%u discarded for bad checksum%s\n");
                    283:        p(tcps_rcvbadoff, "\t\t%u discarded for bad header offset field%s\n");
                    284:        p1(tcps_rcvshort, "\t\t%u discarded because packet too short\n");
1.58      miod      285:        p1(tcps_rcvnosec, "\t\t%u discarded for missing IPsec protection\n");
1.50      angelos   286:        p(tcps_inhwcsum, "\t\t%u packet%s hardware-checksummed\n");
1.38      itojun    287:        p(tcps_connattempt, "\t%u connection request%s\n");
                    288:        p(tcps_accepts, "\t%u connection accept%s\n");
                    289:        p(tcps_connects, "\t%u connection%s established (including accepts)\n");
1.1       deraadt   290:        p2(tcps_closed, tcps_drops,
1.60      deraadt   291:            "\t%u connection%s closed (including %u drop%s)\n");
1.38      itojun    292:        p(tcps_conndrops, "\t%u embryonic connection%s dropped\n");
1.1       deraadt   293:        p2(tcps_rttupdated, tcps_segstimed,
1.60      deraadt   294:            "\t%u segment%s updated rtt (of %u attempt%s)\n");
1.38      itojun    295:        p(tcps_rexmttimeo, "\t%u retransmit timeout%s\n");
                    296:        p(tcps_timeoutdrop, "\t\t%u connection%s dropped by rexmit timeout\n");
                    297:        p(tcps_persisttimeo, "\t%u persist timeout%s\n");
                    298:        p(tcps_keeptimeo, "\t%u keepalive timeout%s\n");
                    299:        p(tcps_keepprobe, "\t\t%u keepalive probe%s sent\n");
                    300:        p(tcps_keepdrops, "\t\t%u connection%s dropped by keepalive\n");
                    301:        p(tcps_predack, "\t%u correct ACK header prediction%s\n");
                    302:        p(tcps_preddat, "\t%u correct data packet header prediction%s\n");
                    303:        p3(tcps_pcbhashmiss, "\t%u PCB cache miss%s\n");
                    304:        p(tcps_badsyn, "\t%u SYN packet%s received with same src/dst address/port\n");
1.59      kjc       305:
                    306:        p(tcps_ecn_accepts, "\t%u ECN connection%s accepted\n");
                    307:        p(tcps_ecn_rcvece, "\t\t%u ECE packet%s received\n");
                    308:        p(tcps_ecn_rcvcwr, "\t\t%u CWR packet%s received\n");
                    309:        p(tcps_ecn_rcvce, "\t\t%u CE packet%s received\n");
                    310:        p(tcps_ecn_sndect, "\t\t%u ECT packet%s sent\n");
                    311:        p(tcps_ecn_sndece, "\t\t%u ECE packet%s sent\n");
                    312:        p(tcps_ecn_sndcwr, "\t\t%u CWR packet%s sent\n");
                    313:        p1(tcps_cwr_frecovery, "\t\t\tcwr by fastrecovery: %u\n");
                    314:        p1(tcps_cwr_timeout, "\t\t\tcwr by timeout: %u\n");
                    315:        p1(tcps_cwr_ecn, "\t\t\tcwr by ecn: %u\n");
                    316:
1.1       deraadt   317: #undef p
1.38      itojun    318: #undef p1
1.1       deraadt   319: #undef p2
1.38      itojun    320: #undef p2a
1.1       deraadt   321: #undef p3
                    322: }
                    323:
                    324: /*
                    325:  * Dump UDP statistics structure.
                    326:  */
                    327: void
1.63      deraadt   328: udp_stats(u_long off, char *name)
1.1       deraadt   329: {
                    330:        struct udpstat udpstat;
                    331:        u_long delivered;
                    332:
                    333:        if (off == 0)
                    334:                return;
                    335:        kread(off, (char *)&udpstat, sizeof (udpstat));
                    336:        printf("%s:\n", name);
                    337: #define        p(f, m) if (udpstat.f || sflag <= 1) \
1.60      deraadt   338:        printf(m, udpstat.f, plural(udpstat.f))
1.38      itojun    339: #define        p1(f, m) if (udpstat.f || sflag <= 1) \
1.60      deraadt   340:        printf(m, udpstat.f)
                    341:
1.16      millert   342:        p(udps_ipackets, "\t%lu datagram%s received\n");
1.38      itojun    343:        p1(udps_hdrops, "\t%lu with incomplete header\n");
                    344:        p1(udps_badlen, "\t%lu with bad data length field\n");
                    345:        p1(udps_badsum, "\t%lu with bad checksum\n");
                    346:        p1(udps_nosum, "\t%lu with no checksum\n");
1.50      angelos   347:        p(udps_inhwcsum, "\t%lu input packet%s hardware-checksummed\n");
                    348:        p(udps_outhwcsum, "\t%lu output packet%s hardware-checksummed\n");
1.38      itojun    349:        p1(udps_noport, "\t%lu dropped due to no socket\n");
1.16      millert   350:        p(udps_noportbcast, "\t%lu broadcast/multicast datagram%s dropped due to no socket\n");
1.58      miod      351:        p1(udps_nosec, "\t%lu dropped due to missing IPsec protection\n");
1.38      itojun    352:        p1(udps_fullsock, "\t%lu dropped due to full socket buffers\n");
1.60      deraadt   353:        delivered = udpstat.udps_ipackets - udpstat.udps_hdrops -
                    354:            udpstat.udps_badlen - udpstat.udps_badsum -
                    355:            udpstat.udps_noport - udpstat.udps_noportbcast -
                    356:            udpstat.udps_fullsock;
1.1       deraadt   357:        if (delivered || sflag <= 1)
1.16      millert   358:                printf("\t%lu delivered\n", delivered);
                    359:        p(udps_opackets, "\t%lu datagram%s output\n");
1.38      itojun    360:        p1(udps_pcbhashmiss, "\t%lu missed PCB cache\n");
1.1       deraadt   361: #undef p
1.38      itojun    362: #undef p1
1.1       deraadt   363: }
                    364:
                    365: /*
                    366:  * Dump IP statistics structure.
                    367:  */
                    368: void
1.63      deraadt   369: ip_stats(u_long off, char *name)
1.1       deraadt   370: {
                    371:        struct ipstat ipstat;
                    372:
                    373:        if (off == 0)
                    374:                return;
                    375:        kread(off, (char *)&ipstat, sizeof (ipstat));
                    376:        printf("%s:\n", name);
                    377:
                    378: #define        p(f, m) if (ipstat.f || sflag <= 1) \
1.60      deraadt   379:        printf(m, ipstat.f, plural(ipstat.f))
1.38      itojun    380: #define        p1(f, m) if (ipstat.f || sflag <= 1) \
1.60      deraadt   381:        printf(m, ipstat.f)
1.1       deraadt   382:
1.16      millert   383:        p(ips_total, "\t%lu total packet%s received\n");
                    384:        p(ips_badsum, "\t%lu bad header checksum%s\n");
1.38      itojun    385:        p1(ips_toosmall, "\t%lu with size smaller than minimum\n");
                    386:        p1(ips_tooshort, "\t%lu with data size < data length\n");
                    387:        p1(ips_badhlen, "\t%lu with header length < data size\n");
                    388:        p1(ips_badlen, "\t%lu with data length < header length\n");
                    389:        p1(ips_badoptions, "\t%lu with bad options\n");
                    390:        p1(ips_badvers, "\t%lu with incorrect version number\n");
1.16      millert   391:        p(ips_fragments, "\t%lu fragment%s received\n");
1.62      jsyn      392:        p(ips_fragdropped, "\t%lu fragment%s dropped (duplicates or out of space)\n");
1.16      millert   393:        p(ips_badfrags, "\t%lu malformed fragment%s dropped\n");
                    394:        p(ips_fragtimeout, "\t%lu fragment%s dropped after timeout\n");
                    395:        p(ips_reassembled, "\t%lu packet%s reassembled ok\n");
                    396:        p(ips_delivered, "\t%lu packet%s for this host\n");
                    397:        p(ips_noproto, "\t%lu packet%s for unknown/unsupported protocol\n");
                    398:        p(ips_forward, "\t%lu packet%s forwarded\n");
                    399:        p(ips_cantforward, "\t%lu packet%s not forwardable\n");
                    400:        p(ips_redirectsent, "\t%lu redirect%s sent\n");
                    401:        p(ips_localout, "\t%lu packet%s sent from this host\n");
                    402:        p(ips_rawout, "\t%lu packet%s sent with fabricated ip header\n");
                    403:        p(ips_odropped, "\t%lu output packet%s dropped due to no bufs, etc.\n");
                    404:        p(ips_noroute, "\t%lu output packet%s discarded due to no route\n");
                    405:        p(ips_fragmented, "\t%lu output datagram%s fragmented\n");
                    406:        p(ips_ofragments, "\t%lu fragment%s created\n");
                    407:        p(ips_cantfrag, "\t%lu datagram%s that can't be fragmented\n");
1.38      itojun    408:        p1(ips_rcvmemdrop, "\t%lu fragment floods\n");
1.42      itojun    409:        p(ips_toolong, "\t%lu packet%s with ip length > max ip packet size\n");
                    410:        p(ips_nogif, "\t%lu tunneling packet%s that can't find gif\n");
1.49      itojun    411:        p(ips_badaddr, "\t%lu datagram%s with bad address in header\n");
1.50      angelos   412:        p(ips_inhwcsum, "\t%lu input datagram%s checksum-processed by hardware\n");
                    413:        p(ips_outhwcsum, "\t%lu output datagram%s checksum-processed by hardware\n");
1.1       deraadt   414: #undef p
1.38      itojun    415: #undef p1
1.1       deraadt   416: }
                    417:
1.68    ! tedu      418: static char *icmpnames[ICMP_MAXTYPE + 1] = {
1.1       deraadt   419:        "echo reply",
                    420:        "#1",
                    421:        "#2",
                    422:        "destination unreachable",
                    423:        "source quench",
                    424:        "routing redirect",
                    425:        "#6",
                    426:        "#7",
                    427:        "echo",
1.9       deraadt   428:        "router advertisement",
                    429:        "router solicitation",
1.1       deraadt   430:        "time exceeded",
                    431:        "parameter problem",
                    432:        "time stamp",
                    433:        "time stamp reply",
                    434:        "information request",
                    435:        "information request reply",
                    436:        "address mask request",
                    437:        "address mask reply",
1.68    ! tedu      438:        "#19",
        !           439:        "#20",
        !           440:        "#21",
        !           441:        "#22",
        !           442:        "#23",
        !           443:        "#24",
        !           444:        "#25",
        !           445:        "#26",
        !           446:        "#27",
        !           447:        "#28",
        !           448:        "#29",
        !           449:        "traceroute",
        !           450:        "data conversion error",
        !           451:        "mobile host redirect",
        !           452:        "IPv6 where-are-you",
        !           453:        "IPv6 i-am-here",
        !           454:        "mobile registration request",
        !           455:        "mobile registration reply",
        !           456:        "#37",
        !           457:        "#38",
        !           458:        "SKIP",
        !           459:        "Photuris",
1.1       deraadt   460: };
                    461:
                    462: /*
                    463:  * Dump ICMP statistics.
                    464:  */
                    465: void
1.63      deraadt   466: icmp_stats(u_long off, char *name)
1.1       deraadt   467: {
                    468:        struct icmpstat icmpstat;
1.54      mpech     469:        int i, first;
1.1       deraadt   470:
                    471:        if (off == 0)
                    472:                return;
                    473:        kread(off, (char *)&icmpstat, sizeof (icmpstat));
                    474:        printf("%s:\n", name);
                    475:
                    476: #define        p(f, m) if (icmpstat.f || sflag <= 1) \
1.60      deraadt   477:        printf(m, icmpstat.f, plural(icmpstat.f))
1.1       deraadt   478:
1.16      millert   479:        p(icps_error, "\t%lu call%s to icmp_error\n");
1.1       deraadt   480:        p(icps_oldicmp,
1.61      aaron     481:            "\t%lu error%s not generated because old message was icmp\n");
1.1       deraadt   482:        for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++)
                    483:                if (icmpstat.icps_outhist[i] != 0) {
                    484:                        if (first) {
1.43      itojun    485:                                printf("\tOutput packet histogram:\n");
1.1       deraadt   486:                                first = 0;
                    487:                        }
1.68    ! tedu      488:                        if (icmpnames[i])
        !           489:                                printf("\t\t%s:", icmpnames[i]);
        !           490:                        else
        !           491:                                printf("\t\t#%d:", i);
        !           492:                        printf(" %lu\n", icmpstat.icps_outhist[i]);
1.1       deraadt   493:                }
1.16      millert   494:        p(icps_badcode, "\t%lu message%s with bad code fields\n");
                    495:        p(icps_tooshort, "\t%lu message%s < minimum length\n");
                    496:        p(icps_checksum, "\t%lu bad checksum%s\n");
                    497:        p(icps_badlen, "\t%lu message%s with bad length\n");
1.1       deraadt   498:        for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++)
                    499:                if (icmpstat.icps_inhist[i] != 0) {
                    500:                        if (first) {
1.43      itojun    501:                                printf("\tInput packet histogram:\n");
1.1       deraadt   502:                                first = 0;
                    503:                        }
1.68    ! tedu      504:                        if (icmpnames[i])
        !           505:                                printf("\t\t%s:", icmpnames[i]);
        !           506:                        else
        !           507:                                printf("\t\t#%d:", i);
        !           508:                        printf(" %lu\n", icmpstat.icps_inhist[i]);
1.1       deraadt   509:                }
1.16      millert   510:        p(icps_reflect, "\t%lu message response%s generated\n");
1.1       deraadt   511: #undef p
                    512: }
                    513:
                    514: /*
                    515:  * Dump IGMP statistics structure.
                    516:  */
                    517: void
1.63      deraadt   518: igmp_stats(u_long off, char *name)
1.1       deraadt   519: {
                    520:        struct igmpstat igmpstat;
                    521:
                    522:        if (off == 0)
                    523:                return;
                    524:        kread(off, (char *)&igmpstat, sizeof (igmpstat));
                    525:        printf("%s:\n", name);
                    526:
                    527: #define        p(f, m) if (igmpstat.f || sflag <= 1) \
1.60      deraadt   528:        printf(m, igmpstat.f, plural(igmpstat.f))
1.1       deraadt   529: #define        py(f, m) if (igmpstat.f || sflag <= 1) \
1.60      deraadt   530:        printf(m, igmpstat.f, igmpstat.f != 1 ? "ies" : "y")
                    531:
1.16      millert   532:        p(igps_rcv_total, "\t%lu message%s received\n");
1.55      mickey    533:        p(igps_rcv_tooshort, "\t%lu message%s received with too few bytes\n");
                    534:        p(igps_rcv_badsum, "\t%lu message%s received with bad checksum\n");
                    535:        py(igps_rcv_queries, "\t%lu membership quer%s received\n");
                    536:        py(igps_rcv_badqueries, "\t%lu membership quer%s received with invalid field(s)\n");
                    537:        p(igps_rcv_reports, "\t%lu membership report%s received\n");
                    538:        p(igps_rcv_badreports, "\t%lu membership report%s received with invalid field(s)\n");
                    539:        p(igps_rcv_ourreports, "\t%lu membership report%s received for groups to which we belong\n");
                    540:        p(igps_snd_reports, "\t%lu membership report%s sent\n");
1.1       deraadt   541: #undef p
                    542: #undef py
                    543: }
                    544:
1.5       deraadt   545: struct rpcnams {
                    546:        struct rpcnams *next;
1.16      millert   547:        in_port_t port;
1.21      deraadt   548:        int       proto;
1.5       deraadt   549:        char    *rpcname;
                    550: };
                    551:
1.66      deraadt   552: static char *
1.63      deraadt   553: getrpcportnam(in_port_t port, int proto)
1.5       deraadt   554: {
                    555:        struct sockaddr_in server_addr;
1.54      mpech     556:        struct hostent *hp;
1.5       deraadt   557:        static struct pmaplist *head;
                    558:        int socket = RPC_ANYSOCK;
                    559:        struct timeval minutetimeout;
1.54      mpech     560:        CLIENT *client;
1.5       deraadt   561:        struct rpcent *rpc;
                    562:        static int first;
                    563:        static struct rpcnams *rpcn;
                    564:        struct rpcnams *n;
1.23      deraadt   565:        char num[20];
1.55      mickey    566:
1.5       deraadt   567:        if (first == 0) {
                    568:                first = 1;
1.7       deraadt   569:                memset((char *)&server_addr, 0, sizeof server_addr);
1.5       deraadt   570:                server_addr.sin_family = AF_INET;
                    571:                if ((hp = gethostbyname("localhost")) != NULL)
1.7       deraadt   572:                        memmove((caddr_t)&server_addr.sin_addr, hp->h_addr,
1.5       deraadt   573:                            hp->h_length);
                    574:                else
                    575:                        (void) inet_aton("0.0.0.0", &server_addr.sin_addr);
                    576:
                    577:                minutetimeout.tv_sec = 60;
                    578:                minutetimeout.tv_usec = 0;
                    579:                server_addr.sin_port = htons(PMAPPORT);
                    580:                if ((client = clnttcp_create(&server_addr, PMAPPROG,
1.7       deraadt   581:                    PMAPVERS, &socket, 50, 500)) == NULL)
                    582:                        return (NULL);
1.5       deraadt   583:                if (clnt_call(client, PMAPPROC_DUMP, xdr_void, NULL,
1.8       deraadt   584:                    xdr_pmaplist, &head, minutetimeout) != RPC_SUCCESS) {
1.7       deraadt   585:                        clnt_destroy(client);
                    586:                        return (NULL);
1.5       deraadt   587:                }
                    588:                for (; head != NULL; head = head->pml_next) {
                    589:                        n = (struct rpcnams *)malloc(sizeof(struct rpcnams));
                    590:                        if (n == NULL)
                    591:                                continue;
                    592:                        n->next = rpcn;
                    593:                        rpcn = n;
                    594:                        n->port = head->pml_map.pm_port;
1.21      deraadt   595:                        n->proto = head->pml_map.pm_prot;
1.5       deraadt   596:
                    597:                        rpc = getrpcbynumber(head->pml_map.pm_prog);
                    598:                        if (rpc)
                    599:                                n->rpcname = strdup(rpc->r_name);
                    600:                        else {
1.23      deraadt   601:                                snprintf(num, sizeof num, "%ld",
                    602:                                    head->pml_map.pm_prog);
1.5       deraadt   603:                                n->rpcname = strdup(num);
                    604:                        }
                    605:                }
                    606:                clnt_destroy(client);
                    607:        }
                    608:
                    609:        for (n = rpcn; n; n = n->next)
1.21      deraadt   610:                if (n->port == port && n->proto == proto)
1.5       deraadt   611:                        return (n->rpcname);
                    612:        return (NULL);
                    613: }
                    614:
1.1       deraadt   615: /*
                    616:  * Pretty print an Internet address (net address + port).
                    617:  * If the nflag was specified, use numbers instead of names.
                    618:  */
                    619: void
1.63      deraadt   620: inetprint(struct in_addr *in, in_port_t port, char *proto, int local)
1.1       deraadt   621: {
                    622:        struct servent *sp = 0;
1.5       deraadt   623:        char line[80], *cp, *nam;
1.1       deraadt   624:        int width;
                    625:
1.23      deraadt   626:        snprintf(line, sizeof line, "%.*s.", (Aflag && !nflag) ? 12 : 16,
                    627:            inetname(in));
1.4       millert   628:        cp = strchr(line, '\0');
1.1       deraadt   629:        if (!nflag && port)
                    630:                sp = getservbyport((int)port, proto);
                    631:        if (sp || port == 0)
1.23      deraadt   632:                snprintf(cp, line + sizeof line - cp, "%.8s",
                    633:                    sp ? sp->s_name : "*");
1.21      deraadt   634:        else if (local && !nflag && (nam = getrpcportnam(ntohs(port),
                    635:            (strcmp(proto, "tcp") == 0 ? IPPROTO_TCP : IPPROTO_UDP))))
1.23      deraadt   636:                snprintf(cp, line + sizeof line - cp, "%d[%.8s]",
                    637:                    ntohs(port), nam);
1.1       deraadt   638:        else
1.23      deraadt   639:                snprintf(cp, line + sizeof line - cp, "%d", ntohs(port));
1.1       deraadt   640:        width = Aflag ? 18 : 22;
                    641:        printf(" %-*.*s", width, width, line);
                    642: }
                    643:
                    644: /*
                    645:  * Construct an Internet address representation.
                    646:  * If the nflag has been supplied, give
                    647:  * numeric value, otherwise try for symbolic name.
                    648:  */
                    649: char *
1.63      deraadt   650: inetname(struct in_addr *inp)
1.1       deraadt   651: {
1.54      mpech     652:        char *cp;
1.1       deraadt   653:        static char line[50];
                    654:        struct hostent *hp;
                    655:        struct netent *np;
1.57      mpech     656:        static char domain[MAXHOSTNAMELEN];
1.1       deraadt   657:        static int first = 1;
                    658:
                    659:        if (first && !nflag) {
                    660:                first = 0;
1.57      mpech     661:                if (gethostname(domain, sizeof(domain)) == 0 &&
1.4       millert   662:                    (cp = strchr(domain, '.')))
1.60      deraadt   663:                        (void) strlcpy(domain, cp + 1, sizeof domain);
1.1       deraadt   664:                else
1.60      deraadt   665:                        domain[0] = '\0';
1.1       deraadt   666:        }
                    667:        cp = 0;
                    668:        if (!nflag && inp->s_addr != INADDR_ANY) {
                    669:                int net = inet_netof(*inp);
                    670:                int lna = inet_lnaof(*inp);
                    671:
                    672:                if (lna == INADDR_ANY) {
                    673:                        np = getnetbyaddr(net, AF_INET);
                    674:                        if (np)
                    675:                                cp = np->n_name;
                    676:                }
                    677:                if (cp == 0) {
                    678:                        hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET);
                    679:                        if (hp) {
1.4       millert   680:                                if ((cp = strchr(hp->h_name, '.')) &&
1.1       deraadt   681:                                    !strcmp(cp + 1, domain))
                    682:                                        *cp = 0;
                    683:                                cp = hp->h_name;
                    684:                        }
                    685:                }
                    686:        }
                    687:        if (inp->s_addr == INADDR_ANY)
1.23      deraadt   688:                snprintf(line, sizeof line, "*");
1.1       deraadt   689:        else if (cp)
1.23      deraadt   690:                snprintf(line, sizeof line, "%s", cp);
1.1       deraadt   691:        else {
                    692:                inp->s_addr = ntohl(inp->s_addr);
                    693: #define C(x)   ((x) & 0xff)
1.23      deraadt   694:                snprintf(line, sizeof line, "%u.%u.%u.%u",
                    695:                    C(inp->s_addr >> 24), C(inp->s_addr >> 16),
                    696:                    C(inp->s_addr >> 8), C(inp->s_addr));
1.1       deraadt   697:        }
                    698:        return (line);
1.10      angelos   699: }
                    700:
                    701: /*
                    702:  * Dump AH statistics structure.
                    703:  */
                    704: void
1.63      deraadt   705: ah_stats(u_long off, char *name)
1.10      angelos   706: {
1.55      mickey    707:        struct ahstat ahstat;
1.10      angelos   708:
1.55      mickey    709:        if (off == 0)
                    710:                return;
                    711:        kread(off, (char *)&ahstat, sizeof (ahstat));
                    712:        printf("%s:\n", name);
1.10      angelos   713:
                    714: #define p(f, m) if (ahstat.f || sflag <= 1) \
1.60      deraadt   715:        printf(m, ahstat.f, plural(ahstat.f))
1.38      itojun    716: #define p1(f, m) if (ahstat.f || sflag <= 1) \
1.60      deraadt   717:        printf(m, ahstat.f)
1.10      angelos   718:
1.38      itojun    719:        p1(ahs_input, "\t%u input AH packets\n");
                    720:        p1(ahs_output, "\t%u output AH packets\n");
1.55      mickey    721:        p(ahs_nopf, "\t%u packet%s from unsupported protocol families\n");
                    722:        p(ahs_hdrops, "\t%u packet%s shorter than header shows\n");
                    723:        p(ahs_pdrops, "\t%u packet%s dropped due to policy\n");
                    724:        p(ahs_notdb, "\t%u packet%s for which no TDB was found\n");
                    725:        p(ahs_badkcr, "\t%u input packet%s that failed to be processed\n");
                    726:        p(ahs_badauth, "\t%u packet%s that failed verification received\n");
                    727:        p(ahs_noxform, "\t%u packet%s for which no XFORM was set in TDB received\n");
                    728:        p(ahs_qfull, "\t%u packet%s were dropped due to full output queue\n");
                    729:        p(ahs_wrap, "\t%u packet%s where counter wrapping was detected\n");
                    730:        p(ahs_replay, "\t%u possibly replayed packet%s received\n");
                    731:        p(ahs_badauthl, "\t%u packet%s with bad authenticator length received\n");
1.62      jsyn      732:        p(ahs_invalid, "\t%u packet%s attempted to use an invalid TDB\n");
1.25      niklas    733:        p(ahs_toobig, "\t%u packet%s got larger than max IP packet size\n");
1.46      angelos   734:        p(ahs_crypto, "\t%u packet%s that failed crypto processing\n");
1.20      angelos   735:        p(ahs_ibytes, "\t%qu input byte%s\n");
                    736:        p(ahs_obytes, "\t%qu output byte%s\n");
                    737:
1.34      angelos   738: #undef p
1.38      itojun    739: #undef p1
1.34      angelos   740: }
                    741:
                    742: /*
                    743:  * Dump etherip statistics structure.
                    744:  */
                    745: void
1.63      deraadt   746: etherip_stats(u_long off, char *name)
1.34      angelos   747: {
1.55      mickey    748:        struct etheripstat etheripstat;
1.34      angelos   749:
1.55      mickey    750:        if (off == 0)
                    751:                return;
                    752:        kread(off, (char *)&etheripstat, sizeof (etheripstat));
                    753:        printf("%s:\n", name);
1.34      angelos   754:
                    755: #define p(f, m) if (etheripstat.f || sflag <= 1) \
1.60      deraadt   756:        printf(m, etheripstat.f, plural(etheripstat.f))
1.34      angelos   757:
1.53      brian     758:        p(etherip_hdrops, "\t%u packet%s shorter than header shows\n");
                    759:        p(etherip_qfull, "\t%u packet%s were dropped due to full output queue\n");
1.34      angelos   760:        p(etherip_noifdrops, "\t%u packet%s were dropped because of no interface/bridge information\n");
1.53      brian     761:        p(etherip_pdrops, "\t%u packet%s dropped due to policy\n");
                    762:        p(etherip_adrops, "\t%u packet%s dropped for other reasons\n");
                    763:        p(etherip_ipackets, "\t%u input ethernet-in-IP packet%s\n");
                    764:        p(etherip_opackets, "\t%u output ethernet-in-IP packet%s\n");
1.34      angelos   765:        p(etherip_ibytes, "\t%qu input byte%s\n");
                    766:        p(etherip_obytes, "\t%qu output byte%s\n");
1.10      angelos   767: #undef p
                    768: }
                    769:
                    770: /*
                    771:  * Dump ESP statistics structure.
                    772:  */
                    773: void
1.63      deraadt   774: esp_stats(u_long off, char *name)
1.10      angelos   775: {
1.55      mickey    776:        struct espstat espstat;
1.10      angelos   777:
1.55      mickey    778:        if (off == 0)
                    779:                return;
                    780:        kread(off, (char *)&espstat, sizeof (espstat));
                    781:        printf("%s:\n", name);
1.10      angelos   782:
                    783: #define p(f, m) if (espstat.f || sflag <= 1) \
1.60      deraadt   784:        printf(m, espstat.f, plural(espstat.f))
1.10      angelos   785:
1.38      itojun    786:        p(esps_input, "\t%u input ESP packet%s\n");
                    787:        p(esps_output, "\t%u output ESP packet%s\n");
1.55      mickey    788:        p(esps_nopf, "\t%u packet%s from unsupported protocol families\n");
                    789:        p(esps_hdrops, "\t%u packet%s shorter than header shows\n");
                    790:        p(esps_pdrops, "\t%u packet%s dropped due to policy\n");
                    791:        p(esps_notdb, "\t%u packet%s for which no TDB was found\n");
                    792:        p(esps_badkcr, "\t%u input packet%s that failed to be processed\n");
                    793:        p(esps_badenc, "\t%u packet%s with bad encryption received\n");
                    794:        p(esps_badauth, "\t%u packet%s that failed verification received\n");
                    795:        p(esps_noxform, "\t%u packet%s for which no XFORM was set in TDB received\n");
                    796:        p(esps_qfull, "\t%u packet%s were dropped due to full output queue\n");
                    797:        p(esps_wrap, "\t%u packet%s where counter wrapping was detected\n");
                    798:        p(esps_replay, "\t%u possibly replayed packet%s received\n");
                    799:        p(esps_badilen, "\t%u packet%s with bad payload size or padding received\n");
1.62      jsyn      800:        p(esps_invalid, "\t%u packet%s attempted to use an invalid TDB\n");
1.25      niklas    801:        p(esps_toobig, "\t%u packet%s got larger than max IP packet size\n");
1.46      angelos   802:        p(esps_crypto, "\t%u packet%s that failed crypto processing\n");
1.20      angelos   803:        p(esps_ibytes, "\t%qu input byte%s\n");
                    804:        p(esps_obytes, "\t%qu output byte%s\n");
1.10      angelos   805:
                    806: #undef p
                    807: }
                    808:
                    809: /*
1.67      deraadt   810:  * Dump IP-in-IP statistics structure.
1.10      angelos   811:  */
                    812: void
1.63      deraadt   813: ipip_stats(u_long off, char *name)
1.10      angelos   814: {
1.55      mickey    815:        struct ipipstat ipipstat;
1.10      angelos   816:
1.55      mickey    817:        if (off == 0)
                    818:                return;
                    819:        kread(off, (char *)&ipipstat, sizeof (ipipstat));
                    820:        printf("%s:\n", name);
1.10      angelos   821:
1.45      angelos   822: #define p(f, m) if (ipipstat.f || sflag <= 1) \
1.60      deraadt   823:        printf(m, ipipstat.f, plural(ipipstat.f))
1.10      angelos   824:
1.55      mickey    825:        p(ipips_ipackets, "\t%u total input packet%s\n");
                    826:        p(ipips_opackets, "\t%u total output packet%s\n");
                    827:        p(ipips_hdrops, "\t%u packet%s shorter than header shows\n");
                    828:        p(ipips_pdrops, "\t%u packet%s dropped due to policy\n");
                    829:        p(ipips_spoof, "\t%u packet%s with possibly spoofed local addresses\n");
                    830:        p(ipips_qfull, "\t%u packet%s were dropped due to full output queue\n");
1.45      angelos   831:        p(ipips_ibytes, "\t%qu input byte%s\n");
                    832:        p(ipips_obytes, "\t%qu output byte%s\n");
1.63      deraadt   833:        p(ipips_family, "\t%u protocol family mismatche%s\n");
                    834:        p(ipips_unspec, "\t%u attempt%s to use tunnel with unspecified endpoint(s)\n");
1.51      jjbg      835: #undef p
                    836: }
                    837:
                    838: /*
                    839:  * Dump IPCOMP statistics structure.
                    840:  */
                    841: void
1.63      deraadt   842: ipcomp_stats(u_long off, char *name)
1.51      jjbg      843: {
                    844:        struct ipcompstat ipcompstat;
                    845:
                    846:        if (off == 0)
                    847:                return;
                    848:        kread(off, (char *)&ipcompstat, sizeof (ipcompstat));
                    849:        printf("%s:\n", name);
                    850:
                    851: #define p(f, m) if (ipcompstat.f || sflag <= 1) \
1.60      deraadt   852:        printf(m, ipcompstat.f, plural(ipcompstat.f))
1.51      jjbg      853:
                    854:        p(ipcomps_input, "\t%u input IPCOMP packet%s\n");
                    855:        p(ipcomps_output, "\t%u output IPCOMP packet%s\n");
                    856:        p(ipcomps_nopf, "\t%u packet%s from unsupported protocol families\n");
                    857:        p(ipcomps_hdrops, "\t%u packet%s shorter than header shows\n");
                    858:        p(ipcomps_pdrops, "\t%u packet%s dropped due to policy\n");
                    859:        p(ipcomps_notdb, "\t%u packet%s for which no TDB was found\n");
                    860:        p(ipcomps_badkcr, "\t%u input packet%s that failed to be processed\n");
1.55      mickey    861:        p(ipcomps_noxform, "\t%u packet%s for which no XFORM was set in TDB received\n");
1.51      jjbg      862:        p(ipcomps_qfull, "\t%u packet%s were dropped due to full output queue\n");
                    863:        p(ipcomps_wrap, "\t%u packet%s where counter wrapping was detected\n");
1.62      jsyn      864:        p(ipcomps_invalid, "\t%u packet%s attempted to use an invalid TDB\n");
1.51      jjbg      865:        p(ipcomps_toobig, "\t%u packet%s got larger than max IP packet size\n");
                    866:        p(ipcomps_crypto, "\t%u packet%s that failed (de)compression processing\n");
1.64      jason     867:        p(ipcomps_minlen, "\t%u packet%s less than minimum compression length\n");
1.51      jjbg      868:        p(ipcomps_ibytes, "\t%qu input byte%s\n");
                    869:        p(ipcomps_obytes, "\t%qu output byte%s\n");
                    870:
1.10      angelos   871: #undef p
1.1       deraadt   872: }