Skip to content

Commit

Permalink
[mirrororch]: Set the VLAN header only when the packet is mirrored to…
Browse files Browse the repository at this point in the history
… a VLAN (sonic-net#282)
  • Loading branch information
qiluo-msft authored and Shu0T1an ChenG committed Aug 9, 2017
1 parent 38f2bf3 commit 93de3ad
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions orchagent/mirrororch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,25 +396,29 @@ bool MirrorOrch::activateSession(const string& name, MirrorEntry& session)
attr.value.s32 = SAI_MIRROR_SESSION_TYPE_ENHANCED_REMOTE;
attrs.push_back(attr);

attr.id = SAI_MIRROR_SESSION_ATTR_VLAN_HEADER_VALID;
attr.value.booldata = true;
attrs.push_back(attr);
/* Add the VLAN header when the packet is sent out from a VLAN */
if (session.neighborInfo.vlanId)
{
attr.id = SAI_MIRROR_SESSION_ATTR_VLAN_HEADER_VALID;
attr.value.booldata = true;
attrs.push_back(attr);

attr.id =SAI_MIRROR_SESSION_ATTR_VLAN_TPID;
attr.value.u16 = ETH_P_8021Q;
attrs.push_back(attr);
attr.id =SAI_MIRROR_SESSION_ATTR_VLAN_TPID;
attr.value.u16 = ETH_P_8021Q;
attrs.push_back(attr);

attr.id =SAI_MIRROR_SESSION_ATTR_VLAN_ID;
attr.value.u16 = session.neighborInfo.vlanId;
attrs.push_back(attr);
attr.id =SAI_MIRROR_SESSION_ATTR_VLAN_ID;
attr.value.u16 = session.neighborInfo.vlanId;
attrs.push_back(attr);

attr.id = SAI_MIRROR_SESSION_ATTR_VLAN_PRI;
attr.value.u8 = MIRROR_SESSION_DEFAULT_VLAN_PRI;
attrs.push_back(attr);
attr.id = SAI_MIRROR_SESSION_ATTR_VLAN_PRI;
attr.value.u8 = MIRROR_SESSION_DEFAULT_VLAN_PRI;
attrs.push_back(attr);

attr.id = SAI_MIRROR_SESSION_ATTR_VLAN_CFI;
attr.value.u8 = MIRROR_SESSION_DEFAULT_VLAN_CFI;
attrs.push_back(attr);
attr.id = SAI_MIRROR_SESSION_ATTR_VLAN_CFI;
attr.value.u8 = MIRROR_SESSION_DEFAULT_VLAN_CFI;
attrs.push_back(attr);
}

attr.id = SAI_MIRROR_SESSION_ATTR_ERSPAN_ENCAPSULATION_TYPE;
attr.value.s32 = SAI_ERSPAN_ENCAPSULATION_TYPE_MIRROR_L3_GRE_TUNNEL;
Expand Down

0 comments on commit 93de3ad

Please sign in to comment.