summaryrefslogtreecommitdiffstats
path: root/src/plugins/npt66/npt66_node.c
diff options
context:
space:
mode:
authorOle Troan <otroan@employees.org>2023-10-12 13:38:38 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2023-10-13 08:27:26 +0000
commitbdeee2194b09c85ec1087550177555a24cc5d875 (patch)
tree94715e7acfcaad49d143afb2b47e1b3d4a0e77ca /src/plugins/npt66/npt66_node.c
parent054aa8c2f2681e3a4a4af02d9119fb6eaa5dbad6 (diff)
npt66: add show command and rx/tx counters
Add show npt66 bindings. Add RX/TX and translation error counters. Type: improvement Change-Id: I4513b111f815a15d5a7537ce503f0c084b523aa1 Signed-off-by: Ole Troan <otroan@employees.org>
Diffstat (limited to 'src/plugins/npt66/npt66_node.c')
-rw-r--r--src/plugins/npt66/npt66_node.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/plugins/npt66/npt66_node.c b/src/plugins/npt66/npt66_node.c
index 960e4d446dd..ebe33593700 100644
--- a/src/plugins/npt66/npt66_node.c
+++ b/src/plugins/npt66/npt66_node.c
@@ -9,6 +9,7 @@
#include <vnet/ip/ip6_packet.h>
#include <npt66/npt66.h>
+#include <npt66/npt66.api_enum.h>
typedef struct
{
@@ -197,11 +198,17 @@ npt66_node_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
int rv = npt66_translate (ip, binding, dir);
if (rv < 0)
{
- clib_warning ("npt66_translate failed");
+ vlib_node_increment_counter (vm, node->node_index,
+ NPT66_ERROR_TRANSLATION, 1);
*next = NPT66_NEXT_DROP;
+ goto next;
}
+ else if (dir == VLIB_TX)
+ vlib_node_increment_counter (vm, node->node_index, NPT66_ERROR_TX, 1);
+ else
+ vlib_node_increment_counter (vm, node->node_index, NPT66_ERROR_RX, 1);
- /*next: */
+ next:
next += 1;
n_left_from -= 1;
b += 1;
@@ -260,8 +267,8 @@ VLIB_REGISTER_NODE(npt66_input_node) = {
.vector_size = sizeof(u32),
.format_trace = format_npt66_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
- // .n_errors = NPT66_N_ERROR,
- // .error_counters = npt66_error_counters,
+ .n_errors = NPT66_N_ERROR,
+ .error_counters = npt66_error_counters,
.n_next_nodes = NPT66_N_NEXT,
.next_nodes =
{
@@ -274,8 +281,8 @@ VLIB_REGISTER_NODE (npt66_output_node) = {
.vector_size = sizeof (u32),
.format_trace = format_npt66_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
- // .n_errors = npt66_N_ERROR,
- // .error_counters = npt66_error_counters,
+ .n_errors = NPT66_N_ERROR,
+ .error_counters = npt66_error_counters,
.sibling_of = "npt66-input",
};