summaryrefslogtreecommitdiffstats
path: root/src/plugins/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/map')
-rw-r--r--src/plugins/map/ip4_map.c9
-rw-r--r--src/plugins/map/ip4_map_t.c14
-rw-r--r--src/plugins/map/ip6_map.c12
-rw-r--r--src/plugins/map/ip6_map_t.c14
-rw-r--r--src/plugins/map/map.api114
-rw-r--r--src/plugins/map/map.h33
6 files changed, 128 insertions, 68 deletions
diff --git a/src/plugins/map/ip4_map.c b/src/plugins/map/ip4_map.c
index a4889627f0b..1ab5cc2dc4f 100644
--- a/src/plugins/map/ip4_map.c
+++ b/src/plugins/map/ip4_map.c
@@ -325,13 +325,6 @@ ip4_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
return frame->n_vectors;
}
-static char *map_error_strings[] = {
-#define _(sym,string) string,
- foreach_map_error
-#undef _
-};
-
-
/* *INDENT-OFF* */
VNET_FEATURE_INIT (ip4_map_feature, static) =
{
@@ -349,7 +342,7 @@ VLIB_REGISTER_NODE(ip4_map_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP4_MAP_N_NEXT,
.next_nodes = {
diff --git a/src/plugins/map/ip4_map_t.c b/src/plugins/map/ip4_map_t.c
index 7d16d7aa455..8ae76f331f6 100644
--- a/src/plugins/map/ip4_map_t.c
+++ b/src/plugins/map/ip4_map_t.c
@@ -684,12 +684,6 @@ ip4_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
return frame->n_vectors;
}
-static char *map_t_error_strings[] = {
-#define _(sym,string) string,
- foreach_map_error
-#undef _
-};
-
/* *INDENT-OFF* */
VNET_FEATURE_INIT (ip4_map_t_feature, static) = {
.arc_name = "ip4-unicast",
@@ -706,7 +700,7 @@ VLIB_REGISTER_NODE(ip4_map_t_fragmented_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_t_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP4_MAPT_FRAGMENTED_N_NEXT,
.next_nodes = {
@@ -727,7 +721,7 @@ VLIB_REGISTER_NODE(ip4_map_t_icmp_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_t_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP4_MAPT_ICMP_N_NEXT,
.next_nodes = {
@@ -748,7 +742,7 @@ VLIB_REGISTER_NODE(ip4_map_t_tcp_udp_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_t_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP4_MAPT_TCP_UDP_N_NEXT,
.next_nodes = {
@@ -769,7 +763,7 @@ VLIB_REGISTER_NODE(ip4_map_t_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_t_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP4_MAPT_N_NEXT,
.next_nodes = {
diff --git a/src/plugins/map/ip6_map.c b/src/plugins/map/ip6_map.c
index 136f548db50..1193dda0a80 100644
--- a/src/plugins/map/ip6_map.c
+++ b/src/plugins/map/ip6_map.c
@@ -803,12 +803,6 @@ ip6_map_icmp_relay (vlib_main_t * vm,
}
-static char *map_error_strings[] = {
-#define _(sym,string) string,
- foreach_map_error
-#undef _
-};
-
/* *INDENT-OFF* */
VNET_FEATURE_INIT (ip6_map_feature, static) =
{
@@ -826,7 +820,7 @@ VLIB_REGISTER_NODE(ip6_map_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP6_MAP_N_NEXT,
.next_nodes = {
@@ -852,7 +846,7 @@ VLIB_REGISTER_NODE(ip6_map_post_ip4_reass_node) = {
.format_trace = format_ip6_map_post_ip4_reass_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP6_MAP_POST_IP4_REASS_N_NEXT,
.next_nodes = {
[IP6_MAP_POST_IP4_REASS_NEXT_IP4_LOOKUP] = "ip4-lookup",
@@ -870,7 +864,7 @@ VLIB_REGISTER_NODE(ip6_map_icmp_relay_node, static) = {
.format_trace = format_map_trace, //FIXME
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP6_ICMP_RELAY_N_NEXT,
.next_nodes = {
[IP6_ICMP_RELAY_NEXT_IP4_LOOKUP] = "ip4-lookup",
diff --git a/src/plugins/map/ip6_map_t.c b/src/plugins/map/ip6_map_t.c
index 874a14c99ed..861c049b0f4 100644
--- a/src/plugins/map/ip6_map_t.c
+++ b/src/plugins/map/ip6_map_t.c
@@ -687,12 +687,6 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
return frame->n_vectors;
}
-static char *map_t_error_strings[] = {
-#define _(sym, string) string,
- foreach_map_error
-#undef _
-};
-
/* *INDENT-OFF* */
VLIB_REGISTER_NODE(ip6_map_t_fragmented_node) = {
.function = ip6_map_t_fragmented,
@@ -702,7 +696,7 @@ VLIB_REGISTER_NODE(ip6_map_t_fragmented_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_t_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP6_MAPT_FRAGMENTED_N_NEXT,
.next_nodes =
@@ -724,7 +718,7 @@ VLIB_REGISTER_NODE(ip6_map_t_icmp_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_t_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP6_MAPT_ICMP_N_NEXT,
.next_nodes =
@@ -746,7 +740,7 @@ VLIB_REGISTER_NODE(ip6_map_t_tcp_udp_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_t_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP6_MAPT_TCP_UDP_N_NEXT,
.next_nodes =
@@ -775,7 +769,7 @@ VLIB_REGISTER_NODE(ip6_map_t_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = MAP_N_ERROR,
- .error_strings = map_t_error_strings,
+ .error_counters = map_error_counters,
.n_next_nodes = IP6_MAPT_N_NEXT,
.next_nodes =
diff --git a/src/plugins/map/map.api b/src/plugins/map/map.api
index fa32978591c..dfe255bf349 100644
--- a/src/plugins/map/map.api
+++ b/src/plugins/map/map.api
@@ -349,3 +349,117 @@ define map_param_get_reply
bool tc_copy;
u8 tc_class;
};
+
+/*
+ * MAP Error counters/messages
+ */
+counters map {
+ none {
+ severity info;
+ type counter64;
+ units "packets";
+ description "valid MAP packets";
+ };
+ bad_protocol {
+ severity error;
+ type counter64;
+ units "packets";
+ description "bad protocol";
+ };
+ sec_check {
+ severity error;
+ type counter64;
+ units "packets";
+ description "security check failed";
+ };
+ encap_sec_check {
+ severity error;
+ type counter64;
+ units "packets";
+ description "encap security check failed";
+ };
+ decap_sec_check {
+ severity error;
+ type counter64;
+ units "packets";
+ description "decap security check failed";
+ };
+ icmp {
+ severity error;
+ type counter64;
+ units "packets";
+ description "unable to translate ICMP";
+ };
+ icmp_relay {
+ severity error;
+ type counter64;
+ units "packets";
+ description "unable to relay ICMP";
+ };
+ unknown {
+ severity error;
+ type counter64;
+ units "packets";
+ description "unknown";
+ };
+ no_binding {
+ severity error;
+ type counter64;
+ units "packets";
+ description "no binding";
+ };
+ no_domain {
+ severity error;
+ type counter64;
+ units "packets";
+ description "no domain";
+ };
+ fragmented {
+ severity error;
+ type counter64;
+ units "packets";
+ description "packet is a fragment";
+ };
+ fragment_memory {
+ severity error;
+ type counter64;
+ units "packets";
+ description "could not cache fragment";
+ };
+ fragment_malformed {
+ severity error;
+ type counter64;
+ units "packets";
+ description "fragment has unexpected format";
+ };
+ fragment_dropped {
+ severity error;
+ type counter64;
+ units "packets";
+ description "dropped cached fragment";
+ };
+ malformed {
+ severity error;
+ type counter64;
+ units "packets";
+ description "malformed packet";
+ };
+ df_set {
+ severity error;
+ type counter64;
+ units "packets";
+ description "can't fragment, DF set";
+ };
+ time_exceeded {
+ severity error;
+ type counter64;
+ units "packets";
+ description "time exceeded";
+ };
+};
+paths {
+ "/err/ip4-map" "map";
+ "/err/ip6-map" "map";
+ "/err/ip4-t-map" "map";
+ "/err/ip6-t-map" "map";
+};
diff --git a/src/plugins/map/map.h b/src/plugins/map/map.h
index 16fc60478b5..215a832f431 100644
--- a/src/plugins/map/map.h
+++ b/src/plugins/map/map.h
@@ -23,6 +23,7 @@
#include <vnet/dpo/load_balance.h>
#include "lpm.h"
#include <vppinfra/lock.h>
+#include <map/map.api_enum.h>
#define MAP_SKIP_IP6_LOOKUP 1
@@ -205,37 +206,7 @@ typedef struct
uword ip4_sv_reass_custom_next_index;
} map_main_t;
-/*
- * MAP Error counters/messages
- */
-#define foreach_map_error \
- /* Must be first. */ \
- _(NONE, "valid MAP packets") \
- _(BAD_PROTOCOL, "bad protocol") \
- _(SEC_CHECK, "security check failed") \
- _(ENCAP_SEC_CHECK, "encap security check failed") \
- _(DECAP_SEC_CHECK, "decap security check failed") \
- _(ICMP, "unable to translate ICMP") \
- _(ICMP_RELAY, "unable to relay ICMP") \
- _(UNKNOWN, "unknown") \
- _(NO_BINDING, "no binding") \
- _(NO_DOMAIN, "no domain") \
- _(FRAGMENTED, "packet is a fragment") \
- _(FRAGMENT_MEMORY, "could not cache fragment") \
- _(FRAGMENT_MALFORMED, "fragment has unexpected format")\
- _(FRAGMENT_DROPPED, "dropped cached fragment") \
- _(MALFORMED, "malformed packet") \
- _(DF_SET, "can't fragment, DF set") \
- _(TIME_EXCEEDED, "time exceeded") \
-
-typedef enum
-{
-#define _(sym,str) MAP_ERROR_##sym,
- foreach_map_error
-#undef _
- MAP_N_ERROR,
-} map_error_t;
-
+typedef vl_counter_map_enum_t map_error_t;
u64 map_error_counter_get (u32 node_index, map_error_t map_error);
typedef struct