nat: make tcp/udp/icmp packet counters consistent 72/35372/3
authorKlement Sekera <klement@graphiant.com>
Fri, 18 Feb 2022 15:11:14 +0000 (15:11 +0000)
committerNeale Ranns <neale@graphiant.com>
Mon, 21 Feb 2022 08:29:00 +0000 (08:29 +0000)
TCP/UDP packets which are dropped are not counted towards TCP/UDP
counters. Apply same behaviour to ICMP packets.

Type: improvement
Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
Change-Id: I487fa7135ac8e49431a621fac213638d2dab31c8

src/plugins/nat/nat44-ed/nat44_ed_in2out.c
src/plugins/nat/nat44-ed/nat44_ed_out2in.c

index 99db601..6e0a21d 100644 (file)
@@ -1400,8 +1400,12 @@ nat44_ed_in2out_slow_path_node_fn_inline (vlib_main_t *vm,
              goto trace0;
            }
 
-         vlib_increment_simple_counter (&sm->counters.slowpath.in2out.icmp,
-                                        thread_index, cntr_sw_if_index0, 1);
+         if (NAT_NEXT_DROP != next[0])
+           {
+             vlib_increment_simple_counter (
+               &sm->counters.slowpath.in2out.icmp, thread_index,
+               cntr_sw_if_index0, 1);
+           }
          goto trace0;
        }
 
index 40a7212..aa0cc50 100644 (file)
@@ -1135,8 +1135,12 @@ nat44_ed_out2in_slow_path_node_fn_inline (vlib_main_t * vm,
              goto trace0;
            }
 
-         vlib_increment_simple_counter (&sm->counters.slowpath.out2in.icmp,
-                                        thread_index, sw_if_index0, 1);
+         if (NAT_NEXT_DROP != next[0])
+           {
+             vlib_increment_simple_counter (
+               &sm->counters.slowpath.out2in.icmp, thread_index, sw_if_index0,
+               1);
+           }
          goto trace0;
        }