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); 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); \ 98 u8 a __attribute__((unused)), b __attribute__((unused)),
99 c __attribute__((unused)), d __attribute__((unused));
160 u32 db_entry_index, first_db_entry_index;
173 if (first_db_entry_index !=
EMPTY) {
179 }
while (first_db_entry_index != db_entry_index);
188 u32 db_entry_index, first_db_entry_index;
189 u32 total_entries = 0;
201 if (first_db_entry_index !=
EMPTY) {
205 }
while (first_db_entry_index != db_entry_index);
217 u32 active_count, scan_count;
230 if (index >= active_count) {
236 for (i=0; i< len; i++) {
239 if (index == scan_count) {
315 void cnat_db_dump_cdb (
int argc,
unsigned long *argv)
336 cnat_db_dump_address_portmap(verbose, all,
342 void cnat_db_dump_i_vrf (
int argc,
unsigned long *argv)
373 cnat_db_dump_address_portmap(verbose, all,
382 void cnat_db_dump_o_vrf (
int argc,
unsigned long *argv)
414 cnat_db_dump_address_portmap(verbose, all,
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;
436 bitmap_bytes = _v->alen;
442 free_indices_bytes = _v->alen;
444 free_indices_bytes = 0;
452 total_bytes = bitmap_bytes + free_indices_bytes +
vec_bytes;
455 total_bytes, bitmap_bytes, free_indices_bytes, vec_bytes);
462 bitmap_bytes = _v->alen;
468 free_indices_bytes = _v->alen;
470 free_indices_bytes = 0;
473 vec_bytes = _v->alen;
478 total_bytes = bitmap_bytes + free_indices_bytes +
vec_bytes;
481 total_bytes, bitmap_bytes, free_indices_bytes, vec_bytes);
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]);
508 my_nfv9_logging_info->
deleted?
"DELETED":
"ACTIVE");
535 server->ipv4_address,
537 server->refresh_rate,
538 server->timeout_rate);
551 void cnat_show_cdb (
int verbose)
569 for (l = 0; l <
vec_len(pm); l++) {
570 if (inuse[l] || verbose ) {
573 spp_host_to_net_byte_order_32((pm+l)->ipv4_address);
576 if (verbose && inuse[l]) {
577 cnat_portmap_dump (pm+l, inuse+l);
591 u32 first_address = 0;
592 u32 second_address = 0;
593 u32 last_address = 0;
599 for (i = 0; i < pm_len; i++) {
601 if (!first_address) {
603 }
else if (!second_address) {
612 if (second_address) {
616 if ((last_address != first_address) &&
617 (last_address != second_address)) {
640 for (i = 0; i < pm_len; i++) {
646 }
else if (my_pm->
inuse) {
651 if (verbose && (my_pm->
inuse)) {
736 if (my_vrfmap->
i_vrf == vrf) {
738 pm = my_vrfmap->portmap_list;
739 cnat_show_address_portmap(verbose, all, pm,my_vrfmap->port_limit);
770 if (my_vrfmap->
o_vrf == vrf) {
772 pm = my_vrfmap->portmap_list;
773 cnat_show_address_portmap(verbose, all, pm,my_vrfmap->port_limit);
784 u32 db_entry_index __attribute__((unused)),
785 first_db_entry_index __attribute__((unused));
798 u32 used __attribute__((unused)), free __attribute__((unused));
cnat_nfv9_global_info_t cnat_nfv9_global_info
void cnat_db_dump_user(int argc, unsigned long *argv)
cnat_main_db_entry_t * cnat_main_db
sll srl srl sll sra u16x4 i
void cnat_db_dump_user_summary(int argc, unsigned long *argv)
#define CNAT_MY_LOGGING_INFO_PRINT
void cnat_user_db_entry_dump_summary(cnat_user_db_entry_t *up)
void cnat_user_db_entry_dump(cnat_user_db_entry_t *up)
void cnat_db_dump_main(int argc, unsigned long *argv)
u32 cnat_main_db_icmp_rate_limit_core
Fixed length block allocator.
void cnat_db_dump_policy(int argc, unsigned long *argv)
cnat_vrfmap_t * cnat_portmap_by_vrf
u16 cnat_static_port_range
index_slist_t in2out_hash
#define CNAT_DB_FLAG_STATIC_PORT
#define vec_bytes(v)
Number of data bytes in vector.
u32 cnat_nfv9_global_collector_index
cnat_portmap_v2_t * portmap_list
void cnat_show_ivrf_command_v2(int argc, unsigned long *argv)
u16 cnat_main_db_max_ports_per_user
index_slist_t out2in_hash
void cnat_portmap_dump_v2(cnat_portmap_v2_t *pm, u16 print_limit)
index_slist_t * cnat_in2out_hash
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
void cnat_show_address_portmap(int verbose, int all, cnat_portmap_v2_t *pm, u16 port_limit)
u16 max_length_minus_max_record_size
void cnat_timeout_db_entry_dump(cnat_timeout_db_entry_t *up)
void cnat_show_cdb_command_v2(int argc, unsigned long *argv)
index_slist_t * cnat_user_hash
static pool_header_t * pool_header(void *v)
Get pool header from user pool pointer.
void cnat_show_address_portmap_sumary(cnat_portmap_v2_t *pm)
void cnat_db_dump_timeout()
u16 ** cnat_portmaps_inuse
nfv9_server_info_t * nfv9_server_info_pool
u32 cnat_main_db_icmp_rate_limit
void cnat_nfv9_show_collector(vlib_main_t *vm, cnat_nfv9_logging_info_t *my_nfv9_logging_info)
union cnat_main_db_entry_t::@213 alg
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
cnat_user_db_entry_t * cnat_user_db
cnat_timeout_db_entry_t * cnat_timeout_db
u32 translation_list_head_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
u32 total_address_pool_allocated
#define CNAT_DB_FLAG_TCP_ACTIVE
void cnat_db_dump_main_by_index(int argc, unsigned long *argv)
void cnat_db_dump_main_summary(int argc, unsigned long *argv)
void cnat_show_ovrf_command_v2(int argc, unsigned long *argv)
static void print_server_ip_address(vlib_main_t *vm, u32 ip)
index_slist_t * cnat_out2in_hash
Bitmaps built as vectors of machine words.
cnat_nfv9_logging_info_t * cnat_nfv9_logging_info_pool
void cnat_db_dump_hashes(int argc, unsigned long *argv)
cnat_pptp_config_t pptp_cfg
cnat_portmap_t ** cnat_portmaps
cnat_vrfmap_t * cnat_map_by_vrf
void cnat_main_db_entry_dump(cnat_main_db_entry_t *db)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define CNAT_MY_VRFMAP_PRINT
#define CNAT_DB_FLAG_UDP_ACTIVE
void cnat_show_cdb_v2(int verbose, int all)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
static uword pool_elts(void *v)
Number of active elements in a pool.