4 * Copyright (C) 2012 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 * Added redirect stuff and a variety of bug fixes. (mcn@EnGarde.com)
16 static const char rcsid[] = "@(#)$Id$";
21 printaps(aps, opts, proto)
31 if (kmemcpy((char *)&ap, (long)aps, sizeof(ap)))
33 if (kmemcpy((char *)&apr, (long)ap.aps_apr, sizeof(apr)))
35 PRINTF("\tproxy %s/%d use %d flags %x\n", apr.apr_label,
36 apr.apr_p, apr.apr_ref, apr.apr_flags);
38 PRINTF("\tbytes %"PRIu64" pkts %"PRIu64"",
39 (unsigned long long)ap.aps_bytes,
40 (unsigned long long)ap.aps_pkts);
42 PRINTF("\tbytes %lu pkts %lu", ap.aps_bytes, ap.aps_pkts);
44 PRINTF(" data %s\n", ap.aps_data ? "YES" : "NO");
45 if ((proto == IPPROTO_TCP) && (opts & OPT_VERBOSE)) {
46 PRINTF("\t\tstate[%u,%u], sel[%d,%d]\n",
47 ap.aps_state[0], ap.aps_state[1],
48 ap.aps_sel[0], ap.aps_sel[1]);
49 #if (defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011)) || \
51 PRINTF("\t\tseq: off %hd/%hd min %x/%x\n",
52 ap.aps_seqoff[0], ap.aps_seqoff[1],
53 ap.aps_seqmin[0], ap.aps_seqmin[1]);
54 PRINTF("\t\tack: off %hd/%hd min %x/%x\n",
55 ap.aps_ackoff[0], ap.aps_ackoff[1],
56 ap.aps_ackmin[0], ap.aps_ackmin[1]);
58 PRINTF("\t\tseq: off %hd/%hd min %lx/%lx\n",
59 ap.aps_seqoff[0], ap.aps_seqoff[1],
60 ap.aps_seqmin[0], ap.aps_seqmin[1]);
61 PRINTF("\t\tack: off %hd/%hd min %lx/%lx\n",
62 ap.aps_ackoff[0], ap.aps_ackoff[1],
63 ap.aps_ackmin[0], ap.aps_ackmin[1]);
67 if (!strcmp(apr.apr_label, "raudio") && ap.aps_psiz == sizeof(ra)) {
68 if (kmemcpy((char *)&ra, (long)ap.aps_data, sizeof(ra)))
70 PRINTF("\tReal Audio Proxy:\n");
71 PRINTF("\t\tSeen PNA: %d\tVersion: %d\tEOS: %d\n",
72 ra.rap_seenpna, ra.rap_version, ra.rap_eos);
73 PRINTF("\t\tMode: %#x\tSBF: %#x\n", ra.rap_mode, ra.rap_sbf);
74 PRINTF("\t\tPorts:pl %hu, pr %hu, sr %hu\n",
75 ra.rap_plport, ra.rap_prport, ra.rap_srport);
76 } else if (!strcmp(apr.apr_label, "ftp") &&
77 (ap.aps_psiz == sizeof(ftp))) {
78 if (kmemcpy((char *)&ftp, (long)ap.aps_data, sizeof(ftp)))
80 PRINTF("\tFTP Proxy:\n");
81 PRINTF("\t\tpassok: %d\n", ftp.ftp_passok);
82 ftp.ftp_side[0].ftps_buf[FTP_BUFSZ - 1] = '\0';
83 ftp.ftp_side[1].ftps_buf[FTP_BUFSZ - 1] = '\0';
84 PRINTF("\tClient:\n");
85 PRINTF("\t\tseq %x (ack %x) len %d junk %d cmds %d\n",
86 ftp.ftp_side[0].ftps_seq[0],
87 ftp.ftp_side[0].ftps_seq[1],
88 ftp.ftp_side[0].ftps_len, ftp.ftp_side[0].ftps_junk,
89 ftp.ftp_side[0].ftps_cmds);
91 printbuf(ftp.ftp_side[0].ftps_buf, FTP_BUFSZ, 1);
92 PRINTF("]\n\tServer:\n");
93 PRINTF("\t\tseq %x (ack %x) len %d junk %d cmds %d\n",
94 ftp.ftp_side[1].ftps_seq[0],
95 ftp.ftp_side[1].ftps_seq[1],
96 ftp.ftp_side[1].ftps_len, ftp.ftp_side[1].ftps_junk,
97 ftp.ftp_side[1].ftps_cmds);
99 printbuf(ftp.ftp_side[1].ftps_buf, FTP_BUFSZ, 1);
101 } else if (!strcmp(apr.apr_label, "ipsec") &&
102 (ap.aps_psiz == sizeof(ipsec))) {
103 if (kmemcpy((char *)&ipsec, (long)ap.aps_data, sizeof(ipsec)))
105 PRINTF("\tIPSec Proxy:\n");
106 PRINTF("\t\tICookie %08x%08x RCookie %08x%08x %s\n",
107 (u_int)ntohl(ipsec.ipsc_icookie[0]),
108 (u_int)ntohl(ipsec.ipsc_icookie[1]),
109 (u_int)ntohl(ipsec.ipsc_rcookie[0]),
110 (u_int)ntohl(ipsec.ipsc_rcookie[1]),
111 ipsec.ipsc_rckset ? "(Set)" : "(Not set)");