aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo/mpls_label_dpo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/dpo/mpls_label_dpo.c')
-rw-r--r--src/vnet/dpo/mpls_label_dpo.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/vnet/dpo/mpls_label_dpo.c b/src/vnet/dpo/mpls_label_dpo.c
index ebbbbec9b64..0a7063cc99a 100644
--- a/src/vnet/dpo/mpls_label_dpo.c
+++ b/src/vnet/dpo/mpls_label_dpo.c
@@ -1204,11 +1204,44 @@ mpls_label_dpo_mem_show (void)
sizeof(mpls_label_dpo_t));
}
+/**
+ * Interpose a label DPO. used in the FIB unit tests
+ */
+static void
+mpls_label_interpose (const dpo_id_t *original,
+ const dpo_id_t *parent,
+ dpo_id_t *clone)
+{
+ mpls_label_dpo_t *mld, *mld_clone;
+
+ mld_clone = mpls_label_dpo_alloc();
+ mld = mpls_label_dpo_get(original->dpoi_index);
+
+ mld_clone->mld_locks = 0;
+ clib_memcpy(&mld_clone->mld_hdr,
+ &mld->mld_hdr,
+ sizeof(mld_clone->mld_hdr));
+ mld_clone->mld_payload_proto = mld->mld_payload_proto;
+ mld_clone->mld_n_labels = mld->mld_n_labels;
+ mld_clone->mld_n_hdr_bytes = mld->mld_n_hdr_bytes;
+
+ dpo_stack(mpls_label_dpo_types[MPLS_LABEL_DPO_FLAG_NONE],
+ mld_clone->mld_payload_proto,
+ &mld_clone->mld_dpo,
+ parent);
+
+ dpo_set(clone,
+ mpls_label_dpo_types[MPLS_LABEL_DPO_FLAG_NONE],
+ mld_clone->mld_payload_proto,
+ mpls_label_dpo_get_index(mld_clone));
+}
+
const static dpo_vft_t mld_vft = {
.dv_lock = mpls_label_dpo_lock,
.dv_unlock = mpls_label_dpo_unlock,
.dv_format = format_mpls_label_dpo,
.dv_mem_show = mpls_label_dpo_mem_show,
+ .dv_mk_interpose = mpls_label_interpose,
};
const static char* const mpls_label_imp_pipe_ip4_nodes[] =