Skip to content

Commit

Permalink
Double path delete request in succession.
Browse files Browse the repository at this point in the history
Problem:
In stale path cleanup, if no stale path was found function used to clean last
path seen. This resulted in not related path getting deleted. In case of OVS
delete the path to be deleted was already gone because of bug and table deleted,
resulting in ceash.

Solution:
Delete if relevant path is found.
Closes-bug: #1571598

Change-Id: I25bd7cec4c0774d0a041286c15af99bc5a2d1ada
  • Loading branch information
manishsing committed Apr 19, 2016
1 parent 0f1b569 commit 217fa01
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/vnsw/agent/oper/agent_route.cc
Expand Up @@ -532,12 +532,11 @@ void AgentRouteTable::SquashStalePaths(AgentRoute *route,
if (path->is_stale() && (path != exception_path)) {
// Since we squash stales, at any point of time there should be only
// one stale other than exception_path in list
break;
DeletePathFromPeer(route->get_table_partition(), route, path);
return;
}
it++;
}
DeletePathFromPeer(route->get_table_partition(), route, path);
return;
}

uint32_t AgentRoute::GetActiveLabel() const {
Expand Down
56 changes: 56 additions & 0 deletions src/vnsw/agent/test/test_l2route.cc
Expand Up @@ -1585,6 +1585,62 @@ TEST_F(RouteTest, StalePathDeleteRouteDelete) {
client->WaitForIdle();
}

class SetupTask : public Task {
public:
SetupTask(RouteTest *test, std::string name) :
Task((TaskScheduler::GetInstance()->
GetTaskId("db::DBTable")), 0), test_(test),
test_name_(name) {
}

virtual bool Run() {
if (test_name_ == "SquashPathTest_1") {
char local_vm_mac_str_[100];
MacAddress local_vm_mac_;
Ip4Address local_vm_ip4_;
char local_vm_ip4_str_[100];
strcpy(local_vm_ip4_str_, "1.1.1.10");
local_vm_ip4_ = Ip4Address::from_string(local_vm_ip4_str_);
strcpy(local_vm_mac_str_, "00:00:01:01:01:10");
local_vm_mac_ = MacAddress::FromString(local_vm_mac_str_);
EvpnRouteEntry *rt = EvpnRouteGet("vrf1",
local_vm_mac_,
local_vm_ip4_,
0);
const VrfEntry *vrf = VrfGet("vrf1");
vrf->GetEvpnRouteTable()->SquashStalePaths(rt, NULL);
}
return true;
}
std::string Description() const { return "SetupTask"; }
private:
RouteTest *test_;
std::string test_name_;
};

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

client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();

EvpnRouteEntry *rt = EvpnRouteGet("vrf1", local_vm_mac_, local_vm_ip4_, 0);
EXPECT_TRUE(rt != NULL);
EXPECT_TRUE(rt->GetActivePath() != NULL);
SetupTask * task = new SetupTask(this, "SquashPathTest_1");
TaskScheduler::GetInstance()->Enqueue(task);
client->WaitForIdle();
rt = EvpnRouteGet("vrf1", local_vm_mac_, local_vm_ip4_, 0);
EXPECT_TRUE(rt != NULL);

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

int main(int argc, char *argv[]) {
::testing::InitGoogleTest(&argc, argv);
GETUSERARGS();
Expand Down

0 comments on commit 217fa01

Please sign in to comment.