Skip to content

Commit

Permalink
Merge "Using the correct FMD and setting pkt_type correctly for mirro…
Browse files Browse the repository at this point in the history
…red packets"
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Mar 24, 2016
2 parents 00205fa + 40d058f commit 858085f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
11 changes: 6 additions & 5 deletions dp-core/vr_datapath.c
Expand Up @@ -553,16 +553,17 @@ vr_virtual_input(unsigned short vrf, struct vr_interface *vif,
fmd.fmd_vlan = vlan_id;
fmd.fmd_dvrf = vrf;

if (vr_pkt_type(pkt, 0, &fmd) < 0) {
vif_drop_pkt(vif, pkt, 1);
return 0;
}

if (vif->vif_flags & VIF_FLAG_MIRROR_RX) {
mfmd = fmd;
mfmd.fmd_dvrf = vif->vif_vrf;
vr_mirror(vif->vif_router, vif->vif_mirror_id, pkt, &fmd);
vr_mirror(vif->vif_router, vif->vif_mirror_id, pkt, &mfmd);
}

if (vr_pkt_type(pkt, 0, &fmd) < 0) {
vif_drop_pkt(vif, pkt, 1);
return 0;
}

/*
* we really do not allow any broadcast packets from interfaces
Expand Down
9 changes: 7 additions & 2 deletions dp-core/vr_mirror.c
Expand Up @@ -374,11 +374,11 @@ vr_mirror(struct vrouter *router, uint8_t mirror_id,
unsigned char default_mme[2] = {0xff, 0x0};
void *mirror_md;
unsigned char *buf;
struct vr_nexthop *nh;
struct vr_nexthop *nh, *pkt_nh;
struct vr_pcap *pcap;
struct vr_mirror_entry *mirror;
struct vr_mirror_meta_entry *mme;
struct vr_nexthop *pkt_nh;
struct vr_forwarding_md new_fmd;

/* If the packet is already mirrored, dont mirror again */
if (pkt->vp_flags & VP_FLAG_FROM_DP)
Expand All @@ -388,6 +388,11 @@ vr_mirror(struct vrouter *router, uint8_t mirror_id,
if (!mirror)
return 0;

if (fmd) {
memcpy(&new_fmd, fmd, sizeof(*fmd));
fmd = &new_fmd;
}

if (fmd->fmd_flow_index >= 0) {
mme = (struct vr_mirror_meta_entry *)vr_itable_get(router->vr_mirror_md,
fmd->fmd_flow_index);
Expand Down

0 comments on commit 858085f

Please sign in to comment.