1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
|
/*
*------------------------------------------------------------------
* cnat_logging.h
*
* Copyright (c) 2009, 2012 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*------------------------------------------------------------------
*/
#ifndef __CNAT_LOGGING_H__
#define __CNAT_LOGGING_H__
#include <stdio.h>
#include <vlib/vlib.h>
#include <vnet/vnet.h>
#include <vppinfra/vec.h>
#include <vppinfra/bitmap.h>
#include <vppinfra/hash.h>
#include <vppinfra/pool.h>
#include <vppinfra/clib.h>
#include "nat64_db.h"
#include "cnat_log_common.h"
#include "dslite_defs.h"
#define NFV9_DEF_PATH_MTU 1500
#define NFV9_VRF_NAME_LEN 12
/* one time call at the beginning */
void cnat_nfv9_logging_init();
/*
* unconditional call
* will check logging config inside
*/
void cnat_nfv9_log_mapping_create(cnat_main_db_entry_t * db,
cnat_vrfmap_t *vrfmap
#ifndef NO_BULK_LOGGING
, int bulk_alloc
#endif
);
void cnat_nfv9_nat44_log_session_create(cnat_main_db_entry_t * db,
cnat_session_entry_t * sdb,
cnat_vrfmap_t *vrfmap);
void cnat_nfv9_nat44_log_session_delete(cnat_main_db_entry_t * db,
cnat_session_entry_t * sdb,
cnat_vrfmap_t *vrfmap);
/*
* unconditional call
* will check logging config inside
*/
void cnat_nfv9_log_mapping_delete(cnat_main_db_entry_t * db,
cnat_vrfmap_t *vrfmap
#ifndef NO_BULK_LOGGING
, int bulk_alloc
#endif
);
/* nat44 syslog APIs */
void cnat_syslog_nat44_mapping_create(cnat_main_db_entry_t *db,
cnat_vrfmap_t *vrfmap, cnat_session_entry_t * sdb
#ifndef NO_BULK_LOGGING
, int bulk_alloc
#endif
);
void cnat_syslog_nat44_mapping_delete(cnat_main_db_entry_t *db,
cnat_vrfmap_t *vrfmap, cnat_session_entry_t *sdb
#ifndef NO_BULK_LOGGING
, int bulk_alloc
#endif
);
/*
* dslite
*/
void cnat_nfv9_ds_lite_mapping_create(cnat_main_db_entry_t *db,
dslite_table_entry_t *dslite_entry
#ifndef NO_BULK_LOGGING
, int bulk_alloc
#endif
);
void cnat_nfv9_ds_lite_mapping_delete(cnat_main_db_entry_t *db,
dslite_table_entry_t *dslite_entry
#ifndef NO_BULK_LOGGING
, int bulk_alloc
#endif
);
void cnat_nfv9_ds_lite_log_session_create(cnat_main_db_entry_t * db,
dslite_table_entry_t *dslite_entry,
cnat_session_entry_t * sdb);
void cnat_nfv9_ds_lite_log_session_delete(cnat_main_db_entry_t * db,
dslite_table_entry_t *dslite_entry,
cnat_session_entry_t * sdb);
/*
* nat64
*/
void cnat_nfv9_bib_mapping_create (nat64_bib_entry_t *db,
nat64_table_entry_t *nat64_entry);
void cnat_nfv9_session_mapping_create (nat64_bib_entry_t *bdb,
nat64_session_entry_t *sdb,
nat64_table_entry_t *nat64_entry_ptr);
void cnat_nfv9_bib_mapping_delete (nat64_bib_entry_t *db,
nat64_table_entry_t *nat64_entry);
void cnat_nfv9_session_mapping_delete (nat64_bib_entry_t *bdb,
nat64_session_entry_t *sdb,
nat64_table_entry_t *nat64_entry_ptr);
typedef enum {
RECORD_INVALID = 0,
NAT44_ADD_RECORD,
NAT44_DEL_RECORD,
NAT64_ADD_BIB_RECORD,
NAT64_DEL_BIB_RECORD,
NAT64_ADD_SESSION_RECORD,
NAT64_DEL_SESSION_RECORD,
DS_LITE_ADD_RECORD,
DS_LITE_DEL_RECORD,
NAT44_BULK_ADD_RECORD,
NAT44_BULK_DEL_RECORD,
DS_LITE_BULK_ADD_RECORD,
DS_LITE_BULK_DEL_RECORD,
INGRESS_VRF_ID_NAME_RECORD,
NAT44_ADD_SESSION_RECORD,
NAT44_DEL_SESSION_RECORD,
DS_LITE_ADD_SESSION_RECORD,
DS_LITE_DEL_SESSION_RECORD,
MAX_RECORDS
} netflow_record;
typedef enum {
TEMPLATE_SENT_FALSE = 0,
TEMPLATE_SENT_TRUE = 1
} netflow_template_sent;
#define cnat_nfv9_get_sys_up_time_in_ms cnat_get_sys_up_time_in_ms
#define cnat_nfv9_get_unix_time_in_seconds cnat_get_unix_time_in_seconds
#define cnat_nfv9_dump_time_change_logs cnat_dump_time_change_logs
/*
* Netflow V9 Specific Defines and structures
*/
#define CNAT_NFV9_VERSION_NUMBER 9
#define CNAT_NFV9_TEMPLATE_FLOWSET_ID 0
#define CNAT_NFV9_OPTION_TEMPLATE_FLOWSET_ID 1
#define CNAT_NFV9_ADD_FIELD_COUNT 7
#define CNAT_NFV9_DEL_FIELD_COUNT 4
#define CNAT_NFV9_DS_LITE_ADD_FIELD_COUNT 8
#define CNAT_NFV9_DS_LITE_DEL_FIELD_COUNT 5
#define CNAT_NFV9_NAT64_ADD_BIB_FIELD_COUNT 5
#define CNAT_NFV9_NAT64_DEL_BIB_FIELD_COUNT 3
#define CNAT_NFV9_NAT64_ADD_SESSION_FIELD_COUNT 8
#define CNAT_NFV9_NAT64_DEL_SESSION_FIELD_COUNT 5
#define CNAT_NFV9_NAT44_ADD_SESSION_FIELD_COUNT 9
#define CNAT_NFV9_NAT44_DEL_SESSION_FIELD_COUNT 6
#define CNAT_NFV9_DS_LITE_ADD_SESSION_FIELD_COUNT 10
#define CNAT_NFV9_DS_LITE_DEL_SESSION_FIELD_COUNT 7
#define CNAT_NFV9_ADD_TEMPLATE_ID 256
#define CNAT_NFV9_DEL_TEMPLATE_ID 257
#define CNAT_NFV9_NAT64_ADD_BIB_TEMPLATE_ID 258
#define CNAT_NFV9_NAT64_DEL_BIB_TEMPLATE_ID 259
#define CNAT_NFV9_NAT64_ADD_SESSION_TEMPLATE_ID 260
#define CNAT_NFV9_NAT64_DEL_SESSION_TEMPLATE_ID 261
#define CNAT_NFV9_INGRESS_VRF_ID_NAME_TEMPLATE_ID 262
#define CNAT_NFV9_DS_LITE_ADD_TEMPLATE_ID 267
#define CNAT_NFV9_DS_LITE_DEL_TEMPLATE_ID 268
#define CNAT_NFV9_NAT44_ADD_SESSION_TEMPLATE_ID 271
#define CNAT_NFV9_NAT44_DEL_SESSION_TEMPLATE_ID 272
#define CNAT_NFV9_DS_LITE_ADD_SESSION_TEMPLATE_ID 273
#define CNAT_NFV9_DS_LITE_DEL_SESSION_TEMPLATE_ID 274
#ifndef NO_BULK_LOGGING
#define CNAT_NFV9_NAT44_BULK_ADD_TEMPLATE_ID 265
#define CNAT_NFV9_NAT44_BULK_DEL_TEMPLATE_ID 266
#define CNAT_NFV9_DS_LITE_BULK_ADD_TEMPLATE_ID 269
#define CNAT_NFV9_DS_LITE_BULK_DEL_TEMPLATE_ID 270
#define CNAT_NFV9_NAT44_BULK_ADD_FIELD_COUNT 6
#define CNAT_NFV9_NAT44_BULK_DEL_FIELD_COUNT 3
#define CNAT_NFV9_DS_LITE_BULK_ADD_FIELD_COUNT 7
#define CNAT_NFV9_DS_LITE_BULK_DEL_FIELD_COUNT 4
#define CNAT_NFV9_OUTSIDE_IP_PORT_START_FIELD_TYPE 361
#define CNAT_NFV9_OUTSIDE_IP_PORT_START_FIELD_SIZE 2
#define CNAT_NFV9_OUTSIDE_IP_PORT_END_FIELD_TYPE 362
#define CNAT_NFV9_OUTSIDE_IP_PORT_END_FIELD_SIZE 2
#endif /* #ifndef NO_BULK_LOGGING */
#define CNAT_NFV9_INGRESS_VRF_NAME_FIELD_TYPE 236
#define CNAT_NFV9_INGRESS_VRF_NAME_FIELD_SIZE 12
/* 4 byte for vrf_id + 4 byte for vrf_name (option fields) */
#define CNAT_NFV9_INGRESS_VRF_ID_NAME_OPTION_LEN 8
extern u16 cnat_template_id[MAX_RECORDS];
#define CNAT_NFV9_INSIDE_VRFID_FIELD_TYPE 234
#define CNAT_NFV9_INSIDE_VRFID_FIELD_SIZE 4
#define CNAT_NFV9_OUTSIDE_VRFID_FIELD_TYPE 235
#define CNAT_NFV9_OUTSIDE_VRFID_FIELD_SIZE 4
#define CNAT_NFV9_INSIDE_IP_ADDR_FIELD_TYPE 8
#define CNAT_NFV9_INSIDE_IP_ADDR_FIELD_SIZE 4
#define CNAT_NFV9_OUTSIDE_IP_ADDR_FIELD_TYPE 225
#define CNAT_NFV9_OUTSIDE_IP_ADDR_FIELD_SIZE 4
#define CNAT_NFV9_INSIDE_IP_PORT_FIELD_TYPE 7
#define CNAT_NFV9_INSIDE_IP_PORT_FIELD_SIZE 2
#define CNAT_NFV9_OUTSIDE_IP_PORT_FIELD_TYPE 227
#define CNAT_NFV9_OUTSIDE_IP_PORT_FIELD_SIZE 2
#define CNAT_NFV9_PROTOCOL_FIELD_TYPE 4
#define CNAT_NFV9_PROTOCOL_FIELD_SIZE 1
/* IPv6 related info */
#define CNAT_NFV9_INSIDE_IPV6_SRC_ADDR_FIELD_TYPE 27
#define CNAT_NFV9_INSIDE_IPV6_SRC_ADDR_FIELD_SIZE 16
#define CNAT_NFV9_INSIDE_IPV6_DST_ADDR_FIELD_TYPE 28
#define CNAT_NFV9_INSIDE_IPV6_DST_ADDR_FIELD_SIZE 16
#define CNAT_NFV9_OUTSIDE_IP_DST_ADDR_FIELD_TYPE 226
#define CNAT_NFV9_OUTSIDE_IP_DST_ADDR_FIELD_SIZE 4
#define CNAT_NFV9_INSIDE_DST_PORT_FIELD_TYPE 11
#define CNAT_NFV9_INSIDE_DST_PORT_FIELD_SIZE 2
#define CNAT_NFV9_DESTINATION_IP_ADDR_FIELD_TYPE 12
#define CNAT_NFV9_DESTINATION_IP_ADDR_FIELD_SIZE 4
typedef struct {
u16 version;
u16 count;
u32 sys_up_time; /* time in ms since system was booted */
u32 timestamp; /* UNIX time in seconds since 1970 */
u32 sequence_num;
u32 source_id;
} nfv9_header_t;
/*
* Hardcoded - need to be fixed
*/
#define CNAT_NFV9_SOURCE_ID_VALUE 0x1234
typedef struct {
u16 flowset_id;
u16 length;
u16 ingress_vrfid_name_map_template_id;
u16 ingress_vrfid_name_map_scope_len;
u16 ingress_vrfid_name_map_option_len;
u16 ingress_vrfid_name_map_vrfid_option_type;
u16 ingress_vrfid_name_map_vrfid_option_len;
u16 ingress_vrfid_name_map_vrfname_option_type;
u16 ingress_vrfid_name_map_vrfname_option_len;
/*
* Adding the padding so as to make the tempalate
* structure end on a 4 byte boundary
*/
u16 padding1;
} cnat_nfv9_option_template_t;
/*
* The following structure defines the Netflow Template that
* will be exported to the Netflow Collector
*/
typedef struct {
u16 flowset_id;
u16 length;
u16 add_template_id;
u16 add_field_count;
u16 add_inside_vrf_id_field_type;
u16 add_inside_vrf_id_field_size;
u16 add_outside_vrf_id_field_type;
u16 add_outside_vrf_id_field_size;
u16 add_inside_ip_addr_field_type;
u16 add_inside_ip_addr_field_size;
u16 add_outside_ip_addr_field_type;
u16 add_outside_ip_addr_field_size;
u16 add_inside_ip_port_field_type;
u16 add_inside_ip_port_field_size;
u16 add_outside_ip_port_field_type;
u16 add_outside_ip_port_field_size;
u16 add_protocol_field_type;
u16 add_protocol_field_size;
u16 del_template_id;
u16 del_field_count;
u16 del_inside_vrf_id_field_type;
u16 del_inside_vrf_id_field_size;
u16 del_inside_ip_addr_field_type;
u16 del_inside_ip_addr_field_size;
u16 del_inside_ip_port_field_type;
u16 del_inside_ip_port_field_size;
u16 del_protocol_field_type;
u16 del_protocol_field_size;
#if 0
/* NAT64 related info */
u16 nat64_add_bib_template_id;
u16 nat64_add_bib_field_count;
u16 nat64_add_bib_inside_ipv6_addr_field_type;
u16 nat64_add_bib_inside_ipv6_addr_field_size;
u16 nat64_add_bib_outside_ip_addr_field_type;
u16 nat64_add_bib_outside_ip_addr_field_size;
u16 nat64_add_bib_inside_ip_port_field_type;
u16 nat64_add_bib_inside_ip_port_field_size;
u16 nat64_add_bib_outside_ip_port_field_type;
u16 nat64_add_bib_outside_ip_port_field_size;
u16 nat64_add_bib_protocol_field_type;
u16 nat64_add_bib_protocol_field_size;
u16 nat64_del_bib_template_id;
u16 nat64_del_bib_field_count;
u16 nat64_del_bib_inside_ip_addr_field_type;
u16 nat64_del_bib_inside_ip_addr_field_size;
u16 nat64_del_bib_inside_ip_port_field_type;
u16 nat64_del_bib_inside_ip_port_field_size;
u16 nat64_del_bib_protocol_field_type;
u16 nat64_del_bib_protocol_field_size;
u16 nat64_add_session_template_id;
u16 nat64_add_session_field_count;
u16 nat64_add_session_inside_ipv6_src_addr_field_type;
u16 nat64_add_session_inside_ipv6_src_addr_field_size;
u16 nat64_add_session_outside_ip_src_addr_field_type;
u16 nat64_add_session_outside_ip_src_addr_field_size;
u16 nat64_add_session_inside_ipv6_dst_addr_field_type;
u16 nat64_add_session_inside_ipv6_dst_addr_field_size;
u16 nat64_add_session_outside_ip_dst_addr_field_type;
u16 nat64_add_session_outside_ip_dst_addr_field_size;
u16 nat64_add_session_inside_ip_src_port_field_type;
u16 nat64_add_session_inside_ip_src_port_field_size;
u16 nat64_add_session_outside_ip_src_port_field_type;
u16 nat64_add_session_outside_ip_src_port_field_size;
u16 nat64_add_session_ip_dest_port_field_type;
u16 nat64_add_session_ip_dest_port_field_size;
u16 nat64_add_session_protocol_field_type;
u16 nat64_add_session_protocol_field_size;
u16 nat64_del_session_template_id;
u16 nat64_del_session_field_count;
u16 nat64_del_session_inside_ip_src_addr_field_type;
u16 nat64_del_session_inside_ip_src_addr_field_size;
u16 nat64_del_session_inside_ip_dst_addr_field_type;
u16 nat64_del_session_inside_ip_dst_addr_field_size;
u16 nat64_del_session_inside_ip_src_port_field_type;
u16 nat64_del_session_inside_ip_src_port_field_size;
u16 nat64_del_session_inside_ip_dst_port_field_type;
u16 nat64_del_session_inside_ip_dst_port_field_size;
u16 nat64_del_session_protocol_field_type;
u16 nat64_del_session_protocol_field_size;
/*
* Ds-Lite specific info
*/
u16 add_dslite_template_id;
u16 add_dslite_field_count;
u16 add_dslite_inside_vrf_id_field_type;
u16 add_dslite_inside_vrf_id_field_size;
u16 add_dslite_outside_vrf_id_field_type;
u16 add_dslite_outside_vrf_id_field_size;
u16 add_dslite_inside_ip_addr_field_type;
u16 add_dslite_inside_ip_addr_field_size;
u16 add_dslite_inside_ipv6_addr_field_type;
u16 add_dslite_inside_ipv6_addr_field_size;
u16 add_dslite_outside_ip_addr_field_type;
u16 add_dslite_outside_ip_addr_field_size;
u16 add_dslite_inside_ip_port_field_type;
u16 add_dslite_inside_ip_port_field_size;
u16 add_dslite_outside_ip_port_field_type;
u16 add_dslite_outside_ip_port_field_size;
u16 add_dslite_protocol_field_type;
u16 add_dslite_protocol_field_size;
u16 del_dslite_template_id;
u16 del_dslite_field_count;
u16 del_dslite_inside_vrf_id_field_type;
u16 del_dslite_inside_vrf_id_field_size;
u16 del_dslite_inside_ip_addr_field_type;
u16 del_dslite_inside_ip_addr_field_size;
u16 del_dslite_inside_ipv6_addr_field_type;
u16 del_dslite_inside_ipv6_addr_field_size;
u16 del_dslite_inside_ip_port_field_type;
u16 del_dslite_inside_ip_port_field_size;
u16 del_dslite_protocol_field_type;
u16 del_dslite_protocol_field_size;
#endif
//#ifndef NO_BULK_LOGGING /* commenting for time being */
#if 0
u16 bulk_add_template_id;
u16 bulk_add_field_count;
u16 bulk_add_inside_vrf_id_field_type;
u16 bulk_add_inside_vrf_id_field_size;
u16 bulk_add_outside_vrf_id_field_type;
u16 bulk_add_outside_vrf_id_field_size;
u16 bulk_add_inside_ip_addr_field_type;
u16 bulk_add_inside_ip_addr_field_size;
u16 bulk_add_outside_ip_addr_field_type;
u16 bulk_add_outside_ip_addr_field_size;
u16 bulk_add_outside_start_port_field_type;
u16 bulk_add_outside_start_port_field_size;
u16 bulk_add_outside_end_port_field_type;
u16 bulk_add_outside_end_port_field_size;
u16 bulk_del_template_id;
u16 bulk_del_field_count;
u16 bulk_del_inside_vrf_id_field_type;
u16 bulk_del_inside_vrf_id_field_size;
u16 bulk_del_inside_ip_addr_field_type;
u16 bulk_del_inside_ip_addr_field_size;
u16 bulk_del_outside_start_port_field_type;
u16 bulk_del_outside_start_port_field_size;
/* ds-lite bulk logging create delete event */
u16 bulk_dslite_add_template_id;
u16 bulk_dslite_add_field_count;
u16 bulk_dslite_add_inside_vrf_id_field_type;
u16 bulk_dslite_add_inside_vrf_id_field_size;
u16 bulk_dslite_add_outside_vrf_id_field_type;
u16 bulk_dslite_add_outside_vrf_id_field_size;
u16 bulk_dslite_add_inside_ip_addr_field_type;
u16 bulk_dslite_add_inside_ip_addr_field_size;
u16 bulk_dslite_add_inside_ipv6_addr_field_type;
u16 bulk_dslite_add_inside_ipv6_addr_field_size;
u16 bulk_dslite_add_outside_ip_addr_field_type;
u16 bulk_dslite_add_outside_ip_addr_field_size;
u16 bulk_dslite_add_outside_start_port_field_type;
u16 bulk_dslite_add_outside_start_port_field_size;
u16 bulk_dslite_add_outside_end_port_field_type;
u16 bulk_dslite_add_outside_end_port_field_size;
u16 bulk_dslite_del_template_id;
u16 bulk_dslite_del_field_count;
u16 bulk_dslite_del_inside_vrf_id_field_type;
u16 bulk_dslite_del_inside_vrf_id_field_size;
u16 bulk_dslite_del_inside_ip_addr_field_type;
u16 bulk_dslite_del_inside_ip_addr_field_size;
u16 bulk_dslite_del_inside_ipv6_addr_field_type;
u16 bulk_dslite_del_inside_ipv6_addr_field_size;
u16 bulk_dslite_del_outside_start_port_field_type;
u16 bulk_dslite_del_outside_start_port_field_size;
#endif /* NO_BULK_LOGGING */
u16 nat44_session_add_template_id;
u16 nat44_session_add_field_count;
u16 nat44_session_add_inside_vrf_id_field_type;
u16 nat44_session_add_inside_vrf_id_field_size;
u16 nat44_session_add_outside_vrf_id_field_type;
u16 nat44_session_add_outside_vrf_id_field_size;
u16 nat44_session_add_inside_ip_addr_field_type;
u16 nat44_session_add_inside_ip_addr_field_size;
u16 nat44_session_add_outside_ip_addr_field_type;
u16 nat44_session_add_outside_ip_addr_field_size;
u16 nat44_session_add_inside_ip_port_field_type;
u16 nat44_session_add_inside_ip_port_field_size;
u16 nat44_session_add_outside_ip_port_field_type;
u16 nat44_session_add_outside_ip_port_field_size;
u16 nat44_session_add_dest_ip_addr_field_type;
u16 nat44_session_add_dest_ip_addr_field_size;
u16 nat44_session_add_dest_port_field_type;
u16 nat44_session_add_dest_port_field_size;
u16 nat44_session_add_protocol_field_type;
u16 nat44_session_add_protocol_field_size;
u16 nat44_session_del_template_id;
u16 nat44_session_del_field_count;
u16 nat44_session_del_inside_vrf_id_field_type;
u16 nat44_session_del_inside_vrf_id_field_size;
u16 nat44_session_del_inside_ip_addr_field_type;
u16 nat44_session_del_inside_ip_addr_field_size;
u16 nat44_session_del_dest_ip_addr_field_type;
u16 nat44_session_del_dest_ip_addr_field_size;
u16 nat44_session_del_inside_ip_port_field_type;
u16 nat44_session_del_inside_ip_port_field_size;
u16 nat44_session_del_dest_port_field_type;
u16 nat44_session_del_dest_port_field_size;
u16 nat44_session_del_protocol_field_type;
u16 nat44_session_del_protocol_field_size;
#if 0
u16 add_dslite_session_template_id;
u16 add_dslite_session_field_count;
u16 add_dslite_session_inside_vrf_id_field_type;
u16 add_dslite_session_inside_vrf_id_field_size;
u16 add_dslite_session_outside_vrf_id_field_type;
u16 add_dslite_session_outside_vrf_id_field_size;
u16 add_dslite_session_inside_ip_addr_field_type;
u16 add_dslite_session_inside_ip_addr_field_size;
u16 add_dslite_session_inside_ipv6_addr_field_type;
u16 add_dslite_session_inside_ipv6_addr_field_size;
u16 add_dslite_session_outside_ip_addr_field_type;
u16 add_dslite_session_outside_ip_addr_field_size;
u16 add_dslite_session_inside_ip_port_field_type;
u16 add_dslite_session_inside_ip_port_field_size;
u16 add_dslite_session_outside_ip_port_field_type;
u16 add_dslite_session_outside_ip_port_field_size;
u16 add_dslite_session_dest_ip_addr_field_type;
u16 add_dslite_session_dest_ip_addr_field_size;
u16 add_dslite_session_dest_port_field_type;
u16 add_dslite_session_dest_port_field_size;
u16 add_dslite_session_protocol_field_type;
u16 add_dslite_session_protocol_field_size;
u16 del_dslite_session_template_id;
u16 del_dslite_session_field_count;
u16 del_dslite_session_inside_vrf_id_field_type;
u16 del_dslite_session_inside_vrf_id_field_size;
u16 del_dslite_session_inside_ip_addr_field_type;
u16 del_dslite_session_inside_ip_addr_field_size;
u16 del_dslite_session_inside_ipv6_addr_field_type;
u16 del_dslite_session_inside_ipv6_addr_field_size;
u16 del_dslite_session_dest_ip_addr_field_type;
u16 del_dslite_session_dest_ip_addr_field_size;
u16 del_dslite_session_inside_ip_port_field_type;
u16 del_dslite_session_inside_ip_port_field_size;
u16 del_dslite_session_dest_port_field_type;
u16 del_dslite_session_dest_port_field_size;
u16 del_dslite_session_protocol_field_type;
u16 del_dslite_session_protocol_field_size;
#endif
/*
* Netflow option template
* Ingress VRF ID - Name mapping
* This template will be sent under flowset id 1
*/
cnat_nfv9_option_template_t cnat_nfv9_option_template;
} cnat_nfv9_template_t;
/*
* The Dataflow header for each add/delete record group
*/
typedef struct {
u16 dataflow_template_id;
u16 dataflow_length;
} nfv9_dataflow_record_header_t;
/*
* NFv9 Add record definition
*/
/*
* pad bytes needed to make the structure a multiple of 4 bytes
*/
#define CNAT_NFV9_ADD_RECORD_PAD_BYTES (3)
#define CNAT_NFV9_DEL_RECORD_PAD_BYTES (1)
#define CNAT_NFV9_NAT64_ADD_BIB_RECORD_PAD_BYTES (3)
#define CNAT_NFV9_NAT64_DEL_BIB_RECORD_PAD_BYTES (1)
#define CNAT_NFV9_NAT64_ADD_SESSION_RECORD_PAD_BYTES (1)
#define CNAT_NFV9_NAT64_DEL_SESSION_RECORD_PAD_BYTES (3)
#define CNAT_NFV9_NAT44_ADD_SESSION_RECORD_PAD_BYTES (1)
#define CNAT_NFV9_NAT44_DEL_SESSION_RECORD_PAD_BYTES (3)
#define CNAT_NFV9_DS_LITE_ADD_RECORD_PAD_BYTES (3)
#define CNAT_NFV9_DS_LITE_DEL_RECORD_PAD_BYTES (1)
#define CNAT_NFV9_DS_LITE_ADD_SESSION_RECORD_PAD_BYTES (1)
#define CNAT_NFV9_DS_LITE_DEL_SESSION_RECORD_PAD_BYTES (3)
#define CNAT_NFV9_INGRESS_VRFID_NAME_RECORD_PAD_BYTES (0)
typedef struct {
u32 inside_vrf_id;
u32 outside_vrf_id;
u32 inside_ip_addr;
u32 outside_ip_addr;
u16 inside_ip_port;
u16 outside_ip_port;
u8 protocol;
u8 pad[CNAT_NFV9_ADD_RECORD_PAD_BYTES];
} nfv9_add_record_t;
/*
* NFv9 Delete record definition
*/
typedef struct {
u32 inside_vrf_id;
u32 inside_ip_addr;
u16 inside_ip_port;
u8 protocol;
u8 pad[CNAT_NFV9_DEL_RECORD_PAD_BYTES];
} nfv9_del_record_t;
#ifndef NO_BULK_LOGGING
#define CNAT_NFV9_BULK_ADD_RECORD_PAD_BYTES (0)
#define CNAT_NFV9_BULK_DEL_RECORD_PAD_BYTES (2)
typedef struct {
u32 inside_vrf_id;
u32 outside_vrf_id;
u32 inside_ip_addr;
u32 outside_ip_addr;
u16 outside_ip_port_start;
u16 outside_ip_port_end;
u8 pad[CNAT_NFV9_BULK_ADD_RECORD_PAD_BYTES];
} nfv9_bulk_add_record_t;
/*
* NFv9 Delete record definition
*/
typedef struct {
u32 inside_vrf_id;
u32 inside_ip_addr;
u16 outside_ip_port_start;
u8 pad[CNAT_NFV9_BULK_DEL_RECORD_PAD_BYTES];
} nfv9_bulk_del_record_t;
/*
* DS-lite bulk port (user based) add record definition
*/
#define CNAT_NFV9_DS_LITE_BULK_ADD_RECORD_PAD_BYTES (0)
#define CNAT_NFV9_DS_LITE_BULK_DEL_RECORD_PAD_BYTES (2)
typedef struct {
u32 inside_vrf_id;
u32 outside_vrf_id;
u32 inside_ip_addr;
u32 inside_v6_src_addr[4];
u32 outside_ip_addr;
u16 outside_ip_port_start;
u16 outside_ip_port_end;
u8 pad[CNAT_NFV9_DS_LITE_BULK_ADD_RECORD_PAD_BYTES];
} nfv9_ds_lite_bulk_add_record_t;
/*
* DS-lite bulk port (user based) delete record definition
*/
typedef struct {
u32 inside_vrf_id;
u32 inside_ip_addr;
u32 inside_v6_src_addr[4];
u16 outside_ip_port_start;
u8 pad[CNAT_NFV9_DS_LITE_BULK_DEL_RECORD_PAD_BYTES];
} nfv9_ds_lite_bulk_del_record_t;
#endif /* NO_BULK_LOGGING */
/* NAT64 related structures */
typedef struct {
u32 inside_v6_src_addr[4];
u32 outside_v4_src_addr;
u16 inside_src_port;
u16 outside_src_port;
u8 protocol;
u8 pad[CNAT_NFV9_NAT64_ADD_BIB_RECORD_PAD_BYTES];
} nfv9_nat64_add_bib_record_t;
typedef struct {
u32 inside_v6_src_addr[4];
u32 outside_v4_src_addr;
u32 inside_v6_dest_addr[4];
u32 outside_v4_dest_addr;
u16 inside_src_port;
u16 outside_src_port;
u16 dest_port;
u8 protocol;
u8 pad[CNAT_NFV9_NAT64_ADD_SESSION_RECORD_PAD_BYTES];
} nfv9_nat64_add_session_record_t;
typedef struct {
u32 inside_v6_src_addr[4];
u16 inside_src_port;
u8 protocol;
u8 pad[CNAT_NFV9_NAT64_DEL_BIB_RECORD_PAD_BYTES];
} nfv9_nat64_del_bib_record_t;
typedef struct {
u32 inside_v6_src_addr[4];
u32 inside_v6_dest_addr[4];
u16 inside_src_port;
u16 dest_port;
u8 protocol;
u8 pad[CNAT_NFV9_NAT64_DEL_SESSION_RECORD_PAD_BYTES];
} nfv9_nat64_del_session_record_t;
/*
* NFv9 Session based Add record definition
*/
typedef struct {
u32 inside_vrf_id;
u32 outside_vrf_id;
u32 inside_ip_addr;
u32 outside_ip_addr;
u16 inside_ip_port;
u16 outside_ip_port;
u32 dest_ip_addr;
u16 dest_port;
u8 protocol;
u8 pad[CNAT_NFV9_NAT44_ADD_SESSION_RECORD_PAD_BYTES];
} nfv9_add_session_record_t;
/*
* NFv9 Session based del record definition
*/
typedef struct {
u32 inside_vrf_id;
u32 inside_ip_addr;
u32 dest_ip_addr;
u16 inside_ip_port;
u16 dest_port;
u8 protocol;
u8 pad[CNAT_NFV9_NAT44_DEL_SESSION_RECORD_PAD_BYTES];
} nfv9_del_session_record_t;
/*
* DS-lite NFv9 create record structure
*/
typedef struct {
u32 inside_vrf_id;
u32 outside_vrf_id;
u32 inside_ip_addr;
u32 inside_v6_src_addr[4];
u32 outside_ip_addr;
u16 inside_ip_port;
u16 outside_ip_port;
u8 protocol;
u8 pad[CNAT_NFV9_DS_LITE_ADD_RECORD_PAD_BYTES];
} nfv9_ds_lite_add_record_t;
typedef struct {
u32 inside_vrf_id;
u32 inside_ip_addr;
u32 inside_v6_src_addr[4];
u16 inside_ip_port;
u8 protocol;
u8 pad[CNAT_NFV9_DS_LITE_DEL_RECORD_PAD_BYTES];
} nfv9_ds_lite_del_record_t;
/*
* NFv9 Session based Add record definition
*/
typedef struct {
u32 inside_vrf_id;
u32 outside_vrf_id;
u32 inside_ip_addr;
u32 inside_v6_src_addr[4];
u32 outside_ip_addr;
u16 inside_ip_port;
u16 outside_ip_port;
u32 dest_ip_addr;
u16 dest_port;
u8 protocol;
u8 pad[CNAT_NFV9_DS_LITE_ADD_SESSION_RECORD_PAD_BYTES];
} nfv9_ds_lite_add_session_record_t;
/*
* NFv9 Session based del record definition
*/
typedef struct {
u32 inside_vrf_id;
u32 inside_ip_addr;
u32 inside_v6_src_addr[4];
u32 dest_ip_addr;
u16 inside_ip_port;
u16 dest_port;
u8 protocol;
u8 pad[CNAT_NFV9_DS_LITE_DEL_SESSION_RECORD_PAD_BYTES];
} nfv9_ds_lite_del_session_record_t;
typedef struct {
u32 ingress_vrf_id;
u8 ingress_vrf_name[NFV9_VRF_NAME_LEN];
u8 pad[CNAT_NFV9_INGRESS_VRFID_NAME_RECORD_PAD_BYTES];
} nfv9_ingress_vrfid_name_record_t;
#define CNAT_NFV9_TEMPLATE_OFFSET \
(CNAT_NFV9_HDR_OFFSET + sizeof(nfv9_header_t))
#define CNAT_NFV9_TEMPLATE_LENGTH (sizeof(cnat_nfv9_template_t))
#define CNAT_NFV9_OPTION_TEMPLATE_LENGTH (sizeof(cnat_nfv9_option_template_t))
#define CNAT_NFV9_DATAFLOW_RECORD_HEADER_LENGTH \
(sizeof(nfv9_dataflow_record_header_t))
/*
* No padding is needed for the add/delete records - reduce padding bytes
*/
#define CNAT_NFV9_ADD_RECORD_LENGTH (sizeof(nfv9_add_record_t) - \
CNAT_NFV9_ADD_RECORD_PAD_BYTES)
#define CNAT_NFV9_DEL_RECORD_LENGTH (sizeof(nfv9_del_record_t) - \
CNAT_NFV9_DEL_RECORD_PAD_BYTES)
#define CNAT_NFV9_DS_LITE_ADD_RECORD_LENGTH (sizeof(nfv9_ds_lite_add_record_t) - \
CNAT_NFV9_DS_LITE_ADD_RECORD_PAD_BYTES)
#define CNAT_NFV9_DS_LITE_DEL_RECORD_LENGTH (sizeof(nfv9_ds_lite_del_record_t) - \
CNAT_NFV9_DS_LITE_DEL_RECORD_PAD_BYTES)
#ifndef NO_BULK_LOGGING
#define CNAT_NFV9_BULK_ADD_RECORD_LENGTH (sizeof(nfv9_bulk_add_record_t) - \
CNAT_NFV9_BULK_ADD_RECORD_PAD_BYTES)
#define CNAT_NFV9_BULK_DEL_RECORD_LENGTH (sizeof(nfv9_bulk_del_record_t) - \
CNAT_NFV9_BULK_DEL_RECORD_PAD_BYTES)
#define CNAT_NFV9_DS_LITE_BULK_ADD_RECORD_LENGTH (sizeof(nfv9_ds_lite_bulk_add_record_t) - \
CNAT_NFV9_DS_LITE_BULK_ADD_RECORD_PAD_BYTES)
#define CNAT_NFV9_DS_LITE_BULK_DEL_RECORD_LENGTH (sizeof(nfv9_ds_lite_bulk_del_record_t) - \
CNAT_NFV9_DS_LITE_BULK_DEL_RECORD_PAD_BYTES)
#endif /* NO_BULK_LOGGING */
#define CNAT_NFV9_INGRESS_VRFID_NAME_RECORD_LENGTH (sizeof(nfv9_ingress_vrfid_name_record_t) - \
CNAT_NFV9_INGRESS_VRFID_NAME_RECORD_PAD_BYTES)
#define CNAT_NFV9_NAT64_ADD_BIB_RECORD_LENGTH \
(sizeof(nfv9_nat64_add_bib_record_t) - \
CNAT_NFV9_NAT64_ADD_BIB_RECORD_PAD_BYTES)
#define CNAT_NFV9_NAT64_DEL_BIB_RECORD_LENGTH \
(sizeof(nfv9_nat64_del_bib_record_t) - \
CNAT_NFV9_NAT64_DEL_BIB_RECORD_PAD_BYTES)
#define CNAT_NFV9_NAT64_ADD_SESSION_RECORD_LENGTH \
(sizeof(nfv9_nat64_add_session_record_t) - \
CNAT_NFV9_NAT64_ADD_SESSION_RECORD_PAD_BYTES)
#define CNAT_NFV9_NAT64_DEL_SESSION_RECORD_LENGTH \
(sizeof(nfv9_nat64_del_session_record_t) - \
CNAT_NFV9_NAT64_DEL_SESSION_RECORD_PAD_BYTES)
#define CNAT_NFV9_MAX_SINGLE_RECORD_LENGTH \
(sizeof(nfv9_ds_lite_add_session_record_t) - \
CNAT_NFV9_DS_LITE_ADD_SESSION_RECORD_PAD_BYTES)
#define CNAT_NFV9_NAT44_ADD_SESSION_RECORD_LENGTH \
(sizeof(nfv9_add_session_record_t) -\
CNAT_NFV9_NAT44_ADD_SESSION_RECORD_PAD_BYTES)
#define CNAT_NFV9_NAT44_DEL_SESSION_RECORD_LENGTH \
(sizeof(nfv9_del_session_record_t) -\
CNAT_NFV9_NAT44_DEL_SESSION_RECORD_PAD_BYTES)
#define CNAT_NFV9_DS_LITE_ADD_SESSION_RECORD_LENGTH \
(sizeof(nfv9_ds_lite_add_session_record_t) -\
CNAT_NFV9_DS_LITE_ADD_SESSION_RECORD_PAD_BYTES)
#define CNAT_NFV9_DS_LITE_DEL_SESSION_RECORD_LENGTH \
(sizeof(nfv9_ds_lite_del_session_record_t) -\
CNAT_NFV9_DS_LITE_DEL_SESSION_RECORD_PAD_BYTES)
/*
* Minimum value of the path MTU value
*/
#define CNAT_NFV9_MIN_RECORD_SIZE (60 + \
CNAT_NFV9_DATAFLOW_RECORD_HEADER_LENGTH + \
CNAT_NFV9_TEMPLATE_LENGTH + \
CNAT_NFV9_MAX_SINGLE_RECORD_LENGTH)
/*
* Let us put the maximum length of the netflow data to be 1400
*/
#define CNAT_NFV9_MAX_PKT_LENGTH 1400
/*
* Data structures and defines to store NFV9 specific info
*/
#define CNAT_NFV9_INVALID_LOGGING_INDEX 0xffffffff
/*
* Padding value between ADD and DELETE records. This can be atmost 3 bytes
*/
#define NFV9_PAD_VALUE (3)
typedef struct {
/* NFV9 server specific info
* For now, it will maintain only package sequence count.
* Later it will maintain server address, port, etc.
* Though it currently has server address and port, it is only for
* cross refernce
*/
u32 ipv4_address; /* Destination IP address of the collector */
u16 port; /* Destination port number of the collector */
u16 refresh_rate; /* Refresh rate in packets after which template is sent */
u16 timeout_rate; /* Timeout rate in seconds after which template is sent */
u16 ref_count; /* Num of instances using this data */
u32 sequence_num; /* Sequence number of the logging packet */
/*
* Keep track of the time and packets since last template send
*/
u32 last_template_sent_time;
u32 pkts_since_last_template;
u8 template_sent; /* used while sending vrfid-name mapping */
} nfv9_server_info_t;
/*
* This structure store the Netflow Logging information on per NFv9
* collector basis. This structure is allocated from a pool and index
* to this structure is stored VRF MAP structures
*/
typedef struct {
/*
* nat64_id will be 0 for nat44 config and i_vrf_id, i_vrf will be 0
* for nat64 config. Nat64_id will be used while nat64 collector is
* search and i_vrf* for nat44 collector
*/
/* Similarly for ds_lite, ds_lite_id will be used and nat64_id,
* ivrf_id shall be set to 0
*/
u32 i_vrf_id; /* Inside VRF ID corresponding to this collector */
u16 i_vrf; /* Inside VRF (uidb_index) corresponding to this collector */
u16 nat64_id; /* NAT64 instance for to this collector */
u16 ds_lite_id; /* DS Lite instance for this collector */
/*
* This field determines the maximum size of the Netflow V9 information
* that can be stored in a logging packet
*/
u16 max_length_minus_max_record_size;
/*
* Indicates if the entry is already deleted
*/
u16 deleted;
u16 pkt_length; /* Length of the currently NFv9 information */
u16 record_length[MAX_RECORDS]; /* Length of delete record */
u16 total_record_count; /* Total number of records including templates */
u8 logging_policy;
/*
* Keep track of the time and packets since last template send
*/
u32 last_template_sent_time;
u32 pkts_since_last_template;
/* Server info */
u32 server_index;
/*
* current logging context
*/
vlib_buffer_t *current_logging_context;
/*
* Timestamp in UNIX seconds corresponding to when the current
* logging packet was created
*/
u32 current_logging_context_timestamp;
/*
* Queued logging context waiting to be sent to the l3 infra node
*/
vlib_buffer_t *queued_logging_context;
/*
* Headers corresponding to various records in this
* current nfv9 logging context
*/
nfv9_header_t *nfv9_header;
cnat_nfv9_template_t *nfv9_template_header;
nfv9_dataflow_record_header_t *dataflow_header;
u8 *record[MAX_RECORDS];
u8 *next_data_ptr;
u8 last_record;
u32 nfv9_logging_next_index;
u32 ip4_input_node_index;
vlib_frame_t *f;
u32 *to_next;
} cnat_nfv9_logging_info_t;
/*
* Global structure for CGN APP configuration
*/
typedef struct {
/*
* Global NFv9 Logging Collector Index
*/
u32 cnat_nfv9_global_collector_index;
/*
* Node index corresponding to the infra L3 output node
* to which the nfv9 logging node will send the packet
*/
u16 cnat_nfv9_disp_node_index;
/*
* Whether we have initialized the NFv9 information
*/
u8 cnat_nfv9_init_done;
} cnat_nfv9_global_info_t;
typedef enum {
cnat_nfv9_template_add_default,
cnat_nfv9_template_add_always
} cnat_nfv9_template_add_flag_t;
extern cnat_nfv9_template_t cnat_nfv9_template_info;
extern cnat_nfv9_logging_info_t cnat_default_nfv9_logging_info;
extern cnat_nfv9_logging_info_t *cnat_nfv9_logging_info_pool;
extern cnat_nfv9_global_info_t cnat_nfv9_global_info;
extern nfv9_server_info_t *nfv9_server_info_pool;
/* #define DEBUG_NF_SERVER_CONFIG 1 */
static inline void nfv9_delete_server_info(cnat_nfv9_logging_info_t *nfv9_info)
{
nfv9_server_info_t *server = nfv9_server_info_pool +
nfv9_info->server_index;
if(nfv9_info->server_index == EMPTY) {
#ifdef DEBUG_NF_SERVER_CONFIG
if(my_instance_number == 1) {
PLATFORM_DEBUG_PRINT("Deleting empty server info\n");
}
#endif /* #ifdef DEBUG_NF_SERVER_CONFIG */
return;
}
/* Check if this server is not used by anyone.. if not delete */
/* Caller of this function does not need it..so decrement ref count */
server->ref_count--;
if(!(server->ref_count)) {
#ifdef DEBUG_NF_SERVER_CONFIG
if(my_instance_number == 1) {
PLATFORM_DEBUG_PRINT("Deleting nfv9 server %x, %d at %d\n",
server->ipv4_address,
server->port,
nfv9_info->server_index);
}
#endif /* #ifdef DEBUG_NF_SERVER_CONFIG */
pool_put(nfv9_server_info_pool, server);
nfv9_info->server_index = EMPTY;
}
#ifdef DEBUG_NF_SERVER_CONFIG
else {
if(my_instance_number == 1) {
PLATFORM_DEBUG_PRINT("Not Deleting nfv9 server %x, %d rc %d\n",
server->ipv4_address,
server->port,
server->ref_count);
}
}
#endif /* #ifdef DEBUG_NF_SERVER_CONFIG */
return;
}
void handle_pending_nfv9_pkts();
#endif /* __CNAT_LOGGING_H__ */
|