2 *------------------------------------------------------------------
3 * cnat_show.c - translation database definitions
5 * Copyright (c) 2007-2014 Cisco and/or its affiliates.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at:
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *------------------------------------------------------------------
20 #include <vlib/vlib.h>
21 #include <vnet/vnet.h>
22 #include <vppinfra/vec.h>
23 #include <vppinfra/bitmap.h>
24 #include <vppinfra/hash.h>
25 #include <vppinfra/pool.h>
26 #include <vppinfra/clib.h>
29 #include "cnat_config.h"
30 #include "cnat_global.h"
31 #include "cnat_logging.h"
33 #include "spp_timers.h"
34 #include "platform_common.h"
35 #include "cnat_syslog.h"
36 #include "cnat_v4_pptp_alg.h"
37 #include "platform_common.h"
40 /* The following variable is in cnat_config_msg_handler.c which
41 * is to be ported later.. if required
43 u32 total_address_pool_allocated = 0;
46 #ifndef NO_BULK_LOGGING
47 #define CNAT_MY_VRFMAP_PRINT \
48 PLATFORM_DEBUG_PRINT("i-uidx 0x%x o-uidx 0x%x i-vrfid 0x%x o-vrfid 0x%x\n" \
49 "status %d del time 0x%x tcp mss 0x%x pm list 0x%x\n" \
52 "NFV9 template index 0x%x\n" \
53 "SYSLOG template index 0x%x\n" \
54 "Netflow Session Logging %d \n" \
55 "Syslog Session Logging %d \n" \
56 "PCP Server 0x%x, Port %u \n", \
57 my_vrfmap->i_vrf, my_vrfmap->o_vrf, my_vrfmap->i_vrf_id, \
58 my_vrfmap->o_vrf_id, my_vrfmap->status, my_vrfmap->delete_time, \
59 my_vrfmap->tcp_mss, my_vrfmap->portmap_list, \
60 BULKSIZE_FROM_VRFMAP(my_vrfmap), \
61 my_vrfmap->ip_n_to_1, \
62 my_vrfmap->nfv9_logging_index, \
63 my_vrfmap->syslog_logging_index,\
64 my_vrfmap->nf_logging_policy, \
65 my_vrfmap->syslog_logging_policy, \
66 my_vrfmap->pcp_server_addr, \
67 my_vrfmap->pcp_server_port);
69 #define CNAT_MY_VRFMAP_PRINT \
70 PLATFORM_DEBUG_PRINT("i-uidx 0x%x o-uidx 0x%x i-vrfid 0x%x o-vrfid 0x%x\n" \
71 "status %d del time 0x%x tcp mss 0x%x pm list 0x%x\n" \
72 "NFV9 template index 0x%x\n ip n:1 %d\n", \
73 my_vrfmap->i_vrf, my_vrfmap->o_vrf, my_vrfmap->i_vrf_id, \
74 my_vrfmap->o_vrf_id, my_vrfmap->status, my_vrfmap->delete_time, \
75 my_vrfmap->tcp_mss, my_vrfmap->portmap_list, \
76 my_vrfmap->nfv9_logging_index, my_vrfmap->ip_n_to_1);
77 #endif /* NO_BULK_LOGGING */
79 #define CNAT_MY_LOGGING_INFO_PRINT \
81 cnat_syslog_logging_info_t *my_syslog_info = 0; \
82 PLATFORM_DEBUG_PRINT("SYSLOG config: \n"); \
83 pool_foreach (my_syslog_info, cnat_syslog_logging_info_pool, ({ \
84 if (my_syslog_info->i_vrf == my_vrfmap->i_vrf) { \
85 PLATFORM_DEBUG_PRINT(" \
86 ipv4[0x%x], port[%u], hostname[%s]\n", \
87 my_syslog_info->ipv4_address, my_syslog_info->port, \
88 my_syslog_info->header_hostname); \
96 void printf_ipv4(u32 ad)
98 u8 a __attribute__((unused)), b __attribute__((unused)),
99 c __attribute__((unused)), d __attribute__((unused));
106 PLATFORM_DEBUG_PRINT("%d.%d.%d.%d", a, b, c, d);
108 void cnat_main_db_entry_dump (cnat_main_db_entry_t *db)
110 PLATFORM_DEBUG_PRINT("Main DB entry at %p, index %ld dst_ip %x\n",
111 db, db - cnat_main_db, db->dst_ipv4);
112 /* only dump hash next index if it's non EMPTY */
113 if (db->out2in_hash.next != EMPTY || db->in2out_hash.next != EMPTY)
114 PLATFORM_DEBUG_PRINT("out2in hash %u, in2out hash %u\n",
115 db->out2in_hash.next,
116 db->in2out_hash.next);
117 PLATFORM_DEBUG_PRINT("out2in key ipv4 0x%08X, port 0x%04X (%5d), vrf %d, protocol %s\n",
118 db->out2in_key.k.ipv4,
119 db->out2in_key.k.port,
120 db->out2in_key.k.port,
121 db->out2in_key.k.vrf & CNAT_VRF_MASK,
122 (db->out2in_key.k.vrf & CNAT_PRO_MASK) == CNAT_UDP ? "UDP" :
123 ((db->in2out_key.k.vrf & CNAT_PRO_MASK) == CNAT_TCP ? "TCP" :
124 ((db->in2out_key.k.vrf & CNAT_PRO_MASK) == CNAT_ICMP ? "ICMP" : "PPTP ALG")));
126 PLATFORM_DEBUG_PRINT("in2out key ipv4 0x%08X, port 0x%04X (%5d), vrf %d, protocol %s\n",
127 db->in2out_key.k.ipv4,
128 db->in2out_key.k.port,
129 db->in2out_key.k.port,
130 db->in2out_key.k.vrf & CNAT_VRF_MASK,
131 (db->in2out_key.k.vrf & CNAT_PRO_MASK) == CNAT_UDP ? "UDP" :
132 ((db->in2out_key.k.vrf & CNAT_PRO_MASK) == CNAT_TCP ? "TCP" :
133 ((db->in2out_key.k.vrf & CNAT_PRO_MASK) == CNAT_ICMP ? "ICMP" : "UNKNOWN")));
135 PLATFORM_DEBUG_PRINT("user %d, user ports (nxt) %d (prev) %d, vrfmap_index 0x%x\n",
136 db->user_index, db->user_ports.next, db->user_ports.prev,
138 PLATFORM_DEBUG_PRINT("timeout %d \n", db->timeout);
139 PLATFORM_DEBUG_PRINT("flags 0x%x ", db->flags);
141 if (db->flags & CNAT_DB_FLAG_TCP_ACTIVE) {
142 PLATFORM_DEBUG_PRINT(" TCP_ACTIVE ");
143 } else if (db->flags & CNAT_DB_FLAG_UDP_ACTIVE) {
144 PLATFORM_DEBUG_PRINT(" UDP_ACTIVE ");
145 } else if (db->flags & CNAT_DB_FLAG_STATIC_PORT) {
146 PLATFORM_DEBUG_PRINT(" STATIC_PORT ");
149 PLATFORM_DEBUG_PRINT(" ALG dlt0 0x%02X dlt1 0x%02X\n", db->alg.alg_dlt[0], db->alg.alg_dlt[1]);
150 PLATFORM_DEBUG_PRINT("\n");
152 PLATFORM_DEBUG_PRINT("out2in_pkts: %u\n", db->out2in_pkts);
153 PLATFORM_DEBUG_PRINT("in2out_pkts: %u\n", db->in2out_pkts);
154 PLATFORM_DEBUG_PRINT("entry_expires: %u current time: %u\n", db->entry_expires, cnat_current_time);
155 PLATFORM_DEBUG_PRINT("-------------------------\n");
158 void cnat_user_db_entry_dump (cnat_user_db_entry_t *up)
160 u32 db_entry_index, first_db_entry_index;
161 cnat_main_db_entry_t *ep;
163 PLATFORM_DEBUG_PRINT("User DB entry at %p, index %ld\n",
164 up, up - cnat_user_db);
165 PLATFORM_DEBUG_PRINT("translation list head index %u, %u translations portmapindex 0x%x\n",
166 up->translation_list_head_index,
167 up->ntranslations, up->portmap_index);
168 PLATFORM_DEBUG_PRINT("source ipv4 0x%x, source port 0x%x, vrf %d\n",
172 first_db_entry_index = db_entry_index = up->translation_list_head_index;
173 if (first_db_entry_index != EMPTY) {
174 PLATFORM_DEBUG_PRINT("Port translation list:\n");
176 PLATFORM_DEBUG_PRINT(" [%d]\n", db_entry_index);
177 ep = cnat_main_db + db_entry_index;
178 db_entry_index = ep->user_ports.next;
179 } while (first_db_entry_index != db_entry_index);
181 PLATFORM_DEBUG_PRINT("WARNING: empty translation list!\n");
183 PLATFORM_DEBUG_PRINT("-------------------------\n");
186 void cnat_user_db_entry_dump_summary (cnat_user_db_entry_t *up)
188 u32 db_entry_index, first_db_entry_index;
189 u32 total_entries = 0;
191 PLATFORM_DEBUG_PRINT("User DB entry at %p, index %ld\n",
192 up, up - cnat_user_db);
193 PLATFORM_DEBUG_PRINT("translation list head index %u, %u translations portmapindex 0x%x\n",
194 up->translation_list_head_index,
195 up->ntranslations, up->portmap_index);
196 PLATFORM_DEBUG_PRINT("source ipv4 0x%x, source port 0x%x, vrf %d\n",
200 first_db_entry_index = db_entry_index = up->translation_list_head_index;
201 if (first_db_entry_index != EMPTY) {
202 PLATFORM_DEBUG_PRINT("Port translation list:\n");
205 } while (first_db_entry_index != db_entry_index);
206 PLATFORM_DEBUG_PRINT("TOTAL_ENTRIES: %d\n", total_entries);
208 PLATFORM_DEBUG_PRINT("WARNING: empty translation list!\n");
210 PLATFORM_DEBUG_PRINT("-------------------------\n");
213 /* for internal development and UT only */
214 void cnat_db_dump_main_by_index (int argc, unsigned long *argv)
217 u32 active_count, scan_count;
220 PLATFORM_DEBUG_PRINT("invalid input %d\n", argc);
226 len = vec_len(cnat_main_db);
228 active_count = pool_elts(cnat_main_db);
230 if (index >= active_count) {
231 PLATFORM_DEBUG_PRINT("Index %u >= total active entries %u\n", index, active_count);
236 for (i=0; i< len; i++) {
237 if(pool_is_free_index(cnat_main_db, i)) continue;
239 if (index == scan_count) {
240 cnat_main_db_entry_dump(cnat_main_db + i);
247 void cnat_db_dump_main (int argc, unsigned long *argv)
249 cnat_main_db_entry_t *db;
251 pool_foreach(db, cnat_main_db, ({
252 cnat_main_db_entry_dump(db);
256 void cnat_db_dump_main_summary (int argc, unsigned long *argv)
258 cnat_main_db_entry_t *db;
261 pool_foreach(db, cnat_main_db, ({
265 PLATFORM_DEBUG_PRINT("\nNum main entries %d\n", num_entries);
268 void cnat_db_dump_user (int argc, unsigned long *argv)
270 cnat_user_db_entry_t *up;
272 pool_foreach(up, cnat_user_db, ({
273 cnat_user_db_entry_dump(up);
277 void cnat_db_dump_user_summary (int argc, unsigned long *argv)
279 cnat_user_db_entry_t *up;
281 pool_foreach(up, cnat_user_db, ({
282 cnat_user_db_entry_dump_summary(up);
286 void cnat_db_dump_hashes (int argc, unsigned long *argv)
290 PLATFORM_DEBUG_PRINT("Main DB out2in hash:\n");
291 for (i = 0; i < vec_len(cnat_out2in_hash); i++) {
292 if (cnat_out2in_hash[i].next != EMPTY) {
293 PLATFORM_DEBUG_PRINT("[%d]: %u\n", i, cnat_out2in_hash[i].next);
296 PLATFORM_DEBUG_PRINT("Main DB in2out hash:\n");
297 for (i = 0; i < vec_len(cnat_in2out_hash); i++) {
298 if (cnat_in2out_hash[i].next != EMPTY) {
299 PLATFORM_DEBUG_PRINT("[%d]: %u\n", i, cnat_in2out_hash[i].next);
303 PLATFORM_DEBUG_PRINT("User hash:\n");
304 for (i = 0; i < vec_len(cnat_user_hash); i++) {
305 if (cnat_user_hash[i].next != EMPTY) {
306 PLATFORM_DEBUG_PRINT("[%d]: %u\n", i, cnat_user_hash[i].next);
309 PLATFORM_DEBUG_PRINT("-------------------------\n");
315 void cnat_db_dump_cdb (int argc, unsigned long *argv)
329 PLATFORM_DEBUG_PRINT ("%d vrfmap vectors \n", vec_len(cnat_portmap_by_vrf));
331 for (k = 0; k < vec_len(cnat_portmap_by_vrf); k++) {
332 PLATFORM_DEBUG_PRINT("index%d: status %d i_vrf 0x%x o_vrf 0x%x\n", k,
333 cnat_portmap_by_vrf[k].status,
334 cnat_portmap_by_vrf[k].i_vrf,
335 cnat_portmap_by_vrf[k].o_vrf);
336 cnat_db_dump_address_portmap(verbose, all,
338 cnat_portmaps_inuse[k]);
342 void cnat_db_dump_i_vrf (int argc, unsigned long *argv)
350 PLATFORM_DEBUG_PRINT("need vrf input ,return\n");
366 PLATFORM_DEBUG_PRINT ("%d vrfmap vectors \n", vec_len(cnat_portmap_by_vrf));
368 for (k = 0; k < vec_len(cnat_portmap_by_vrf); k++) {
369 if (cnat_portmap_by_vrf[k].i_vrf == vrf) {
370 PLATFORM_DEBUG_PRINT("%d: i_vrf 0x%x o_vrf 0x%x\n", k,
371 cnat_portmap_by_vrf[k].i_vrf,
372 cnat_portmap_by_vrf[k].o_vrf);
373 cnat_db_dump_address_portmap(verbose, all,
375 cnat_portmaps_inuse[k]);
379 PLATFORM_DEBUG_PRINT("not found\n");
382 void cnat_db_dump_o_vrf (int argc, unsigned long *argv)
390 PLATFORM_DEBUG_PRINT("need vrf input ,return\n");
406 PLATFORM_DEBUG_PRINT ("%d vrfmap vectors \n", vec_len(cnat_portmap_by_vrf));
408 for (k = 0; k < vec_len(cnat_portmap_by_vrf); k++) {
409 if (cnat_portmap_by_vrf[k].o_vrf == vrf) {
410 PLATFORM_DEBUG_PRINT("index%d: status %d i_vrf 0x%x o_vrf 0x%x\n", k,
411 cnat_portmap_by_vrf[k].status,
412 cnat_portmap_by_vrf[k].i_vrf,
413 cnat_portmap_by_vrf[k].o_vrf);
414 cnat_db_dump_address_portmap(verbose, all,
416 cnat_portmaps_inuse[k]);
420 PLATFORM_DEBUG_PRINT("not found\n");
425 /* This does not seem to be used */
426 void cnat_db_mem_usage_cmd (int argc, unsigned long *argv)
430 u32 bitmap_bytes=0, free_indices_bytes=0, vec_bytes=0, total_bytes=0;
433 p = pool_header(cnat_main_db);
434 if (p->free_bitmap) {
435 _v = _vec_find(p->free_bitmap);
436 bitmap_bytes = _v->alen;
440 if (p->free_indices) {
441 _v = _vec_find(p->free_indices);
442 free_indices_bytes = _v->alen;
444 free_indices_bytes = 0;
446 _v = _vec_find(cnat_main_db);
447 vec_bytes = _v->alen;
452 total_bytes = bitmap_bytes + free_indices_bytes + vec_bytes;
454 PLATFORM_DEBUG_PRINT ("Main DB: %d total bytes, %d bitmap, %d indices, %d vec\n",
455 total_bytes, bitmap_bytes, free_indices_bytes, vec_bytes);
456 PLATFORM_DEBUG_PRINT (" vector length %d\n", vec_len(cnat_main_db));
459 p = pool_header(cnat_user_db);
460 if (p->free_bitmap) {
461 _v = _vec_find(p->free_bitmap);
462 bitmap_bytes = _v->alen;
466 if (p->free_indices) {
467 _v = _vec_find(p->free_indices);
468 free_indices_bytes = _v->alen;
470 free_indices_bytes = 0;
472 _v = _vec_find(cnat_user_db);
473 vec_bytes = _v->alen;
478 total_bytes = bitmap_bytes + free_indices_bytes + vec_bytes;
480 PLATFORM_DEBUG_PRINT ("User DB: %d total bytes, %d bitmap, %d indices, %d vec\n",
481 total_bytes, bitmap_bytes, free_indices_bytes, vec_bytes);
482 PLATFORM_DEBUG_PRINT (" vector length %d\n", vec_len(cnat_user_db));
484 _v = _vec_find(cnat_out2in_hash);
485 PLATFORM_DEBUG_PRINT("out2in hash: %d total bytes\n", _v->alen);
487 _v = _vec_find(cnat_in2out_hash);
488 PLATFORM_DEBUG_PRINT("in2out hash: %d total bytes\n", _v->alen);
492 static void print_server_ip_address (vlib_main_t *vm, u32 ip)
494 unsigned char bytes[4];
495 bytes[0] = ip & 0xFF;
496 bytes[1] = (ip >> 8) & 0xFF;
497 bytes[2] = (ip >> 16) & 0xFF;
498 bytes[3] = (ip >> 24) & 0xFF;
499 vlib_cli_output(vm, "\tIP Address %d.%d.%d.%d\n", bytes[0], bytes[1], bytes[2], bytes[3]);
502 void cnat_nfv9_show_collector (vlib_main_t *vm, cnat_nfv9_logging_info_t *my_nfv9_logging_info)
504 nfv9_server_info_t *server = nfv9_server_info_pool +
505 my_nfv9_logging_info->server_index;
507 vlib_cli_output(vm,"\tVRF - 0x%x - %s\n", my_nfv9_logging_info->i_vrf,
508 my_nfv9_logging_info->deleted?"DELETED":"ACTIVE");
509 print_server_ip_address(vm, clib_net_to_host_u32(server->ipv4_address));
510 vlib_cli_output(vm,"\tIP port %d\n", server->port);
511 vlib_cli_output(vm,"\tTimeout %d\n", server->timeout_rate);
512 vlib_cli_output(vm,"\tRefresh %d\n", server->refresh_rate);
513 vlib_cli_output(vm,"\tMax PkSz %d\n", my_nfv9_logging_info->max_length_minus_max_record_size);
516 void cnat_db_dump_policy (int argc, unsigned long *argv)
519 PLATFORM_CNAT_DB_DUMP_POLICY_PRINT();
521 if (cnat_nfv9_global_info.cnat_nfv9_init_done) {
522 if (cnat_nfv9_global_info.cnat_nfv9_global_collector_index != EMPTY) {
523 cnat_nfv9_logging_info_t *my_nfv9_logging_info;
524 nfv9_server_info_t *server __attribute__((unused));
526 my_nfv9_logging_info = cnat_nfv9_logging_info_pool +
527 cnat_nfv9_global_info.cnat_nfv9_global_collector_index;
528 server = nfv9_server_info_pool +
529 my_nfv9_logging_info->server_index;
531 PLATFORM_DEBUG_PRINT("NFv9 logging ip 0x%x port 0x%x refresh-rate %d timeout %d\n",
532 server->ipv4_address,
534 server->refresh_rate,
535 server->timeout_rate);
536 PLATFORM_DEBUG_PRINT("NFv9 path_mtu = %d\n",
537 my_nfv9_logging_info->max_length_minus_max_record_size);
539 PLATFORM_DEBUG_PRINT("NFv9 global logging is not configured\n");
542 PLATFORM_DEBUG_PRINT("NFv9 LOGGING is not configured\n");
548 void cnat_show_cdb (int verbose)
551 for (i = 0; i < vec_len(cnat_portmap_by_vrf); i++) {
552 PLATFORM_DEBUG_PRINT("i_vrf %d : o_vrf %d\n",
553 cnat_portmap_by_vrf[i].i_vrf,
554 cnat_portmap_by_vrf[i].o_vrf);
557 PLATFORM_DEBUG_PRINT("port limit %d\n", cnat_main_db_max_ports_per_user);
559 PLATFORM_DEBUG_PRINT ("%d portmap vectors\n", vec_len(cnat_portmaps));
561 for (k = 0; k < vec_len(cnat_portmaps); k++) {
564 pm = cnat_portmaps[k];
565 inuse = cnat_portmaps_inuse[k];
566 for (l = 0; l < vec_len(pm); l++) {
567 if (inuse[l] || verbose ) {
570 spp_host_to_net_byte_order_32((pm+l)->ipv4_address);
571 printf_ipv4(net_address);
572 PLATFORM_DEBUG_PRINT (": %d inuse\n", inuse[l]);
573 if (verbose && inuse[l]) {
574 cnat_portmap_dump (pm+l, inuse+l);
584 /* v2 show command */
585 void cnat_show_address_portmap_sumary (cnat_portmap_v2_t *pm)
587 cnat_portmap_v2_t *my_pm =0;
588 u32 first_address = 0;
589 u32 second_address = 0;
590 u32 last_address = 0;
593 if ((pm_len = vec_len(pm))) {
594 PLATFORM_DEBUG_PRINT("%d portmap in this list 0x%lx\n",
596 for (i = 0; i < pm_len; i++) {
598 if (!first_address) {
599 first_address = my_pm->ipv4_address;
600 } else if (!second_address) {
601 second_address = my_pm->ipv4_address;
603 last_address = my_pm->ipv4_address;
607 PLATFORM_DEBUG_PRINT("1. 0x%08x", first_address);
609 if (second_address) {
610 PLATFORM_DEBUG_PRINT(", 2. 0x%08x", second_address);
613 if ((last_address != first_address) &&
614 (last_address != second_address)) {
615 PLATFORM_DEBUG_PRINT(", ....., %d. 0x%08x", pm_len, last_address);
617 PLATFORM_DEBUG_PRINT("\n");
619 PLATFORM_DEBUG_PRINT("ZERO POOL ADDRESSES in this list 0x%x \n", (u32)pm);
624 void cnat_show_address_portmap (int verbose, int all,
625 cnat_portmap_v2_t *pm, u16 port_limit)
627 cnat_portmap_v2_t *my_pm =0;
630 pm_len = vec_len(pm);
632 cnat_show_address_portmap_sumary(pm);
634 PLATFORM_DEBUG_PRINT("%d portmap in this list 0x%x \n", pm_len, (u32)pm);
637 for (i = 0; i < pm_len; i++) {
641 PLATFORM_DEBUG_PRINT("pm:0x%x ip address:0x%x del_time 0x%x inuse:%d\n",
642 (u32)my_pm, my_pm->ipv4_address, my_pm->delete_time, my_pm->inuse);
643 } else if (my_pm->inuse) {
644 PLATFORM_DEBUG_PRINT("pm:0x%x ip address:0x%x inuse:%d\n",
645 (u32)my_pm, my_pm->ipv4_address, my_pm->inuse);
648 if (verbose && (my_pm->inuse)) {
649 if(PREDICT_FALSE(!port_limit)) {
650 cnat_portmap_dump_v2 (my_pm, cnat_main_db_max_ports_per_user);
653 cnat_portmap_dump_v2 (my_pm, port_limit);
658 PLATFORM_DEBUG_PRINT("\n");
662 void cnat_show_cdb_v2 (int verbose, int all)
664 cnat_vrfmap_t *my_vrfmap = 0;
665 cnat_portmap_v2_t *pm =0;
666 PLATFORM_DEBUG_PRINT("port limit %d\n", cnat_main_db_max_ports_per_user);
667 PLATFORM_DEBUG_PRINT("total address pool allocated %d\n", total_address_pool_allocated);
668 PLATFORM_DEBUG_PRINT("icmp rate limit %d (per core %d)\n",
669 cnat_main_db_icmp_rate_limit, cnat_main_db_icmp_rate_limit_core);
670 PLATFORM_DEBUG_PRINT("dynamic port range start %d\n", cnat_static_port_range);
671 if (pptp_cfg.enable == PPTP_DISABLED) {
672 PLATFORM_DEBUG_PRINT("PPTP alg disabled \n");
674 PLATFORM_DEBUG_PRINT("PPTP alg enabled \n");
677 if (ftp_alg_enabled) {
678 PLATFORM_DEBUG_PRINT("FTP alg enabled\n");
680 PLATFORM_DEBUG_PRINT("FTP alg disabled\n");
683 pool_foreach (my_vrfmap, cnat_map_by_vrf, ({
685 CNAT_MY_LOGGING_INFO_PRINT
686 PLATFORM_DEBUG_PRINT("per vrf port limit %d\n", my_vrfmap->port_limit);
687 pm = my_vrfmap->portmap_list;
688 cnat_show_address_portmap(verbose, all, pm, my_vrfmap->port_limit);
694 void cnat_show_cdb_command_v2(int argc, unsigned long *argv)
707 cnat_show_cdb_v2(verbose, all);
710 void cnat_show_ivrf_command_v2 (int argc, unsigned long *argv)
715 cnat_vrfmap_t *my_vrfmap = 0;
716 cnat_portmap_v2_t *pm =0;
719 PLATFORM_DEBUG_PRINT("need vrf input ,return\n");
731 PLATFORM_DEBUG_PRINT ("%lld vrfmap vectors \n", pool_elts(cnat_map_by_vrf));
732 pool_foreach (my_vrfmap, cnat_map_by_vrf, ({
733 if (my_vrfmap->i_vrf == vrf) {
735 pm = my_vrfmap->portmap_list;
736 cnat_show_address_portmap(verbose, all, pm,my_vrfmap->port_limit);
740 PLATFORM_DEBUG_PRINT("not found\n");
743 void cnat_show_ovrf_command_v2 (int argc, unsigned long *argv)
749 cnat_vrfmap_t *my_vrfmap = 0;
750 cnat_portmap_v2_t *pm =0;
753 PLATFORM_DEBUG_PRINT("need vrf input ,return\n");
765 PLATFORM_DEBUG_PRINT("%d vrfmap vectors \n", pool_elts(cnat_map_by_vrf));
766 pool_foreach (my_vrfmap, cnat_map_by_vrf, ({
767 if (my_vrfmap->o_vrf == vrf) {
769 pm = my_vrfmap->portmap_list;
770 cnat_show_address_portmap(verbose, all, pm,my_vrfmap->port_limit);
775 PLATFORM_DEBUG_PRINT("not found\n");
779 void cnat_timeout_db_entry_dump (cnat_timeout_db_entry_t *up)
781 u32 db_entry_index __attribute__((unused)),
782 first_db_entry_index __attribute__((unused));
784 PLATFORM_DEBUG_PRINT("Timeout DB entry at index %ld\n", up - cnat_timeout_db);
785 PLATFORM_DEBUG_PRINT("Desnt key 0x%16llx\n", up->t_key.timeout_key.key64);
786 PLATFORM_DEBUG_PRINT("Timeout value %d\n", up->t_key.timeout_value);
787 PLATFORM_DEBUG_PRINT("Hash Next 0x%x\n", up->t_hash.next);
791 void cnat_db_dump_timeout ()
793 cnat_timeout_db_entry_t *up;
795 u32 used __attribute__((unused)), free __attribute__((unused));
797 h = pool_header(cnat_timeout_db);
798 free = vec_len(h->free_indices);
799 used = (vec_len(cnat_timeout_db) - free);
801 PLATFORM_DEBUG_PRINT("Timeout DB Free %d, Used %d\n",free, used);
803 pool_foreach(up, cnat_timeout_db, ({
804 cnat_timeout_db_entry_dump(up);