Skip to content

Commit

Permalink
VRF deletetimeout
Browse files Browse the repository at this point in the history
Problem:
Fix for bug#1666139 broke code where mpls label change handling for fmg.
Old fabric label can not be reliably picked from fmg path. It can be only picked
from multicast master path. Solution should take care of this point along with
not breaking 1666139.

Solution:
Pick up old fmg label as done prior to fix of 1666139, but check for reserved
fmg label to identify if multicast path is having evpn or fmg label.

Change-Id: I056b61867498f6ec83c11babc2b6aaabcc09a3e9
Closes-bug: #1681083
  • Loading branch information
manishsing committed Apr 30, 2017
1 parent 9351c7c commit 576a857
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/vnsw/agent/oper/bridge_route.cc
Expand Up @@ -442,8 +442,8 @@ void BridgeRouteEntry::DeletePathUsingKeyData(const AgentRouteKey *key,
if (force_delete && (path->peer()->GetType() ==
Peer::BGP_PEER)) {
delete_path = true;
} else if (is_multicast()) {
assert(path->peer()->GetType() == Peer::BGP_PEER);
} else if (is_multicast() &&
(path->peer()->GetType() == Peer::BGP_PEER)) {
//BGP peer path uses channel peer unicast sequence number.
//If it is stale, then delete same.
if (data->CanDeletePath(agent, path, this) == false) {
Expand Down Expand Up @@ -644,7 +644,6 @@ bool BridgeRouteEntry::ReComputeMulticastPaths(AgentPath *path, bool del) {
AgentPath *tor_peer_path = NULL;
AgentPath *local_peer_path = NULL;
bool tor_path = false;
uint32_t old_fabric_mpls_label = 0;

const CompositeNH *cnh =
static_cast<const CompositeNH *>(path->nexthop());
Expand Down Expand Up @@ -696,7 +695,6 @@ bool BridgeRouteEntry::ReComputeMulticastPaths(AgentPath *path, bool del) {
} else if (it_path->peer()->GetType() ==
Peer::MULTICAST_FABRIC_TREE_BUILDER) {
fabric_peer_path = it_path;
old_fabric_mpls_label = fabric_peer_path->label();
} else if (it_path->peer() == agent->multicast_peer()) {
multicast_peer_path = it_path;
} else if (it_path->peer() == agent->local_peer()) {
Expand Down Expand Up @@ -735,9 +733,18 @@ bool BridgeRouteEntry::ReComputeMulticastPaths(AgentPath *path, bool del) {

bool learning_enabled = false;
bool pbb_nh = false;
uint32_t old_fabric_mpls_label = 0;
if (multicast_peer_path == NULL) {
multicast_peer_path = new AgentPath(agent->multicast_peer(), NULL);
InsertPath(multicast_peer_path);
} else {
//Multicast peer path can have evpn or fabric label.
//Identify using isfabricmulticastlabel.
if (agent->mpls_table()->
IsFabricMulticastLabel(multicast_peer_path->label()))
{
old_fabric_mpls_label = multicast_peer_path->label();
}
}

ComponentNHKeyList component_nh_list;
Expand Down
37 changes: 37 additions & 0 deletions src/vnsw/agent/resource_manager/test/test_mpls_label.cc
Expand Up @@ -150,6 +150,43 @@ TEST_F(AgentDbEntry, bug_1680720) {
delete nh_state;
}

//Bug# 1681083
TEST_F(AgentDbEntry, fmg_label_freed_on_no_use_1681083) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:01:01:01:10", 1, 1},
};

client->Reset();
//Alloc label
CreateVmportEnv(input, 1);
client->WaitForIdle();
agent_->mpls_table()->ReserveMulticastLabel(4000, 5000, 0);

//Test
//Add fabric group multicast route
TunnelOlist olist;
Ip4Address sip(0);
Ip4Address broadcast(0xFFFFFFFF);
MulticastHandler *mc_handler = static_cast<MulticastHandler *>(agent_->
oper_db()->multicast());
olist.push_back(OlistTunnelEntry(nil_uuid(), 10,
IpAddress::from_string("8.8.8.8").to_v4(),
TunnelType::MplsType()));
mc_handler->ModifyFabricMembers(agent_->multicast_tree_builder_peer(),
"vrf1", broadcast, sip, 4100, olist, 1);
client->WaitForIdle();
EXPECT_TRUE(agent_->mpls_table()->FindMplsLabel(4100) != NULL);
mc_handler->ModifyFabricMembers(agent_->multicast_tree_builder_peer(),
"vrf1", broadcast, sip, 4101, olist, 1);
client->WaitForIdle();
EXPECT_TRUE(agent_->mpls_table()->FindMplsLabel(4100) == NULL);
EXPECT_TRUE(agent_->mpls_table()->FindMplsLabel(4101) != NULL);

//Delete label
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
}

int main(int argc, char *argv[]) {
GETUSERARGS();
client = TestInit(init_file, ksync_init, true, true, false);
Expand Down

0 comments on commit 576a857

Please sign in to comment.