diff --git a/orchagent/mirrororch.cpp b/orchagent/mirrororch.cpp index 3cff0bfd3c13..8547c4b41c70 100644 --- a/orchagent/mirrororch.cpp +++ b/orchagent/mirrororch.cpp @@ -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;