Skip to content

Commit

Permalink
For mirroring, ECMP index should not come from parent flow
Browse files Browse the repository at this point in the history
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
  • Loading branch information
anandhk-juniper committed Jun 15, 2016
1 parent 53e1a81 commit b505605
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion dp-core/vr_mirror.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit b505605

Please sign in to comment.