aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat64_in2out.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2018-12-18 01:08:51 -0800
committerOle Trøan <otroan@employees.org>2018-12-20 15:12:11 +0000
commitfd0d50879f475a1b15cedb4ab49059a02c45ccfd (patch)
treecbb86dfe652ec5401492298335c9750cfad482b3 /src/plugins/nat/nat64_in2out.c
parent775f73c6baaf9bc2283e7ab9752c81984823be99 (diff)
NAT: total users and sessions gauges (VPP-1484)
Change-Id: I41a82e21571d5c64d01af72cd88c3983afac26ed Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat64_in2out.c')
-rw-r--r--src/plugins/nat/nat64_in2out.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/plugins/nat/nat64_in2out.c b/src/plugins/nat/nat64_in2out.c
index 372931c7e4b..660df093bf9 100644
--- a/src/plugins/nat/nat64_in2out.c
+++ b/src/plugins/nat/nat64_in2out.c
@@ -221,6 +221,9 @@ nat64_in2out_tcp_udp_set_cb (ip6_header_t * ip6, ip4_header_t * ip4,
sport, out_port, fib_index, proto, 0);
if (!bibe)
return -1;
+
+ vlib_set_simple_counter (&nm->total_bibs, ctx->thread_index, 0,
+ db->bib.bib_entries_num);
}
nat64_extract_ip4 (&ip6->dst_address, &daddr.ip4, fib_index);
@@ -229,6 +232,9 @@ nat64_in2out_tcp_udp_set_cb (ip6_header_t * ip6, ip4_header_t * ip4,
&daddr.ip4, dport);
if (!ste)
return -1;
+
+ vlib_set_simple_counter (&nm->total_sessions, ctx->thread_index, 0,
+ db->st.st_entries_num);
}
ip4->src_address.as_u32 = bibe->out_addr.as_u32;
@@ -312,6 +318,9 @@ nat64_in2out_icmp_set_cb (ip6_header_t * ip6, ip4_header_t * ip4, void *arg)
fib_index, IP_PROTOCOL_ICMP, 0);
if (!bibe)
return -1;
+
+ vlib_set_simple_counter (&nm->total_bibs, ctx->thread_index, 0,
+ db->bib.bib_entries_num);
}
nat64_extract_ip4 (&ip6->dst_address, &daddr.ip4, fib_index);
@@ -320,6 +329,9 @@ nat64_in2out_icmp_set_cb (ip6_header_t * ip6, ip4_header_t * ip4, void *arg)
&daddr.ip4, 0);
if (!ste)
return -1;
+
+ vlib_set_simple_counter (&nm->total_sessions, ctx->thread_index, 0,
+ db->st.st_entries_num);
}
nat64_session_reset_timeout (ste, ctx->vm);
@@ -549,6 +561,9 @@ nat64_in2out_unk_proto_set_cb (ip6_header_t * ip6, ip4_header_t * ip4,
0);
if (!bibe)
return -1;
+
+ vlib_set_simple_counter (&nm->total_bibs, s_ctx->thread_index, 0,
+ db->bib.bib_entries_num);
}
nat64_extract_ip4 (&ip6->dst_address, &daddr.ip4, fib_index);
@@ -556,6 +571,9 @@ nat64_in2out_unk_proto_set_cb (ip6_header_t * ip6, ip4_header_t * ip4,
nat64_db_st_entry_create (db, bibe, &ip6->dst_address, &daddr.ip4, 0);
if (!ste)
return -1;
+
+ vlib_set_simple_counter (&nm->total_sessions, s_ctx->thread_index, 0,
+ db->st.st_entries_num);
}
nat64_session_reset_timeout (ste, s_ctx->vm);
@@ -635,6 +653,9 @@ nat64_in2out_tcp_udp_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
sport, out_port, fib_index, proto, 0);
if (!bibe)
return -1;
+
+ vlib_set_simple_counter (&nm->total_bibs, thread_index, 0,
+ db->bib.bib_entries_num);
}
nat64_extract_ip4 (&ip6->dst_address, &daddr.ip4, fib_index);
@@ -643,6 +664,9 @@ nat64_in2out_tcp_udp_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
&daddr.ip4, dport);
if (!ste)
return -1;
+
+ vlib_set_simple_counter (&nm->total_sessions, thread_index, 0,
+ db->st.st_entries_num);
}
if (proto == IP_PROTOCOL_TCP)
@@ -890,6 +914,9 @@ nat64_in2out_unk_proto_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
0);
if (!bibe)
return -1;
+
+ vlib_set_simple_counter (&nm->total_bibs, thread_index, 0,
+ db->bib.bib_entries_num);
}
nat64_extract_ip4 (&ip6->dst_address, &daddr.ip4, fib_index);
@@ -897,6 +924,9 @@ nat64_in2out_unk_proto_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
nat64_db_st_entry_create (db, bibe, &ip6->dst_address, &daddr.ip4, 0);
if (!ste)
return -1;
+
+ vlib_set_simple_counter (&nm->total_sessions, thread_index, 0,
+ db->st.st_entries_num);
}
nat64_session_reset_timeout (ste, vm);
@@ -1510,6 +1540,8 @@ nat64_in2out_reass_node_fn (vlib_main_t * vm,
node->errors[NAT64_IN2OUT_ERROR_NO_TRANSLATION];
goto trace0;
}
+ vlib_set_simple_counter (&nm->total_bibs, thread_index,
+ 0, db->bib.bib_entries_num);
}
nat64_extract_ip4 (&ip60->dst_address, &daddr0.ip4,
fib_index0);
@@ -1524,6 +1556,9 @@ nat64_in2out_reass_node_fn (vlib_main_t * vm,
node->errors[NAT64_IN2OUT_ERROR_NO_TRANSLATION];
goto trace0;
}
+
+ vlib_set_simple_counter (&nm->total_sessions, thread_index,
+ 0, db->st.st_entries_num);
}
reass0->sess_index = nat64_db_st_entry_get_index (db, ste0);