FD.io VPP  v16.09
Vector Packet Processing
cnat_debug_msg_handler.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * cnat_debug_msg_handler.c - debug command
4  *
5  * Copyright (c) 2007-2013 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:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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  *------------------------------------------------------------------
18  */
19 
20 #include <vlib/vlib.h>
21 #include <vnet/vnet.h>
22 
23 #include "cnat_cli.h"
24 
30 
35 
40 
42 
45 
48 
50 
51 /*
52  * By defaut we set the config debug level to 1
53  */
55 
56 #ifdef TOBE_PORTED
57 extern void show_bulk_port_stats();
58 extern void clear_bulk_port_stats();
59 extern void show_bulk_port_allocation(u16 in_vrfid, u32 inside_ip);
60 extern void set_bulk_size_to_all_vrfs(int bulk_size);
61 
62 u32 *cnat_debug_addr_list;
63 
64 extern int global_pd_dbg_lvl;
65 extern int global_pi_dbg_lvl;
66 extern int global_l2_dbg_lvl;
68 extern u32 cnat_pcp_debug_flag;
69 
70 void spp_api_cnat_get_cgn_db_summary
71 (spp_api_cnat_generic_command_request_t *);
72 
73 void spp_api_cnat_v4_debug_dummy_t_handler
74 (spp_api_cnat_v4_debug_dummy_t *mp)
75 {
76  u32 arr[] = { DEBUG_DUMMY };
78  if(global_pd_dbg_lvl) {
79  PLATFORM_DEBUG_PRINT("\n invalid debug command received: message id is 0\n");
80  }
81  mp->rc = CNAT_ERR_INVALID_MSG_ID;
82 
83 }
84 
85 void spp_api_cnat_v4_debug_dummy_max_t_handler
86 (spp_api_cnat_v4_debug_dummy_max_t *mp)
87 {
88  u32 arr[] = { DEBUG_DUMMY_MAX };
90  if(global_pd_dbg_lvl) {
91  PLATFORM_DEBUG_PRINT("\n invalid debug command received: message id is out of range\n");
92  }
93  mp->rc = CNAT_ERR_INVALID_MSG_ID;
94 
95 }
96 
97 
98 void spp_api_cnat_v4_debug_global_t_handler
99 (spp_api_cnat_v4_debug_global_t *mp)
100 {
101  if ((mp->debug_flag == CNAT_DEBUG_GLOBAL_ERR) ||
102  (mp->debug_flag == CNAT_DEBUG_GLOBAL_ALL) ||
103  (mp->debug_flag == CNAT_DEBUG_NONE)) {
104  mp->rc = CNAT_SUCCESS;
105  global_debug_flag = mp->debug_flag;
106  return;
107  }
108 
109  mp->rc = CNAT_ERR_PARSER;
110  if(global_pd_dbg_lvl) {
111  PLATFORM_DEBUG_PRINT("invalid global debug flag %x\n",
112  mp->debug_flag);
113  }
114  return;
115 }
116 
117 void spp_node_print_cnat_counters()
118 {
120  PLATFORM_DEBUG_PRINT("\nNF downstream constipation count: %llu\n",
122  }
123 
124  if (xlat_global_counters.v4_to_v6_frag_invalid_uidb_drop_count ||
125  xlat_global_counters.v6_to_v4_frag_invalid_uidb_drop_count ||
126  xlat_global_counters.v4_to_v6_icmp_invalid_uidb_drop_count ||
127  xlat_global_counters.v6_to_v4_icmp_invalid_uidb_drop_count ||
128  xlat_global_counters.v4_to_v6_tcp_invalid_uidb_drop_count ||
129  xlat_global_counters.v6_to_v4_tcp_invalid_uidb_drop_count ||
130  xlat_global_counters.v4_to_v6_udp_invalid_uidb_drop_count ||
131  xlat_global_counters.v6_to_v4_udp_invalid_uidb_drop_count ||
132  xlat_global_counters.v4_to_v6_udp_crc_zero_invalid_uidb_drop_count) {
133 
134  PLATFORM_DEBUG_PRINT("\nMy_instance %d: v4_to_v6 frag invalid uidb drop count %lld",
136  xlat_global_counters.v4_to_v6_frag_invalid_uidb_drop_count);
137 
138  PLATFORM_DEBUG_PRINT("\nMy_instance %d: v6_to_v4 frag invalid uidb drop count %lld",
140  xlat_global_counters.v6_to_v4_frag_invalid_uidb_drop_count);
141 
142  PLATFORM_DEBUG_PRINT("\nMy_instance %d: v4_to_v6 icmp invalid uidb drop count %lld",
144  xlat_global_counters.v4_to_v6_icmp_invalid_uidb_drop_count);
145 
146  PLATFORM_DEBUG_PRINT("\nMy_instance %d: v6_to_v4 icmp invalid uidb drop count %lld",
148  xlat_global_counters.v6_to_v4_icmp_invalid_uidb_drop_count);
149 
150  PLATFORM_DEBUG_PRINT("\nMy_instance %d: v4_to_v6 tcp invalid uidb drop count %lld",
152  xlat_global_counters.v4_to_v6_tcp_invalid_uidb_drop_count);
153 
154  PLATFORM_DEBUG_PRINT("\nMy_instance %d: v6_to_v4 tcp invalid uidb drop count %lld",
156  xlat_global_counters.v6_to_v4_tcp_invalid_uidb_drop_count);
157 
158  PLATFORM_DEBUG_PRINT("\nMy_instance %d: v4_to_v6 udp invalid uidb drop count %lld",
160  xlat_global_counters.v4_to_v6_udp_invalid_uidb_drop_count);
161 
162  PLATFORM_DEBUG_PRINT("\nMy_instance %d: v6_to_v4 udp invalid uidb drop count %lld",
164  xlat_global_counters.v6_to_v4_udp_invalid_uidb_drop_count);
165 
166  PLATFORM_DEBUG_PRINT("\nMy_instance %d: v4_to_v6 udp crc0 invld uidb drop count %lld",
168  xlat_global_counters.v4_to_v6_udp_crc_zero_invalid_uidb_drop_count);
169 
170  PLATFORM_DEBUG_PRINT("\n");
171  }
172 
173 
174 }
175 
176 void spp_log_p2mp_req(spp_api_cnat_p2mp_debug_request_t *mp)
177 {
178  u8 i = 0;
179  u32 num_rec = spp_net_to_host_byte_order_32(&mp->param[i++]);
180  u32 err_c_num_args;
181 
182  while (num_rec--) {
183  u8 j = 0;
184  u16 err_c;
185  u16 num_args;
186  u32 argv[32];
187 
188  err_c_num_args = spp_net_to_host_byte_order_32(&mp->param[i++]);
189  err_c = (err_c_num_args >> 16) & 0xFFFF;
190  num_args = err_c_num_args & 0xFFFF;
191 
192  num_args = (num_args <= 32) ? num_args : 32;
193  while (j < num_args) {
194  argv[j++] = spp_net_to_host_byte_order_32(&mp->param[i++]);
195  }
196 
197  i += ((num_args - 32) > 0) ? (num_args - 32) : 0;
198  spp_printf(err_c, num_args, argv);
199  }
200 }
201 
202 void nat64_debug_addr_pool_add_del()
203 {
204  cnat_portmap_v2_t *my_pm = NULL;
205  cnat_portmap_v2_t *pm = NULL;
206  u32 len, i, pm_len;
207 
208  PLATFORM_DEBUG_PRINT("\n sizeof port_map =%d\n", sizeof( cnat_portmap_v2_t));
209  len = 10;
210  PLATFORM_DEBUG_PRINT("\n adding 10 entries in vector 1-10\n ");
211  vec_add2(pm, my_pm, len);
212  pm = my_pm;
213 
214  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
215  for(i=0;i<len;i++){
216  my_pm->ipv4_address = i+1;
217  my_pm++;
218  }
219  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
220 
221  pm_len = vec_len(pm);
222  PLATFORM_DEBUG_PRINT("\n printing vector contents : vec_len = %d \n", pm_len);
223  my_pm = pm;
224  for(i=0;i<pm_len ; i++)
225  {
226  PLATFORM_DEBUG_PRINT(" %d ,",my_pm->ipv4_address);
227  my_pm++;
228  }
229  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
230 
231  PLATFORM_DEBUG_PRINT("\n adding 5 entries in vector 11-15\n ");
232  len = 5;
233  vec_add2(pm, my_pm, len);
234 
235  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
236  for(i=0;i<len;i++) {
237  my_pm->ipv4_address = 11+i;
238  my_pm++;
239  }
240 
241  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
242  pm_len = vec_len(pm);
243  PLATFORM_DEBUG_PRINT("\n printing vector contents : vec_len = %d \n", pm_len);
244  my_pm = pm;
245  for(i=0;i<pm_len ; i++)
246  {
247  PLATFORM_DEBUG_PRINT(" %d ,",my_pm->ipv4_address);
248  my_pm++;
249  }
250  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
251 
252  PLATFORM_DEBUG_PRINT("\n adding 6 entries in vector 16-21\n ");
253  len = 6;
254  vec_add2(pm, my_pm, len);
255  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
256  for(i=0;i<len;i++) {
257  my_pm->ipv4_address = 16+i;
258  my_pm++;
259  }
260 
261  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
262  pm_len = vec_len(pm);
263  PLATFORM_DEBUG_PRINT("\n printing vector contents : vec_len = %d \n", pm_len);
264  my_pm = pm;
265  for(i=0;i<pm_len ; i++)
266  {
267  PLATFORM_DEBUG_PRINT(" %d ,",my_pm->ipv4_address);
268  my_pm++;
269  }
270 
271  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
272  PLATFORM_DEBUG_PRINT("\nDeleting 7 entries starting from entry value=8\n");
273  pm_len = vec_len(pm);
274  my_pm = pm;
275  PLATFORM_DEBUG_PRINT(" pm_len =%d\n", pm_len);
276  for(i=0;i<pm_len;i++)
277  {
278  if(my_pm->ipv4_address == 8){
279  PLATFORM_DEBUG_PRINT("\n match found brraeaking..\n");
280  break;
281  }
282  my_pm++;
283  }
284 
285  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p i= %d\n", pm, my_pm, i);
286 // vec_delete(pm, 7, my_pm);
287  vec_delete(pm, 7, i);
288  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
289 
290  PLATFORM_DEBUG_PRINT(" printing entries aftr deletion from 8-14\n");
291  pm_len = vec_len(pm);
292  PLATFORM_DEBUG_PRINT("\n printing vector contents : vec_len = %d \n", pm_len);
293  my_pm = pm;
294  for(i=0;i<pm_len ; i++)
295  {
296  PLATFORM_DEBUG_PRINT(" %d ,",my_pm->ipv4_address);
297  my_pm++;
298  }
299 
300 
301  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
302 
303  PLATFORM_DEBUG_PRINT("\nadding deleted items again 8-14\n");
304  len =7;
305  vec_add2(pm, my_pm, len);
306 
307  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
308  for(i=0;i<len;i++) {
309  my_pm->ipv4_address = 8+i;
310  my_pm++;
311  }
312 
313  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
314  pm_len = vec_len(pm);
315  PLATFORM_DEBUG_PRINT("\n printing vector contents : vec_len = %d \n", pm_len);
316  my_pm = pm;
317  for(i=0;i<pm_len ; i++)
318  {
319  PLATFORM_DEBUG_PRINT(" %d ,",my_pm->ipv4_address);
320  my_pm++;
321  }
322  PLATFORM_DEBUG_PRINT(" pm =%p , my_pm = %p\n", pm, my_pm);
323  PLATFORM_DEBUG_PRINT("\n");
324 }
325 
326 
327 void uidb_mapping_dump_timeout() {
328 
329  u32 i;
330 
331  PLATFORM_DEBUG_PRINT("\nCGSE uidb mapping table \n");
332  for(i = 0;i < 30;i++) {
334  }
335 
336 }
337 
338 void nat64_debug_dump_info(u32 debug_value)
339 {
340 
341  switch(debug_value) {
342 
343  case 1 :
344  bib_add_v6_entry1();
345  break;
346 
347  case 2 :
348  bib_add_v6_entry2();
349  break;
350 
351  case 3 :
352  bib_add_v6_entry1_new();
353  break;
354 
355  case 4 :
356  bib_add_v6_entry1_new_static();
357  break;
358 
359  case 5 :
360  bib_add_v6_entry3();
361  break;
362 
363  case 6 :
364  bib_add_v6_entry_new2();
365  break;
366 
367  case 7 :
368  nat64_fill_table_entry();
369  break;
370 
371  case 10 :
372  nat64_db_dump_main();
373  break;
374 
375  case 11 :
376  nat64_db_dump_user();
377  break;
378 
379  case 12 :
380  nat64_db_dump_session();
381  break;
382 
383  case 13 :
384  nat64_dump_table();
385  break;
386 
387  case 14 :
388  bib_del_v6_entry1_static();
389  break;
390 
391  case 15 :
392  nat64_debug_addr_pool_add_del();
393  break;
394 
395  case 16 :
396  nat64_db_dump_timeout(0);
397  break;
398 
399  case 17 :
400  uidb_mapping_dump_timeout();
401  break;
402 
403  default : break;
404  }
405 }
406 
407 
408 void cnat_debug_flags_set (spp_api_cnat_p2mp_debug_request_t *mp)
409 {
410  u32 debug_variable = spp_net_to_host_byte_order_32(&mp->param[0]);
411  u32 debug_value = spp_net_to_host_byte_order_32(&mp->param[1]);
412 
413  cnat_key_t t_key;
414 
415  switch (debug_variable) {
416 
418  udp_inside_checksum_disable = debug_value;
419  PLATFORM_DEBUG_PRINT("\nudp_inside_checksum_disable set to %d\n", debug_value);
420  break;
421 
423  udp_outside_checksum_disable = debug_value;
424  PLATFORM_DEBUG_PRINT("\nudp_outside_checksum_disable set to %d\n", debug_value);
425  break;
426 
428  udp_outside_packet_dump_enable = debug_value;
429  PLATFORM_DEBUG_PRINT("\nudp_outside_packet_dump_enable set to %d\n", debug_value);
430  break;
431 
433  udp_inside_packet_dump_enable = debug_value;
434  PLATFORM_DEBUG_PRINT("\nudp_inside_packet_dump_enable set to %d\n", debug_value);
435  break;
436 
438  icmp_debug_flag = debug_value;
439  PLATFORM_DEBUG_PRINT("\nicmp_debug_flag set to %d\n", debug_value);
440  break;
441 
443  frag_debug_flag = debug_value;
444  PLATFORM_DEBUG_PRINT("\nfrag_debug_flag set to %d\n", debug_value);
445  break;
446 
448  xlat_config_debug_level = debug_value;
449  PLATFORM_DEBUG_PRINT("\nxlat_config_debug_level set to %d\n", debug_value);
450  break;
451 
453  nat64_config_debug_level = debug_value;
454  PLATFORM_DEBUG_PRINT("\nnat64_config_debug_level set to %d\n", debug_value);
455  nat64_debug_dump_info(debug_value);
456  break;
457 
459  nat64_data_path_debug_level = debug_value;
460  PLATFORM_DEBUG_PRINT("\nnat64_data_path_debug_level set to %d\n", debug_value);
461  break;
462 
464  ds_lite_config_debug_level = debug_value;
465  PLATFORM_DEBUG_PRINT("\nds_lite_config_debug_level set to %d\n", debug_value);
466  break;
467 
469  xlat_data_path_debug_level = debug_value;
470  PLATFORM_DEBUG_PRINT("\nxlat_data_path_debug_level set to %d\n", debug_value);
471  break;
472 
474  config_debug_level = debug_value;
475 
476  PLATFORM_DEBUG_PRINT("\nconfig_debug_level set to %d\n", debug_value);
477  break;
478 
480  cnat_pptp_debug_flag = debug_value;
481 
482  if(debug_value == 0) {
483  pptp_dump_counters();
484  }
485 
486  PLATFORM_DEBUG_PRINT("\ncnat_pptp_debug_level set to %d\n", debug_value);
487  break;
488 
490  cnat_pcp_debug_flag = debug_value;
491 
492  if(debug_value == 0) {
493  pcp_dump_counters();
494  }
495  PLATFORM_DEBUG_PRINT("\ncnat_pcp_debug_level set to %d\n", debug_value);
496  break;
497 
499  global_debug_flag = debug_value;
500  PLATFORM_DEBUG_PRINT("\nglobal_debug_flag set to %d\n", debug_value);
501  break;
502 
504  summary_stats_debug_flag = debug_value;
505  PLATFORM_DEBUG_PRINT("\nsummary_stats_debug_flag set to %d\n", debug_value);
506  break;
507 
509  show_debug_level = debug_value;
510  PLATFORM_DEBUG_PRINT("\nshow_debug_level set to %d\n", debug_value);
511  break;
512 
515  break;
517  v6rd_data_path_debug_level = debug_value;
518  PLATFORM_DEBUG_PRINT("\nv6rd_data_path_debug_level set to %d\n", debug_value);
519  break;
521  v6rd_config_debug_level = debug_value;
522  PLATFORM_DEBUG_PRINT("\nv6rd_config_debug_level set to %d\n", debug_value);
523  break;
525  /* set debug atleast to 1, so that critical errors are always
526  * enabled
527  */
528  v6rd_defrag_debug_level = debug_value ? debug_value : 1;
529  PLATFORM_DEBUG_PRINT("\nv6rd_config_debug_level set to %d\n", debug_value);
530  break;
531 
532 
534  PLATFORM_DEBUG_PRINT("\nChange Static Port Range from %d --> %d\n",
535  cnat_static_port_range, debug_value);
536  cnat_static_port_range = debug_value;
537  break;
538 
540  PLATFORM_DEBUG_PRINT("\n Changing dslite debug flag from %d --> %d\n",
541  dslite_debug_level, debug_value);
542  dslite_debug_level = debug_value;
543  break;
544 
546  nfv9_logging_debug_flag = debug_value;
547  PLATFORM_DEBUG_PRINT("\nnfv9_logging_debug_flag set to %d\n", debug_value);
548  break;
549 
551  syslog_debug_flag = debug_value;
552  PLATFORM_DEBUG_PRINT("\nsyslog_debug_flag set to %d\n", debug_value);
553  break;
554 
556  mape_config_debug_level = debug_value;
557  PLATFORM_DEBUG_PRINT("\nmape_config_debug_level set to %d\n", debug_value);
558  break;
559 
561  mape_data_path_debug_level = debug_value;
562  PLATFORM_DEBUG_PRINT("\nmape_data_path_debug_level set to %d\n", debug_value);
563  break;
564 
566  default:
567  {
568  PLATFORM_DEBUG_PRINT("\nCurrent values of Debug Variables\n");
569  PLATFORM_DEBUG_PRINT("\nTo modify an item chose its index and provide the value\n");
570  PLATFORM_DEBUG_PRINT("\n%d: udp_inside_checksum_disable %d\n",
572  udp_inside_checksum_disable);
573  PLATFORM_DEBUG_PRINT("%d: udp_outside_checksum_disable %d\n",
575  udp_outside_checksum_disable);
576  PLATFORM_DEBUG_PRINT("%d: udp_inside_packet_dump_enable %d\n",
578  udp_inside_packet_dump_enable);
579  PLATFORM_DEBUG_PRINT("%d: udp_outside_packet_dump_enable %d\n",
581  udp_outside_packet_dump_enable);
582  PLATFORM_DEBUG_PRINT("%d: icmp_debug_flag %d\n",
584  icmp_debug_flag);
585  PLATFORM_DEBUG_PRINT("%d: frag_debug_flag %d\n",
587  frag_debug_flag);
588  PLATFORM_DEBUG_PRINT("%d: config_debug_level %d\n",
590  config_debug_level);
591  PLATFORM_DEBUG_PRINT("%d: global_debug_flag %d\n",
593  global_debug_flag);
594  PLATFORM_DEBUG_PRINT("%d: summary_stats_debug_flag %d\n",
596  summary_stats_debug_flag);
597  PLATFORM_DEBUG_PRINT("%d: show_debug_level %d\n",
600  PLATFORM_DEBUG_PRINT("%d: xlat_config_debug_level %d\n",
602  xlat_config_debug_level);
603  PLATFORM_DEBUG_PRINT("%d: xlat_data_path_debug_level %d\n",
605  xlat_data_path_debug_level);
606  PLATFORM_DEBUG_PRINT("%d: tcp_logging_enable_flag %d\n",
608  tcp_logging_enable_flag);
609  PLATFORM_DEBUG_PRINT(" tcp_logging_enable_options DISABLE %d, ENABLE %d, PKT_DUMP %d, SUMMARY_DUMP %d\n",
612  PLATFORM_DEBUG_PRINT("%d: nfv9_logging_debug_flag %d\n",
614  nfv9_logging_debug_flag);
615  PLATFORM_DEBUG_PRINT("%d: syslog_debug_flag %d\n",
617  syslog_debug_flag);
618  PLATFORM_DEBUG_PRINT("%d: cnat_static_port_range %d\n",
621  PLATFORM_DEBUG_PRINT("%d: v6rd_data_path_debug_level %d\n",
623  v6rd_data_path_debug_level);
624  PLATFORM_DEBUG_PRINT("%d: v6rd_config_debug_level %d\n",
626  v6rd_config_debug_level);
627  PLATFORM_DEBUG_PRINT("%d: v6rd_defrag_debug_level %d\n",
629  v6rd_defrag_debug_level);
630  PLATFORM_DEBUG_PRINT("%d: nat64_stful_debug %d\n",
633  PLATFORM_DEBUG_PRINT("%d: nat64_data_path_debug_level %d\n",
636  PLATFORM_DEBUG_PRINT("%d: dslite_debug_level %d\n",
639  PLATFORM_DEBUG_PRINT("%d: ds_lite_config_debug_level %d\n",
642  PLATFORM_DEBUG_PRINT("%d: mape_config_debug_level %d\n",
644  mape_config_debug_level);
645  PLATFORM_DEBUG_PRINT("%d: mape_data_path_debug_level %d\n",
647  mape_data_path_debug_level);
648  }
649  break;
650  }
651 }
652 
653 extern void dump_cnat_frag_stats(void);
654 
655 void spp_api_cnat_p2mp_debug_request_t_handler
656 (spp_api_cnat_p2mp_debug_request_t *mp)
657 {
658  u16 command_type;
659 
660 /*
661  if (mp->core_num != my_instance_number) {
662  mp->rc = CNAT_NOT_THIS_CORE;
663  return;
664  }
665 */
666 
667  command_type = spp_net_to_host_byte_order_16(&mp->dump_type);
668  PLATFORM_DEBUG_PRINT("-->> Core%d: Received debug msg ... cmd type: %d\n",
669  my_instance_number, command_type);
670 
671  switch (command_type) {
672 
674  PLATFORM_DEBUG_PRINT("Core%d: policy\n", my_instance_number);
676  break;
677 
679  PLATFORM_DEBUG_PRINT("Core%d: Main db\n", my_instance_number);
681  break;
682 
684  PLATFORM_DEBUG_PRINT("Core%d: Main db Summary\n", my_instance_number);
686  break;
687 
689  PLATFORM_DEBUG_PRINT("Core%d: User db\n", my_instance_number);
691  break;
692 
694  PLATFORM_DEBUG_PRINT("Core%d: User db Summary\n", my_instance_number);
696  break;
697 
699  PLATFORM_DEBUG_PRINT("Core%d: Hashes db\n", my_instance_number);
701  break;
702 
704  PLATFORM_DEBUG_PRINT("Core%d: Vrf map \n", my_instance_number);
706  break;
707 
709  PLATFORM_DEBUG_PRINT("Core%d: dump summary DB \n", my_instance_number);
710  cnat_db_summary();
711  break;
712 
714  PLATFORM_DEBUG_PRINT("Core%d: dump stats \n", my_instance_number);
715  spp_node_print_stats(1, NULL);
716  break;
717 
718  /* Currently does same as clear node ctr, may change */
720  PLATFORM_DEBUG_PRINT("Core%d: clear stats \n", my_instance_number);
721  spp_node_clear_stats();
722  break;
723 
724  case CNAT_DEBUG_SPP_LOG:
725  PLATFORM_DEBUG_PRINT("Core%d: SPP LOG \n", my_instance_number);
726  spp_log_p2mp_req(mp);
727  break;
728 
730  PLATFORM_DEBUG_PRINT("Core%d: NODE Counter dump \n", my_instance_number);
731  spp_node_print_counters();
732  break;
733 
735  PLATFORM_DEBUG_PRINT("Core%d: clear node counter \n", my_instance_number);
736  spp_node_clear_stats();
737  break;
738 
740  PLATFORM_DEBUG_PRINT("Core%d: CNAT Counter dump \n", my_instance_number);
741  spp_node_print_cnat_counters();
742  break;
743 
745  PLATFORM_DEBUG_PRINT("Core%d: VA dump \n", my_instance_number);
746  {
747  int argc = 1;
748  u32 arg[2] = {spp_net_to_host_byte_order_32(&mp->param[0]), 0};
749 
750  cnat_va_dump(argc, arg);
751  }
752  break;
753 
755  PLATFORM_DEBUG_PRINT("Core%d: Show config dump \n", my_instance_number);
756  {
757  int argc = 0;
758  unsigned long arg[3];
759 
760  if (arg[argc++] = spp_net_to_host_byte_order_32(&mp->param[0])) {
761  if (arg[argc++] = spp_net_to_host_byte_order_32(&mp->param[1])) {
762  ;
763  } else {
764  argc--;
765  }
766  }
767 
768  cnat_show_cdb_command_v2(argc, arg);
769 /*
770  xlat_show_config();
771  cnat_alg_show();
772 */
773  v6rd_show_config();
775  nat64_dump_table();
776  mape_show_config();
777  }
778  break;
779 
781  PLATFORM_DEBUG_PRINT("Core%d: NFv9 dump \n", my_instance_number);
782  #if 0 /* Currently not calling this */
783  cnat_nfv9_show_cmd();
784  #endif
785  break;
786 
788  PLATFORM_DEBUG_PRINT("Core%d: IVRF dump \n", my_instance_number);
789  {
790  int argc = 0;
791  unsigned long arg[3];
792 
793  if (arg[argc++] = spp_net_to_host_byte_order_32(&mp->param[0])) {
794  if (arg[argc++] = spp_net_to_host_byte_order_32(&mp->param[1])) {
795  if (arg[argc++] = spp_net_to_host_byte_order_32(&mp->param[2])) {
796  ;
797  } else {
798  argc--;
799  }
800  } else {
801  argc--;
802  }
803  }
804 
805 
806  PLATFORM_DEBUG_PRINT("VRF: %d \n", spp_net_to_host_byte_order_32(&mp->param[0]));
807  PLATFORM_DEBUG_PRINT("2nd arg: %d \n",
808  spp_net_to_host_byte_order_32(&mp->param[1]));
809 
810  cnat_show_ivrf_command_v2(argc, arg);
811  }
812  break;
813 
815  PLATFORM_DEBUG_PRINT("Core%d: OVRF dump \n", my_instance_number);
816  {
817  int argc = 0;
818  unsigned long arg[3];
819  if (arg[argc++] = spp_net_to_host_byte_order_32(&mp->param[0])) {
820  if (arg[argc++] = spp_net_to_host_byte_order_32(&mp->param[1])) {
821  if (arg[argc++] = spp_net_to_host_byte_order_32(&mp->param[2])) {
822  ;
823  } else {
824  argc--;
825  }
826  } else {
827  argc--;
828  }
829  }
830 
831  PLATFORM_DEBUG_PRINT("VRF: %d \n", spp_net_to_host_byte_order_32(&mp->param[0]));
832  PLATFORM_DEBUG_PRINT("2nd arg: %d \n",
833  spp_net_to_host_byte_order_32(&mp->param[1]));
834 
835  cnat_show_ovrf_command_v2(argc, arg);
836  }
837  break;
838 
840  PLATFORM_DEBUG_PRINT("Core%d: Debug option dump \n", my_instance_number);
841  {
842  global_pd_dbg_lvl = 0;
843  global_pi_dbg_lvl = 0;
844  global_l2_dbg_lvl = 0;
845 
846  global_pd_dbg_lvl =
847  spp_net_to_host_byte_order_32(&mp->param[0]);
848  global_pi_dbg_lvl =
849  spp_net_to_host_byte_order_32(&mp->param[1]);
850  global_l2_dbg_lvl =
851  spp_net_to_host_byte_order_32(&mp->param[2]);
852 
853  PLATFORM_DEBUG_PRINT("global_pd_dbg_lvl: %d, global_pi_dbg_lvl: %d, global_l2_dbg_lvl: %d\n",
854  global_pd_dbg_lvl, global_pi_dbg_lvl, global_l2_dbg_lvl);
855  }
856  break;
857 
859  PLATFORM_DEBUG_PRINT("Core%d: PD Debug level: %d \n", my_instance_number, global_pd_dbg_lvl);
860  PLATFORM_DEBUG_PRINT("Core%d: PI Debug level: %d \n", my_instance_number, global_pi_dbg_lvl);
861  PLATFORM_DEBUG_PRINT("Core%d: L2 Debug level: %d \n", my_instance_number, global_l2_dbg_lvl);
862  break;
863 
865  PLATFORM_DEBUG_PRINT("Core%d: Debug flags \n", my_instance_number);
866  cnat_debug_flags_set(mp);
867  break;
868 
872  break;
873 
875 
877 #ifdef TARGET_RODDICK
879  spp_net_to_host_byte_order_32(&mp->param[0]);
880 #endif
881  break;
882 
885  break;
886 
887  /* This option has to be removed later */
889  PLATFORM_DEBUG_PRINT("\nSetting bulk size to %d\n",
890  spp_net_to_host_byte_order_32(&mp->param[0]));
891  set_bulk_size_to_all_vrfs(
892  spp_net_to_host_byte_order_32(&mp->param[0]));
893  break;
894 
897  break;
898 
901  break;
902 
904  {
905  u16 in_vrfid = spp_net_to_host_byte_order_32(&mp->param[0]);
906  u32 inside_ip = spp_net_to_host_byte_order_32(&mp->param[1]);
907  show_bulk_port_allocation(in_vrfid, inside_ip);
908  }
909  break;
910 
912  dump_cnat_frag_stats();
913  break;
914 
915  default:
916  mp->rc = CNAT_ERR_INVALID_MSG_ID;
917  break;
918  }
919 
920  mp->rc = CNAT_SUCCESS;
921  return;
922 }
923 
924 
925 void spp_api_cnat_v4_debug_in2out_private_addr_t_handler
926 (spp_api_cnat_v4_debug_in2out_private_addr_t *mp)
927 {
928  u16 i_vrf;
929  u32 debug_flag;
930  u32 start_addr, end_addr;
931 
932 
933  start_addr =
934  spp_net_to_host_byte_order_32(&mp->start_addr);
935  end_addr =
936  spp_net_to_host_byte_order_32(&mp->end_addr);
937  i_vrf =
938  spp_net_to_host_byte_order_16(&mp->i_vrf);
939  debug_flag =
940  spp_net_to_host_byte_order_32(&mp->debug_flag);
941 
942  if ((i_vrf > MAX_UIDX) || (start_addr > end_addr) ||
943  ((debug_flag != CNAT_DEBUG_NONE) &&
944  ((debug_flag & CNAT_DEBUG_ALL) == CNAT_DEBUG_NONE))) {
945  mp->rc = CNAT_ERR_PARSER;
946  PLATFORM_DEBUG_PRINT("invalid debug ivrf 0x%x flag 0x%x "
947  "start addr 0x%x end addr 0x%x\n",
948  i_vrf, debug_flag,
949  start_addr, end_addr);
950  return;
951  }
952 
953  PLATFORM_DEBUG_PRINT("debug ivrf 0x%x flag 0x%x "
954  "start addr 0x%x end addr 0x%x\n",
955  i_vrf, debug_flag,
956  start_addr, end_addr);
957 
958  mp->rc = CNAT_SUCCESS;
959  debug_i_vrf = i_vrf;
960  debug_i_flag = debug_flag;
961  debug_i_addr_start = start_addr;
962  debug_i_addr_end = end_addr;
963 
964 }
965 
966 void spp_api_cnat_v4_debug_out2in_public_addr_t_handler
967 (spp_api_cnat_v4_debug_out2in_public_addr_t *mp)
968 {
969  u16 o_vrf;
970  u32 debug_flag;
971  u32 start_addr, end_addr;
972 
973  start_addr =
974  spp_net_to_host_byte_order_32(&mp->start_addr);
975  end_addr =
976  spp_net_to_host_byte_order_32(&mp->end_addr);
977  o_vrf =
978  spp_net_to_host_byte_order_16(&mp->o_vrf);
979  debug_flag =
980  spp_net_to_host_byte_order_32(&mp->debug_flag);
981 
982  if ((o_vrf > MAX_UIDX) || (start_addr > end_addr) ||
983  ((debug_flag != CNAT_DEBUG_NONE) &&
984  ((debug_flag & CNAT_DEBUG_ALL) == CNAT_DEBUG_NONE))) {
985  mp->rc = CNAT_ERR_PARSER;
986  PLATFORM_DEBUG_PRINT("invalid debug ovrf 0x%x flag 0x%x "
987  "start addr 0x%x end addr 0x%x\n",
988  o_vrf, debug_flag,
989  start_addr, end_addr);
990  return;
991  }
992 
993  mp->rc = CNAT_SUCCESS;
994  debug_o_vrf = o_vrf;
995  debug_o_flag = debug_flag;
996  debug_o_addr_start = start_addr;
997  debug_o_addr_end = end_addr;
998 
999  PLATFORM_DEBUG_PRINT(" o2i debug currently is not supported\n");
1000 }
1001 
1002 void nat64_reset_session_expiry(nat64_bib_entry_t *db)
1003 {
1004  NAT64_STFUL_DEBUG_PRINT(3, " invoking nat64_clean_bib_db_entry\n " );
1005  nat64_clean_bib_db_entry(db);
1006  NAT64_STFUL_DEBUG_PRINT(3, "done with clean_bib_db_entry\n " );
1007 }
1008 
1009 void spp_api_nat64_clear_db_request_t_handler
1010 (spp_api_nat64_clear_db_request_t *mp)
1011 {
1012  u16 port, proto, flag;
1013  u32 index;
1014  u32 i;
1015  nat64_bib_entry_t* db;
1016  nat64_v6_key_t ki;
1017  nat64_table_entry_t *my_nat64_table_db_ptr;
1018  u16 nat64_id;
1019 
1020  NAT64_STFUL_FUNC_ENTER;
1021  NAT64_STFUL_DEBUG_DUMP_MSG(mp);
1022 
1023  nat64_id = spp_net_to_host_byte_order_16(&mp->nat64_id);
1024  my_nat64_table_db_ptr = nat64_table_ptr + nat64_id;
1025 
1026  port = spp_net_to_host_byte_order_16(&mp->port_num);
1027  proto = mp->protocol;
1028 
1029  ki.vrf = nat64_id;
1030  ki.vrf |= ((u16)proto << CNAT_PRO_SHIFT);
1031 
1032  for(i =0 ; i< 4 ; i++)
1033  ki.ipv6[i] = spp_net_to_host_byte_order_32(&mp->ip_addr[i]);
1034 
1035  ki.port = port;
1036 
1037  flag = mp->flags;
1038 
1039  mp->rc = CNAT_SUCCESS;
1040 
1041  NAT64_STFUL_DEBUG_PRINT(3, "\n Nat64_id = %d, port =%d, \
1042  proto =%d, flags=0x%08X",\
1043  nat64_id, port, proto, flag);
1044 
1045  NAT64_STFUL_DEBUG_PRINT(3, "\n IPv6 Addr = %08X : %08X: %08X: %08X",\
1046  ki.ipv6[0], ki.ipv6[1], ki.ipv6[2], ki.ipv6[3]);
1047 
1048  if (flag == CNAT_DB_CLEAR_SPECIFIC) {
1049  NAT64_STFUL_DEBUG_PRINT(3, "\n clear specific \n");
1050 
1051  db = nat64_bib_db_lookup_entry(&ki);
1052  if (db == NULL) {
1053  NAT64_STFUL_DEBUG_PRINT(3, "\n clear specific - not present\n");
1054  mp->rc = CNAT_NOT_FOUND_ANY;
1055  return;
1056  }
1057 
1058  if( !(db->flags & CNAT_DB_NAT64_FLAG) ||
1059  (db->nat64_inst_id != nat64_id))
1060  return;
1061 
1062 
1063  nat64_reset_session_expiry(db);
1064  return;
1065  }
1066 
1068 
1069  for(index = 0; index < vec_len(nat64_bib_db); index++) {
1070 
1071  /* check is it nat44, if yes skip , do it n nat44 as well */
1072 
1073  if (PREDICT_FALSE(!clib_bitmap_get(p->free_bitmap, index))) {
1074  db = nat64_bib_db + index;
1075 
1076  if( !(db->flags & CNAT_DB_NAT64_FLAG) ||
1077  (db->nat64_inst_id != nat64_id))
1078  continue;
1079 
1080  if (flag == CNAT_DB_CLEAR_ALL) {
1081  nat64_reset_session_expiry(db);
1082  continue;
1083  }
1084 
1085  if (flag & CNAT_DB_CLEAR_ADDR) {
1086  if ((db->v6_in_key.ipv6[0] != ki.ipv6[0]) ||
1087  (db->v6_in_key.ipv6[1] != ki.ipv6[1]) ||
1088  (db->v6_in_key.ipv6[2] != ki.ipv6[2]) ||
1089  (db->v6_in_key.ipv6[3] != ki.ipv6[3])){
1090  NAT64_STFUL_DEBUG_PRINT(3, "\n%s:%d\n", __FUNCTION__, \
1091  __LINE__ );
1092  continue;
1093  }
1094  }
1095 
1096  if (flag & CNAT_DB_CLEAR_PROTO) {
1097  if (((db->v6_in_key.vrf & CNAT_PRO_MASK) >> CNAT_PRO_SHIFT)
1098  != proto) {
1099  NAT64_STFUL_DEBUG_PRINT(3, "\n%s:%d\n", __FUNCTION__, \
1100  __LINE__ );
1101  continue;
1102  }
1103  }
1104 
1105  if (flag & CNAT_DB_CLEAR_PORT) {
1106  if (db->v6_in_key.port != port) {
1107  NAT64_STFUL_DEBUG_PRINT(3, "\n%s:%d\n", __FUNCTION__, \
1108  __LINE__ );
1109  continue;
1110  }
1111  }
1112 
1113  NAT64_STFUL_DEBUG_PRINT(3, "\n%s:%d\n", __FUNCTION__, \
1114  __LINE__ );
1115  /*
1116  * Delete if the db entry matches and it is not a
1117  */
1118  nat64_reset_session_expiry(db);
1119  }
1120  }
1121 }
1122 
1123 void inline cnat_clear_session_db(cnat_main_db_entry_t *db)
1124 {
1125  if(PREDICT_FALSE(db->nsessions > 1)) {
1126  u32 session_index = db->session_head_index;
1127  cnat_session_entry_t *sdb;
1128  do {
1129  sdb = cnat_session_db + session_index;
1130  if(PREDICT_FALSE(!sdb)) {
1131  //TO DO: Debug msg?
1132  break;
1133  }
1134  sdb->entry_expires = 0;
1135  session_index = sdb->main_list.next;
1136  } while(session_index != db->session_head_index
1137  && db->session_head_index != EMPTY);
1138  }
1139  return;
1140 }
1141 
1142 #ifdef CGSE_DS_LITE
1143 extern dslite_table_entry_t dslite_table_array[];
1144 
1145 void spp_api_ds_lite_clear_db_request_t_handler
1146 (spp_api_ds_lite_clear_db_request_t *mp)
1147 {
1148  u16 port, proto, flag;
1149  u32 index;
1150  u32 i;
1152  cnat_user_db_entry_t *udb;
1153  dslite_key_t ki;
1154  dslite_table_entry_t *my_table_db_ptr;
1155  u16 id;
1156  u16 i_vrf;
1157 
1158 
1159  id = spp_net_to_host_byte_order_16(&mp->ds_lite_id);
1160  id = DS_LITE_CONFIG_TO_ARRAY_ID(id);
1161 
1162  my_table_db_ptr = &dslite_table_array[id];
1163  i_vrf = my_table_db_ptr->i_vrf;
1164 
1165  port = spp_net_to_host_byte_order_16(&mp->port_num);
1166  proto = mp->protocol;
1167 
1168  ki.ipv4_key.k.vrf = i_vrf;
1169  ki.ipv4_key.k.vrf |= ((u16)proto << CNAT_PRO_SHIFT);
1170 
1171  for(i =0 ; i< 4 ; i++)
1172  ki.ipv6[i] = spp_net_to_host_byte_order_32(&mp->ip_addr[i]);
1173 
1174  ki.ipv4_key.k.port = port;
1175 
1176  flag = mp->flags;
1177 
1178  mp->rc = CNAT_SUCCESS;
1179 
1180  DSLITE_PRINTF(3, "\n dslite id = %d, port =%d"
1181  "proto =%d, flags=0x%08X",\
1182  id, port, proto, flag);
1183 
1184  DSLITE_PRINTF(3, "\n IPv6 Addr = %08X : %08X: %08X: %08X",\
1185  ki.ipv6[0], ki.ipv6[1], ki.ipv6[2], ki.ipv6[3]);
1186 
1187  if (flag == CNAT_DB_CLEAR_SPECIFIC) {
1188  DSLITE_PRINTF(3, "\n Clear specific NOT supported for DS Lite \n");
1189  return;
1190  }
1191 
1193 
1194  for(index = 0; index < vec_len(cnat_main_db); index++) {
1195 
1196  /* check is it dslite entry, if not skip */
1197 
1198  if (PREDICT_FALSE(!clib_bitmap_get(p->free_bitmap, index))) {
1199  db = cnat_main_db + index;
1200 
1201  if( !(db->flags & CNAT_DB_DSLITE_FLAG) ||
1202  ((db->in2out_key.k.vrf & CNAT_VRF_MASK) != i_vrf) ||
1203  (db->flags & CNAT_DB_FLAG_STATIC_PORT)) {
1204  continue;
1205  }
1206 
1207  if (flag == CNAT_DB_CLEAR_ALL) {
1208 
1209  /*
1210  * Make the entry time as very old (0), and wait
1211  * for a timeout to auto-expire the entry.
1212  */
1213  db->entry_expires = 0;
1214  /* Handle sessions as well.. */
1215  cnat_clear_session_db(db);
1216  continue;
1217  }
1218 
1219  if (flag & CNAT_DB_CLEAR_ADDR) {
1220  udb = cnat_user_db + db->user_index;
1221  if(PREDICT_FALSE(!udb)) {
1222  continue;
1223  }
1224  if ((udb->ipv6[0] != ki.ipv6[0]) ||
1225  (udb->ipv6[1] != ki.ipv6[1]) ||
1226  (udb->ipv6[2] != ki.ipv6[2]) ||
1227  (udb->ipv6[3] != ki.ipv6[3])) {
1228  continue;
1229  }
1230  }
1231 
1232  if (flag & CNAT_DB_CLEAR_PROTO) {
1233  if (((db->in2out_key.k.vrf & CNAT_PRO_MASK) >> CNAT_PRO_SHIFT)
1234  != proto) {
1235  continue;
1236  }
1237  }
1238 
1239  if (flag & CNAT_DB_CLEAR_PORT) {
1240  if (db->in2out_key.k.port != port) {
1241  continue;
1242  }
1243  }
1244 
1245  /*
1246  * Mark for expiry in the next round of DB scan
1247  */
1248  db->entry_expires = 0;
1249  /* Handle sessions as well.. */
1250  cnat_clear_session_db(db);
1251  }
1252  }
1253 }
1254 #endif /* #ifdef CGSE_DS_LITE */
1255 
1256 void spp_api_cnat_clear_db_request_t_handler
1257 (spp_api_cnat_clear_db_request_t *mp)
1258 {
1259  u16 i_vrf, port, proto, flag;
1260  u32 ip_addr, index;
1261  u64 a,b,c;
1262  cnat_main_db_entry_t * db;
1264 
1265 #if defined(TARGET_LINUX_UDVR) || defined(CNAT_PG)
1266  i_vrf = mp->inside_vrf;
1267  ip_addr = mp->ip_addr;
1268  port = mp->port_num;
1269  proto = mp->protocol;
1270 #else
1271  i_vrf = spp_net_to_host_byte_order_16(&mp->inside_vrf);
1272  ip_addr = spp_net_to_host_byte_order_32(&mp->ip_addr);
1273  port = spp_net_to_host_byte_order_16(&mp->port_num);
1274  proto = spp_net_to_host_byte_order_16(&mp->protocol);
1275 #endif
1276 
1277 
1278 
1279  ki.k.k.vrf = i_vrf;
1280  ki.k.k.vrf |= ((u16)proto << CNAT_PRO_SHIFT);
1281  ki.k.k.ipv4 = ip_addr;
1282  ki.k.k.port = port;
1283 
1284  flag = mp->wildcard;
1285 
1286  mp->rc = CNAT_SUCCESS;
1287 
1288  if (flag == CNAT_DB_CLEAR_SPECIFIC) {
1290  ki.bucket,
1292  index = cnat_in2out_hash[ki.bucket].next;
1293  if (PREDICT_TRUE(index == EMPTY)) {
1294  mp->rc = CNAT_NOT_FOUND_ANY;
1295  return;
1296  }
1297 
1298  do {
1299  db = cnat_main_db + index;
1300 
1301  /*
1302  * Delete if the db entry matches and it is not a
1303  * STATIC port entry
1304  */
1305  if ((db->in2out_key.key64 == ki.k.key64) &&
1306  !(db->flags & CNAT_DB_FLAG_STATIC_PORT) &&
1307  !(db->flags & CNAT_DB_NAT64_FLAG) &&
1308  !(db->flags & CNAT_DB_DSLITE_FLAG)) {
1309 
1310  /*
1311  * Make the entry time as very old (0), and wait
1312  * for a timeout to auto-expire the entry.
1313  */
1314  db->entry_expires = 0;
1315  /* Handle sessions as well.. */
1316  cnat_clear_session_db(db);
1317  return;
1318  }
1319  index = db->in2out_hash.next;
1320  } while (index != EMPTY);
1321 
1322  mp->rc = CNAT_NOT_FOUND_ANY;
1323  return;
1324  }
1325 
1327 
1328  for(index = 0; index < vec_len(cnat_main_db); index++) {
1329 
1330  if (PREDICT_TRUE(!clib_bitmap_get(p->free_bitmap, index))) {
1331  db = cnat_main_db + index;
1332 
1334  continue;
1335  }
1336 
1338  continue;
1339  }
1340 
1341  if (flag == CNAT_DB_CLEAR_ALL) {
1342  if (!(db->flags & CNAT_DB_FLAG_STATIC_PORT)) {
1343  db->entry_expires = 0;
1344  /* Handle sessions as well.. */
1345  cnat_clear_session_db(db);
1346  }
1347  continue;
1348  }
1349 
1350  if (flag & CNAT_DB_CLEAR_VRF) {
1351  if (((db->in2out_key.k.vrf & CNAT_VRF_MASK) != i_vrf)) {
1352  continue;
1353  }
1354  }
1355 
1356  if (flag & CNAT_DB_CLEAR_ADDR) {
1357  if ((db->in2out_key.k.ipv4 != ip_addr)) {
1358  continue;
1359  }
1360  }
1361 
1362  if (flag & CNAT_DB_CLEAR_PROTO) {
1363  if (((db->in2out_key.k.vrf & CNAT_PRO_MASK) >> CNAT_PRO_SHIFT)
1364  != proto) {
1365  continue;
1366  }
1367  }
1368 
1369  if (flag & CNAT_DB_CLEAR_PORT) {
1370  if (db->in2out_key.k.port != port) {
1371  continue;
1372  }
1373  }
1374 
1375  /*
1376  * Delete if the db entry matches and it is not a
1377  * STATIC port entry
1378  */
1379  if (!(db->flags & CNAT_DB_FLAG_STATIC_PORT)) {
1380  db->entry_expires = 0;
1381  /* Handle sessions as well.. */
1382  cnat_clear_session_db(db);
1383  }
1384  }
1385  }
1386 }
1387 
1388 void
1389 spp_api_cnat_generic_command_debug (cnat_generic_command_resp *mp_resp)
1390 {
1391 #ifdef SHOW_DEBUG
1392  u32 i, j;
1393 
1394  i = spp_net_to_host_byte_order_32(&(mp_resp->num_bytes));
1395 
1396  PLATFORM_DEBUG_PRINT("\nNum_Bytes %d\n", i);
1397 
1398  for (j = 0; j < i; j++) {
1399  PLATFORM_DEBUG_PRINT("0x%02X ", mp_resp->raw_data[j]);
1400  if ((j % 16) == 15) {
1401  PLATFORM_DEBUG_PRINT("\n");
1402  }
1403  }
1404 #endif
1405 }
1406 
1407 /*
1408  * The following commands implements command to dump the
1409  * user-db information
1410  * port-map information
1411  * for a give user source IP address
1412  *
1413  * The format of the output is:
1414  * Word 0: Address of udb
1415  * Word 1: udb->translation_list_head_index
1416  * Word 2:
1417  * Bytes 0..1: udb->ntranslations
1418  * Bytes 2..2: udb->icmp_msg_coung
1419  * Bytes 3..3: udb->unused
1420  * Word 3: udb->portmap_index
1421  * Word 4: udb->key.k.ipv4
1422  * Word 5:
1423  * Bytes 0..1: udb->key.k.port = 0
1424  * Bytes 2..3: udb->key.k.vrf
1425  * Word 6: udb->user_hash
1426  * Word 7: Address of my_pm
1427  * Word 8: my_pm->status
1428  * Word 9: my_pm->inuse
1429  * Word A: my_pm->delete_time
1430  * Word B: my_pm->ipv4_address
1431  */
1432 void spp_api_cnat_generic_command_user_db_pm
1433 (spp_api_cnat_generic_command_request_t *mp)
1434 {
1435  u32 i;
1436  cnat_db_key_bucket_t u_ki;
1437  u16 my_vrfmap_index;
1438  u32 *result_array;
1439  cnat_generic_command_resp *mp_resp;
1440  cnat_user_db_entry_t *udb;
1441  cnat_user_db_entry_t *mp_udb;
1442  cnat_vrfmap_t *my_vrfmap;
1443  cnat_portmap_v2_t *pm;
1444  cnat_portmap_v2_t *my_pm;
1445 
1446  /*
1447  * Request structure is used to send the response
1448  */
1449  mp_resp = (cnat_generic_command_resp *) mp;
1450 
1451  u_ki.k.k.vrf = spp_net_to_host_byte_order_32(&mp->params[1]);
1452  u_ki.k.k.ipv4 = spp_net_to_host_byte_order_32(&mp->params[2]);
1453  u_ki.k.k.port = 0;
1454 
1455  udb = cnat_user_db_lookup_entry(&u_ki);
1456 
1457  if (!udb) {
1458  mp_resp->num_bytes = spp_host_to_net_byte_order_32(0);
1459  goto no_udb_found;
1460  }
1461 
1462  result_array = (u32 *) (&(mp_resp->raw_data[0]));
1463 
1464  i = 0;
1465  result_array[i++] = spp_host_to_net_byte_order_32((u32) udb);
1466 
1467  mp_udb = (cnat_user_db_entry_t *) &(result_array[i]);
1468 
1469  /*
1470  * Align the entry to the next 4 byte boundary
1471  */
1472  i = i + ((sizeof(cnat_user_db_entry_t)+3)/4);
1473 
1474  /*
1475  * Fill in the UDB information
1476  */
1477  mp_udb->translation_list_head_index =
1478  spp_host_to_net_byte_order_32(udb->translation_list_head_index);
1479  mp_udb->ntranslations =
1480  spp_host_to_net_byte_order_16(udb->ntranslations);
1481  mp_udb->icmp_msg_count = udb->icmp_msg_count;
1482  mp_udb->flags = udb->flags;
1483  mp_udb->portmap_index =
1484  spp_host_to_net_byte_order_32(udb->portmap_index);
1485  mp_udb->key.k.ipv4 =
1486  spp_host_to_net_byte_order_32(udb->key.k.ipv4);
1487  mp_udb->key.k.port =
1488  spp_host_to_net_byte_order_16(udb->key.k.port);
1489  mp_udb->key.k.vrf =
1490  spp_host_to_net_byte_order_16(udb->key.k.vrf);
1491  mp_udb->user_hash.next =
1492  spp_host_to_net_byte_order_32(udb->user_hash.next);
1493 
1494  my_vrfmap_index = vrf_map_array[u_ki.k.k.vrf];
1495  my_vrfmap = cnat_map_by_vrf + my_vrfmap_index;
1496  pm = my_vrfmap->portmap_list;
1497  my_pm = pm + udb->portmap_index;
1498 
1499  /*
1500  * Fill in the port_map information
1501  */
1502  result_array[i++] = spp_host_to_net_byte_order_32((u32) my_pm);
1503  result_array[i++] = spp_host_to_net_byte_order_32(my_pm->inuse);
1504  result_array[i++] = spp_host_to_net_byte_order_32(my_pm->delete_time);
1505  result_array[i++] = spp_host_to_net_byte_order_32(my_pm->ipv4_address);
1506 
1507  mp_resp->num_bytes = spp_host_to_net_byte_order_32(i*4);
1508 
1509 no_udb_found:
1510  spp_api_cnat_generic_command_debug(mp_resp);
1511 }
1512 
1513 /*
1514  * The following commands implements command to dump the
1515  * DB usage stats for
1516  * main-db
1517  * user-db
1518  * in2out hash
1519  * out2in hash
1520  *
1521  * The format of the output is:
1522  * Word 0: Main-DB - Total
1523  * Word 1: Main-DB - Active
1524  * Word 2: Main-DB - Free
1525  * Word 3: User-DB - Total
1526  * Word 4: User-DB - Active
1527  * Word 5: User-DB - Free
1528  * Word 6: Hash In2Out - Size
1529  * Word 7: Hash In2Out - Used
1530  * Word 8: Hash In2Out - Used Percentage
1531  * Word 9: Hash Out2In - Size
1532  * Word A: Hash Out2In - Used
1533  * Word B: Hash Out2In - Used Percentage
1534  */
1535 void spp_api_cnat_generic_command_db_summary
1536 (spp_api_cnat_generic_command_request_t *mp)
1537 {
1538  u32 count1, count2, count3;
1539  u32 i = 0;
1540  u32 k = 0;
1541  cnat_generic_command_resp *mp_resp;
1542  u32 *result_array;
1543 
1544  /*
1545  * Request structure is used to send the response
1546  */
1547  mp_resp = (cnat_generic_command_resp *) mp;
1548  result_array = (u32 *) (&(mp_resp->raw_data[0]));
1549 
1550  /*
1551  * Find entries free and used in main-db
1552  */
1553  count1 = vec_len(cnat_main_db);
1554  count2 = db_free_entry(cnat_main_db);
1555  count3 = count1 - count2;
1556 
1557  *(result_array + i++) = spp_host_to_net_byte_order_32(count1);
1558  *(result_array + i++) = spp_host_to_net_byte_order_32(count3);
1559  *(result_array + i++) = spp_host_to_net_byte_order_32(count2);
1560 
1561  /*
1562  * Find entries free and used in user-db
1563  */
1564  count1 = vec_len(cnat_user_db);
1565  count2 = db_free_entry(cnat_user_db);
1566  count3 = count1 - count2;
1567 
1568  *(result_array + i++) = spp_host_to_net_byte_order_32(count1);
1569  *(result_array + i++) = spp_host_to_net_byte_order_32(count3);
1570  *(result_array + i++) = spp_host_to_net_byte_order_32(count2);
1571 
1572  /*
1573  * Find entries used in in2out and out2in hash tables
1574  * and percentage utilization.
1575  */
1576  count1 = count2 = 0;
1577  for (k = 0; k < CNAT_MAIN_HASH_SIZE; k++) {
1578  if(cnat_in2out_hash[k].next != ~0) count1++;
1579  if(cnat_out2in_hash[k].next != ~0) count2++;
1580 
1581  }
1582 
1583  count3 = count1*100/CNAT_MAIN_HASH_SIZE;
1584 
1585  *(result_array + i++) = spp_host_to_net_byte_order_32(CNAT_MAIN_HASH_SIZE);
1586  *(result_array + i++) = spp_host_to_net_byte_order_32(count1);
1587  *(result_array + i++) = spp_host_to_net_byte_order_32(count3);
1588 
1589  count3 = count2*100/CNAT_MAIN_HASH_SIZE;
1590 
1591  *(result_array + i++) = spp_host_to_net_byte_order_32(CNAT_MAIN_HASH_SIZE);
1592  *(result_array + i++) = spp_host_to_net_byte_order_32(count2);
1593  *(result_array + i++) = spp_host_to_net_byte_order_32(count3);
1594 
1595  mp_resp->num_bytes = spp_host_to_net_byte_order_32(i*4);
1596 
1597  spp_api_cnat_generic_command_debug(mp_resp);
1598 }
1599 
1600 /*
1601  * The following commands implements generic commands such as:
1602  *
1603  * Command 1:
1604  * Reads num_bytes octets from a start_locn
1605  * generic command <core_num> <cmd_type=1> <start_locn> <num_bytes> 0 0 0 0 0
1606  *
1607  * Command 2:
1608  * Writes upto 8 octets from a start_locn
1609  * generic command <core_num> <cmd_type=2> <start_locn> <num_bytes> 0 0 0 0 0
1610  *
1611  * Command 3:
1612  * Dump the db summary stats
1613  * generic command <core_num> <cmd_type=3>
1614  *
1615  * Command 4:
1616  * Dump the user db entry
1617  * generic command <core_num> <cmd_type=4> <vrf_id> <src_ip_addr>
1618  *
1619  * The following structures are referenced by this command:
1620  * typedef struct _spp_api_cnat_generic_command_request {
1621  * u16 _spp_msg_id;
1622  * u8 rc;
1623  * u8 core_num;
1624  * u32 params[8];
1625  * } spp_api_cnat_generic_command_request_t;
1626  *
1627  * typedef struct {
1628  * u16 spp_msg_id;
1629  * u8 rc;
1630  * u8 core;
1631  * u32 num_bytes;
1632  * u8 raw_data[0];
1633  * } cnat_generic_command_resp;
1634  *
1635  */
1636 void spp_api_cnat_generic_command_request_t_handler
1637 (spp_api_cnat_generic_command_request_t *mp)
1638 {
1639  cnat_generic_command_resp *resp_ptr;
1640  u32 command_type, start_locn, num_bytes;
1641 
1642  command_type = spp_net_to_host_byte_order_32(&mp->params[0]);
1643  resp_ptr = (cnat_generic_command_resp *) mp;
1644 
1645  switch (command_type) {
1647  start_locn = spp_net_to_host_byte_order_32(&mp->params[1]);
1648  num_bytes = spp_net_to_host_byte_order_32(&mp->params[2]);
1649  clib_memcpy(&(resp_ptr->raw_data[0]), (u8 *) start_locn, num_bytes);
1650  resp_ptr->num_bytes = spp_host_to_net_byte_order_32(num_bytes);
1651 
1652 #ifdef SHOW_DEBUG
1653  {
1654  u32 i;
1655 
1656  for (i = 0; i < num_bytes; i++) {
1657  PLATFORM_DEBUG_PRINT("0x%02X ", resp_ptr->raw_data[i]);
1658  if ((i % 16) == 15) {
1659  PLATFORM_DEBUG_PRINT("\n");
1660  }
1661  }
1662  }
1663 #endif
1664  break;
1665 
1667  start_locn = spp_net_to_host_byte_order_32(&mp->params[1]);
1668  num_bytes = spp_net_to_host_byte_order_32(&mp->params[2]);
1669 
1670  if (num_bytes > sizeof(u64)) {
1671  mp->rc = CNAT_ERR_INVALID_MSG_SIZE;
1672  return;
1673  }
1674 
1675  clib_memcpy((u8 *) start_locn, &(mp->params[3]), num_bytes);
1676  resp_ptr->num_bytes = 0;
1677  break;
1678 
1680  spp_api_cnat_generic_command_db_summary(mp);
1681  break;
1682 
1684  spp_api_cnat_generic_command_user_db_pm(mp);
1685  break;
1686 
1688  spp_api_cnat_get_cgn_db_summary(mp);
1689  break;
1690 
1691  default:
1692  mp->rc = CNAT_ERR_INVALID_MSG_ID;
1693  break;
1694  }
1695 }
1696 
1697 
1698 static int cnat_debug_init (void *notused)
1699 {
1700  spp_msg_api_set_handler(SPP_API_CNAT_V4_DEBUG_DUMMY,
1701  spp_api_cnat_v4_debug_dummy_t_handler);
1702 
1703  spp_msg_api_set_handler(SPP_API_CNAT_V4_DEBUG_DUMMY_MAX,
1704  spp_api_cnat_v4_debug_dummy_max_t_handler);
1705 
1706  spp_msg_api_set_handler(SPP_API_CNAT_V4_DEBUG_GLOBAL,
1707  spp_api_cnat_v4_debug_global_t_handler);
1708 
1709  spp_msg_api_set_handler(SPP_API_CNAT_V4_DEBUG_IN2OUT_PRIVATE_ADDR,
1710  spp_api_cnat_v4_debug_in2out_private_addr_t_handler);
1711 
1712  spp_msg_api_set_handler(SPP_API_CNAT_V4_DEBUG_OUT2IN_PUBLIC_ADDR,
1713  spp_api_cnat_v4_debug_out2in_public_addr_t_handler);
1714 
1715  spp_msg_api_set_handler(SPP_API_CNAT_CLEAR_DB_REQUEST,
1716  spp_api_cnat_clear_db_request_t_handler);
1717 
1718  spp_msg_api_set_handler(SPP_API_CNAT_GENERIC_COMMAND_REQUEST,
1719  spp_api_cnat_generic_command_request_t_handler);
1720 
1721  spp_msg_api_set_handler(SPP_API_CNAT_P2MP_DEBUG_REQUEST,
1722  spp_api_cnat_p2mp_debug_request_t_handler);
1723 
1724  spp_msg_api_set_handler(SPP_API_NAT64_CLEAR_DB_REQUEST,
1725  spp_api_nat64_clear_db_request_t_handler);
1726 
1727  spp_msg_api_set_handler(SPP_API_DS_LITE_CLEAR_DB_REQUEST,
1728  spp_api_ds_lite_clear_db_request_t_handler);
1729 
1730  return 0;
1731 }
1732 
1733 /*
1734 ************************
1735 * spp_api_cnat_get_cgn_db_summary
1736 * This is for finding out the per core CPU users and utilization
1737 ************************
1738 */
1739 
1740 void spp_api_cnat_get_cgn_db_summary
1741 (spp_api_cnat_generic_command_request_t *mp)
1742 {
1743  u32 total_db_entries, total_free_entries, used_entries;
1744  u32 i = 0;
1745  cnat_generic_command_resp *mp_resp;
1746  u32 *result_array;
1747 
1748  /*
1749  * Request structure is used to send the response
1750  */
1751  mp_resp = (cnat_generic_command_resp *) mp;
1752  result_array = (u32 *) (&(mp_resp->raw_data[0]));
1753 
1754  /*
1755  * Find entries free and used in main-db
1756  */
1757  total_db_entries = vec_len(cnat_main_db);
1758  total_free_entries = db_free_entry(cnat_main_db);
1759  used_entries = total_db_entries - total_free_entries;
1760 
1761  *(result_array + i++) = spp_host_to_net_byte_order_32(total_db_entries);
1762  *(result_array + i++) = spp_host_to_net_byte_order_32(used_entries);
1763  *(result_array + i++) = spp_host_to_net_byte_order_32(total_free_entries);
1764 
1765  /*
1766  * Find entries free and used in user-db
1767  */
1768  total_db_entries = vec_len(cnat_user_db);
1769  total_free_entries = db_free_entry(cnat_user_db);
1770  used_entries = total_db_entries - total_free_entries;
1771 
1772  *(result_array + i++) = spp_host_to_net_byte_order_32(total_db_entries);
1773  *(result_array + i++) = spp_host_to_net_byte_order_32(used_entries);
1774  *(result_array + i++) = spp_host_to_net_byte_order_32(total_free_entries);
1775 
1776  mp_resp->num_bytes = spp_host_to_net_byte_order_32(i*sizeof(u32));
1777 }
1778 
1779 SPP_INIT_FUNCTION(cnat_debug_init);
1780 #endif /* TOBE_PORTED */
#define CNAT_DEBUG_GENERIC_COMMAND_READ_MEM
#define TCP_LOGGING_DISABLE
void cnat_db_dump_user(int argc, unsigned long *argv)
Definition: cnat_show.c:268
u16 flags
Definition: cnat_db.h:159
cnat_main_db_entry_t * cnat_main_db
Definition: cnat_db_v2.c:201
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:343
u32 debug_i_addr_start
void cnat_db_dump_user_summary(int argc, unsigned long *argv)
Definition: cnat_show.c:277
#define DSLITE_PRINTF(level,...)
Definition: dslite_db.h:28
a
Definition: bitmap.h:516
u32 ipv6[4]
Definition: cnat_db.h:118
u32 user_index
Definition: cnat_db.h:195
void cnat_db_dump_main(int argc, unsigned long *argv)
Definition: cnat_show.c:247
#define PREDICT_TRUE(x)
Definition: clib.h:98
#define CNAT_PRO_SHIFT
Definition: cnat_db.h:98
void cnat_db_dump_policy(int argc, unsigned long *argv)
Definition: cnat_show.c:519
#define CNAT_DEBUG_GENERIC_COMMAND_DB_SUMMARY
#define NULL
Definition: clib.h:55
u32 nat64_data_path_debug_level
u32 session_head_index
Definition: cnat_db.h:263
u64 key64
Definition: cnat_db.h:109
cnat_session_entry_t * cnat_session_db
Definition: cnat_db_v2.c:203
u16 cnat_static_port_range
Definition: cnat_config.c:53
#define PLATFORM_SET_TEMP_READ_BLOCK(var, val)
#define CNAT_DEBUG_GENERIC_COMMAND_USER_DB_PM
Definition: cnat_db.h:153
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:521
nat64_v6_key_t v6_in_key
Definition: nat64_db.h:150
#define CNAT_MAIN_HASH_SIZE
Definition: cnat_db.h:55
index_slist_t in2out_hash
Definition: cnat_db.h:156
#define CNAT_DB_FLAG_STATIC_PORT
Definition: cnat_db.h:164
u8 flags
Definition: cnat_db.h:296
u32 show_debug_level
Definition: nat64_db.h:128
#define CNAT_VRF_MASK
Definition: cnat_db.h:96
u32 nfv9_logging_debug_flag
cnat_portmap_v2_t * portmap_list
Definition: cnat_db.h:430
#define TCP_LOGGING_PACKET_DUMP
void cnat_show_ivrf_command_v2(int argc, unsigned long *argv)
Definition: cnat_show.c:713
int temperature_read_blocked
#define PLATFORM_INIT_TEMP_SENSORS()
void show_bulk_port_stats()
index_slist_t * cnat_in2out_hash
Definition: cnat_db_v2.c:196
#define PLATFORM_DEBUG_PRINT(...)
u32 icmp_debug_flag
Definition: dslite_defs.h:106
void spp_printf(u16 error_code, u16 num_args, u32 *arg)
index_dlist_t main_list
Definition: cnat_db.h:356
u32 nat64_config_debug_level
nat64_table_entry_t * nat64_table_ptr
#define TCP_LOGGING_ENABLE
cnat_key_t k
Definition: cnat_db.h:113
unsigned long u64
Definition: types.h:89
#define CNAT_DEBUG_ALL
Definition: cnat_cli.h:99
#define CNAT_PRO_MASK
Definition: cnat_db.h:97
#define CNAT_DB_NAT64_FLAG
Definition: cnat_db.h:189
nat64_bib_entry_t * nat64_bib_db_lookup_entry(nat64_v6_key_t *ki)
void cnat_show_cdb_command_v2(int argc, unsigned long *argv)
Definition: cnat_show.c:697
cnat_global_counters_t cnat_global_counters
Definition: cnat_db_v2.c:190
u16 i_vrf
Definition: dslite_defs.h:111
u16 ntranslations
Definition: cnat_db.h:290
static pool_header_t * pool_header(void *v)
Get pool header from user pool pointer.
Definition: pool.h:67
void cnat_db_dump_portmaps()
Definition: cnat_ports.c:91
#define CNAT_DB_CLEAR_ALL
Definition: cnat_cli.h:103
u32 debug_o_flag
index_slist_t user_hash
Definition: cnat_db.h:287
cnat_key_t key
Definition: cnat_db.h:309
#define CNAT_DEBUG_GET_CGN_DB_SUMMARY
Definition: nat64_defs.h:306
void cnat_db_dump_timeout()
Definition: cnat_show.c:794
u32 config_debug_level
#define PREDICT_FALSE(x)
Definition: clib.h:97
u16 vrf_map_array[CNAT_MAX_VRFMAP_ENTRIES]
Definition: cnat_db_v2.c:225
void tcp_debug_logging_enable_disable(u32 enable_flag)
u16 flags
Definition: nat64_db.h:134
cnat_user_db_entry_t * cnat_user_db
Definition: cnat_db_v2.c:202
u32 entry_expires
Definition: cnat_db.h:354
u32 tcp_logging_enable_flag
u64 nfv9_downstream_constipation_count
Definition: cnat_db.h:484
#define MAX_UIDX
Definition: cnat_cli.h:110
u32 cnat_pptp_debug_flag
u32 portmap_index
Definition: cnat_db.h:306
u32 translation_list_head_index
Definition: cnat_db.h:303
svmdb_client_t * c
u8 icmp_msg_count
Definition: cnat_db.h:293
u32 udp_inside_packet_dump_enable
#define clib_memcpy(a, b, c)
Definition: string.h:63
#define CNAT_DB_CLEAR_SPECIFIC
Definition: cnat_cli.h:102
#define CNAT_DB_DSLITE_FLAG
Definition: cnat_db.h:188
u32 summary_stats_debug_flag
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
Definition: bitmap.h:197
u8 my_instance_number
Definition: cnat_ports.c:51
cnat_db_key_t k
Definition: cnat_db.h:108
void show_bulk_port_allocation(u16 in_vrfid, u32 inside_ip)
void cnat_va_dump(int argc, unsigned long *argv)
Definition: cnat_va_db.c:234
void cnat_db_dump_main_summary(int argc, unsigned long *argv)
Definition: cnat_show.c:256
cnat_key_t ipv4_key
Definition: cnat_db.h:119
void cnat_show_ovrf_command_v2(int argc, unsigned long *argv)
Definition: cnat_show.c:746
#define CNAT_DEBUG_GLOBAL_ALL
Definition: cnat_cli.h:94
u32 ipv6[4]
Definition: cnat_db.h:310
u16 debug_o_vrf
Definition: cnat_db.h:285
unsigned int u32
Definition: types.h:88
u32 entry_expires
Definition: cnat_db.h:213
u32 debug_i_addr_end
#define vec_delete(V, N, M)
Delete N elements starting at element M.
Definition: vec.h:745
u32 debug_i_flag
u32 udp_outside_packet_dump_enable
u32 debug_o_addr_start
index_slist_t * cnat_out2in_hash
Definition: cnat_db_v2.c:195
#define PLATFORM_READ_CPU_SENSORS(value)
void cnat_db_dump_hashes(int argc, unsigned long *argv)
Definition: cnat_show.c:286
#define CNAT_DEBUG_GLOBAL_ERR
Definition: cnat_cli.h:86
#define TCP_LOGGING_SUMMARY_DUMP
u16 nsessions
Definition: cnat_db.h:266
uword * free_bitmap
Bitmap of indices of free objects.
Definition: pool.h:55
Definition: cnat_db.h:336
unsigned short u16
Definition: types.h:57
u32 ds_lite_config_debug_level
#define CNAT_DEBUG_NONE
Definition: cnat_cli.h:85
cnat_vrfmap_t * cnat_map_by_vrf
Definition: cnat_db_v2.c:218
cnat_user_db_entry_t * cnat_user_db_lookup_entry(cnat_db_key_bucket_t *uki)
Definition: cnat_db_v2.c:603
#define CNAT_MAIN_HASH_MASK
Definition: cnat_db.h:56
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unsigned char u8
Definition: types.h:56
u16 nat64_inst_id
Definition: nat64_db.h:142
nat64_bib_entry_t * nat64_bib_db
u16 * cgse_uidb_index_cgse_id_mapping_ptr
static void * vec_header(void *v, uword header_bytes)
Find a user vector header.
Definition: vec_bootstrap.h:92
u32 udp_inside_checksum_disable
#define EMPTY
Definition: index_list.h:24
u32 debug_o_addr_end
u16 debug_i_vrf
u32 db_free_entry(void *p)
#define CNAT_V4_GET_HASH(key64, hash, mask)
Definition: cnat_db.h:536
void dslite_show_config(void)
u32 udp_outside_checksum_disable
u32 dslite_debug_level
Definition: cnat_global.c:50
u32 global_debug_flag
#define CNAT_DEBUG_GENERIC_COMMAND_WRITE_MEM
void clear_bulk_port_stats()
u32 syslog_debug_flag
cnat_key_t in2out_key
Definition: cnat_db.h:201
u32 frag_debug_flag