aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat64_out2in.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_out2in.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_out2in.c')
-rw-r--r--src/plugins/nat/nat64_out2in.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/plugins/nat/nat64_out2in.c b/src/plugins/nat/nat64_out2in.c
index ba35de1e2a1..437052fc441 100644
--- a/src/plugins/nat/nat64_out2in.c
+++ b/src/plugins/nat/nat64_out2in.c
@@ -165,6 +165,12 @@ nat64_out2in_tcp_udp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
nat64_compose_ip6 (&ip6_saddr, &ip4->src_address, bibe->fib_index);
ste =
nat64_db_st_entry_create (db, bibe, &ip6_saddr, &saddr.ip4, sport);
+
+ if (!ste)
+ return -1;
+
+ vlib_set_simple_counter (&nm->total_sessions, ctx->thread_index, 0,
+ db->st.st_entries_num);
}
ip6->src_address.as_u64[0] = ste->in_r_addr.as_u64[0];
@@ -240,6 +246,12 @@ nat64_out2in_icmp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6, void *arg)
nat64_compose_ip6 (&ip6_saddr, &ip4->src_address, bibe->fib_index);
ste =
nat64_db_st_entry_create (db, bibe, &ip6_saddr, &saddr.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);
@@ -397,6 +409,12 @@ nat64_out2in_unk_proto_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
nat64_compose_ip6 (&ip6_saddr, &ip4->src_address, bibe->fib_index);
ste = nat64_db_st_entry_create (db, bibe, &ip6_saddr, &saddr.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);
@@ -802,6 +820,9 @@ nat64_out2in_reass_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
node->errors[NAT64_OUT2IN_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);
reass0->thread_index = thread_index;