From 99c13ddfc1137c95f075e55abfc38a40390bd251 Mon Sep 17 00:00:00 2001 From: jayaramsatya Date: Sat, 19 Nov 2016 10:32:31 +0530 Subject: [PATCH] if any label Change for the bridge route happen rebake for the label is not happening due to that always pointing to old label. Added Changes to handle the label change upon bridge route notify. Change-Id: I450952b8082729fd5528f5a5a94b4cee5124fffb closes-bug: #1641659 --- src/vnsw/agent/oper/mirror_table.cc | 21 +++++++++++++++------ src/vnsw/agent/oper/mirror_table.h | 4 ++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/vnsw/agent/oper/mirror_table.cc b/src/vnsw/agent/oper/mirror_table.cc index 135a6389c97..5c07c4c3447 100644 --- a/src/vnsw/agent/oper/mirror_table.cc +++ b/src/vnsw/agent/oper/mirror_table.cc @@ -448,7 +448,7 @@ bool MirrorTable::UnresolvedMirrorVrf(const VrfEntry *vrf, } // if the Unresolved remote mac is present it will return the entry MirrorEntry* -MirrorTable::UnresolvedMirrorEntry(VrfEntry *vrf, const MacAddress & mac, +MirrorTable::GetMirrorEntry(VrfEntry *vrf, const MacAddress & mac, VrfMirrorEntryList &list) { VrfMirrorEntryList::iterator it = list.find(vrf->GetName()); if (it == list.end()) { @@ -471,13 +471,22 @@ void MirrorTable::BridgeRouteTableNotify(DBTablePartBase *partition, if (bridge_rt->IsDeleted()) { ResyncResolvedMirrorEntry(bridge_rt->vrf()); } else { - MirrorEntry *mirror_entry = UnresolvedMirrorEntry(bridge_rt->vrf(), - bridge_rt->mac(), - unresolved_entry_list_); - if (mirror_entry && - mirror_entry->mirror_flags_ == + MirrorEntry *unresolved_mirror_entry = GetMirrorEntry(bridge_rt->vrf(), + bridge_rt->mac(), + unresolved_entry_list_); + MirrorEntry *resolved_mirror_entry = GetMirrorEntry(bridge_rt->vrf(), + bridge_rt->mac(), + resolved_entry_list_); + // Check for Both resolved and unresolved list for Change in route + if (unresolved_mirror_entry && + unresolved_mirror_entry->mirror_flags_ == MirrorEntryData::DynamicNH_Without_JuniperHdr) { ResyncUnresolvedMirrorEntry(bridge_rt->vrf()); + } else if (resolved_mirror_entry && + ((resolved_mirror_entry->vni_ != bridge_rt->GetActiveLabel()) || + (resolved_mirror_entry->nh_ != + bridge_rt->GetActivePath()->nexthop()))) { + ResyncResolvedMirrorEntry(bridge_rt->vrf()); } } } diff --git a/src/vnsw/agent/oper/mirror_table.h b/src/vnsw/agent/oper/mirror_table.h index 9b0dd539b30..6f4785ad74f 100644 --- a/src/vnsw/agent/oper/mirror_table.h +++ b/src/vnsw/agent/oper/mirror_table.h @@ -160,8 +160,8 @@ class MirrorTable : public AgentDBTable { void UnRegisterBridgeRouteTableListener(const VrfEntry *entry, MirrorVrfState *state); bool UnresolvedMirrorVrf(const VrfEntry *vrf, VrfMirrorEntryList &list); - MirrorEntry* UnresolvedMirrorEntry(VrfEntry *vrf, const MacAddress & mac, - VrfMirrorEntryList &list); + MirrorEntry* GetMirrorEntry(VrfEntry *vrf, const MacAddress & mac, + VrfMirrorEntryList &list); static MirrorEntryData::MirrorEntryFlags DecodeMirrorFlag (const std::string &nh_mode, bool juniper_header); void DeleteMirrorVrf(MirrorEntry *entry);