add UNLEASHED_OBJ to unleashed.mk
[unleashed/tickless.git] / usr / src / cmd / ipf / lib / common / printactivenat.c
blobbb1ce3ad54c3520a5ad9d6f93bfe99900e26fd25
1 /*
2 * Copyright (C) 2002-2004 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
5 */
7 #pragma ident "%Z%%M% %I% %E% SMI"
9 #include "ipf.h"
12 static const char rcsid[] = "@(#)$Id: printactivenat.c,v 1.3.2.4 2004/05/11 16:07:32 darrenr Exp $";
15 void printactivenat(nat, opts, alive)
16 nat_t *nat;
17 int opts, alive;
20 printf("%s", getnattype(nat, alive));
22 if (nat->nat_flags & SI_CLONE)
23 printf(" CLONE");
25 printactiveaddress(nat->nat_v, " %-15s", &nat->nat_inip6,
26 nat->nat_ifnames[0]);
28 if ((nat->nat_flags & IPN_TCPUDP) != 0)
29 printf(" %-5hu", ntohs(nat->nat_inport));
31 printf(" <- -> ");
32 printactiveaddress(nat->nat_v, "%-15s", &nat->nat_outip6,
33 nat->nat_ifnames[0]);
35 if ((nat->nat_flags & IPN_TCPUDP) != 0)
36 printf(" %-5hu", ntohs(nat->nat_outport));
38 printf(" [");
39 printactiveaddress(nat->nat_v, "%s", &nat->nat_oip6,
40 nat->nat_ifnames[0]);
42 if ((nat->nat_flags & IPN_TCPUDP) != 0)
43 printf(" %hu", ntohs(nat->nat_oport));
44 printf("]");
46 if (opts & OPT_VERBOSE) {
47 printf("\n\tage %lu use %hu sumd %s/",
48 nat->nat_age, nat->nat_use, getsumd(nat->nat_sumd[0]));
49 printf("%s pr %u bkt %d/%d flags %x\n",
50 getsumd(nat->nat_sumd[1]), nat->nat_p,
51 nat->nat_hv[0], nat->nat_hv[1], nat->nat_flags);
52 printf("\tifp %s", getifname(nat->nat_ifps[0]));
53 printf(",%s ", getifname(nat->nat_ifps[1]));
54 #ifdef USE_QUAD_T
55 printf("bytes %qu/%qu pkts %qu/%qu",
56 (unsigned long long)nat->nat_bytes[0],
57 (unsigned long long)nat->nat_bytes[1],
58 (unsigned long long)nat->nat_pkts[0],
59 (unsigned long long)nat->nat_pkts[1]);
60 #else
61 printf("bytes %lu/%lu pkts %lu/%lu", nat->nat_bytes[0],
62 nat->nat_bytes[1], nat->nat_pkts[0], nat->nat_pkts[1]);
63 #endif
64 printf(" ipsumd %x", nat->nat_ipsumd);
67 if (opts & OPT_DEBUG) {
68 printf("\n\tnat_next %p _pnext %p _hm %p\n",
69 nat->nat_next, nat->nat_pnext, nat->nat_hm);
70 printf("\t_hnext %p/%p _phnext %p/%p\n",
71 nat->nat_hnext[0], nat->nat_hnext[1],
72 nat->nat_phnext[0], nat->nat_phnext[1]);
73 printf("\t_data %p _me %p _state %p _aps %p\n",
74 nat->nat_data, nat->nat_me, nat->nat_state, nat->nat_aps);
75 printf("\tfr %p ptr %p ifps %p/%p sync %p\n",
76 nat->nat_fr, nat->nat_ptr, nat->nat_ifps[0],
77 nat->nat_ifps[1], nat->nat_sync);
78 printf("\ttqe:pnext %p next %p ifq %p parent %p/%p\n",
79 nat->nat_tqe.tqe_pnext, nat->nat_tqe.tqe_next,
80 nat->nat_tqe.tqe_ifq, nat->nat_tqe.tqe_parent, nat);
81 printf("\ttqe:die %ld touched %ld flags %x state %d/%d\n",
82 nat->nat_tqe.tqe_die, nat->nat_tqe.tqe_touched,
83 nat->nat_tqe.tqe_flags, nat->nat_tqe.tqe_state[0],
84 nat->nat_tqe.tqe_state[1]);
86 putchar('\n');