aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/ioam/export
diff options
context:
space:
mode:
authorAkshayaNadahalli <anadahal@cisco.com>2016-12-01 16:33:51 +0530
committerNeale Ranns <nranns@cisco.com>2017-02-13 08:36:59 +0000
commitfdd81af6afe6c782ad2c1a139210378badec626b (patch)
treeb562b391bded3afc0f5b4d0f83eceb20f2c8e772 /src/plugins/ioam/export
parentfed79e83910459ed700615d2a5a24024f835a66c (diff)
VPP-632 : InBand OAM Analyser
Refer to jira ticket for more details. Change-Id: I6facb9ef8553a21464f9a2e612706f152badbb68 Signed-off-by: AkshayaNadahalli <anadahal@cisco.com>
Diffstat (limited to 'src/plugins/ioam/export')
-rw-r--r--src/plugins/ioam/export/ioam_export.c6
-rw-r--r--src/plugins/ioam/export/node.c18
2 files changed, 23 insertions, 1 deletions
diff --git a/src/plugins/ioam/export/ioam_export.c b/src/plugins/ioam/export/ioam_export.c
index 06634baaf4b..1112ce4f66d 100644
--- a/src/plugins/ioam/export/ioam_export.c
+++ b/src/plugins/ioam/export/ioam_export.c
@@ -81,6 +81,10 @@ do { \
#define foreach_ioam_export_plugin_api_msg \
_(IOAM_EXPORT_IP6_ENABLE_DISABLE, ioam_export_ip6_enable_disable)
+ioam_export_main_t ioam_export_main;
+
+vlib_node_registration_t export_node;
+
/* Action function shared between message handler and debug CLI */
int
@@ -232,6 +236,8 @@ ioam_export_init (vlib_main_t * vm)
em->vlib_main = vm;
em->vnet_main = vnet_get_main ();
+ em->set_id = IPFIX_IOAM_EXPORT_ID;
+ ioam_export_reset_next_node (em);
name = format (0, "ioam_export_%08x%c", api_version, 0);
diff --git a/src/plugins/ioam/export/node.c b/src/plugins/ioam/export/node.c
index 19f143dfbf3..b32d7841690 100644
--- a/src/plugins/ioam/export/node.c
+++ b/src/plugins/ioam/export/node.c
@@ -17,8 +17,10 @@
#include <vnet/pg/pg.h>
#include <vppinfra/error.h>
#include <vnet/ip/ip.h>
+#include <vnet/ip/ip6_hop_by_hop.h>
#include <ioam/export-common/ioam_export.h>
+
typedef struct
{
u32 next_index;
@@ -119,6 +121,20 @@ copy3cachelines (void *dst, const void *src, size_t n)
#endif
}
+static void
+ip6_export_fixup_func (vlib_buffer_t * export_buf, vlib_buffer_t * pak_buf)
+{
+ ip6_header_t *ip6_temp =
+ (ip6_header_t *) (export_buf->data + export_buf->current_length);
+ u32 flow_label_temp =
+ clib_net_to_host_u32(ip6_temp->ip_version_traffic_class_and_flow_label)
+ & 0xFFF00000;
+ flow_label_temp |=
+ IOAM_MASK_DECAP_BIT((vnet_buffer(pak_buf)->l2_classify.opaque_index));
+ ip6_temp->ip_version_traffic_class_and_flow_label =
+ clib_host_to_net_u32(flow_label_temp);
+}
+
static uword
ip6_export_node_fn (vlib_main_t * vm,
vlib_node_runtime_t * node, vlib_frame_t * frame)
@@ -126,7 +142,7 @@ ip6_export_node_fn (vlib_main_t * vm,
ioam_export_main_t *em = &ioam_export_main;
ioam_export_node_common(em, vm, node, frame, ip6_header_t, payload_length,
ip_version_traffic_class_and_flow_label,
- EXPORT_NEXT_POP_HBYH);
+ EXPORT_NEXT_POP_HBYH, ip6_export_fixup_func);
return frame->n_vectors;
}