From b505605ae13c344dcd9716c1960b884311d37922 Mon Sep 17 00:00:00 2001 From: "Anand H. Krishnan" Date: Wed, 15 Jun 2016 15:54:24 +0530 Subject: [PATCH] For mirroring, ECMP index should not come from parent flow In the case of mirror to an ECMP destination, we can not take the ECMP index that is set in the flow of the parent (the flow/packet that is mirrored). Hence, set the ECMP index to -1. Also, there isn't a flow that maps to the mirror packet. So, extract all the information that is needed from the parent flow and set the flow index in the forrwarding metadata to -1. Change-Id: Ib3a0f77490153fbe69c35eaa201fbf40b6897d4d Closes-BUG: #1566650 --- dp-core/vr_mirror.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dp-core/vr_mirror.c b/dp-core/vr_mirror.c index d8f380663..eb6c9e974 100644 --- a/dp-core/vr_mirror.c +++ b/dp-core/vr_mirror.c @@ -390,10 +390,14 @@ vr_mirror(struct vrouter *router, uint8_t mirror_id, if (!mirror) return 0; + /* in almost all the cases, fmd should be set */ if (fmd) { memcpy(&new_fmd, fmd, sizeof(*fmd)); - fmd = &new_fmd; + new_fmd.fmd_ecmp_nh_index = -1; + } else { + vr_init_forwarding_md(&new_fmd); } + fmd = &new_fmd; if (fmd->fmd_flow_index >= 0) { mme = (struct vr_mirror_meta_entry *)vr_itable_get(router->vr_mirror_md, @@ -482,6 +486,12 @@ vr_mirror(struct vrouter *router, uint8_t mirror_id, if (nh->nh_vrf >= 0) fmd->fmd_dvrf = nh->nh_vrf; + /* + * we are now in the mirroring context and there isn't a flow for this + * mirror packet. hence, set the flow index to -1. + */ + fmd->fmd_flow_index = -1; + nh_output(pkt, nh, fmd); return 0;