Skip to content

Commit

Permalink
Merge "If plen is zero, then there is no need to do LPM search."
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Dec 23, 2014
2 parents 0b3499d + 489b195 commit ec9d4ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/vnsw/agent/oper/inet_unicast_route.cc
Expand Up @@ -476,7 +476,7 @@ bool InetUnicastRouteEntry::EcmpDeletePath(AgentPath *path) {
* gateway without having Ipam path, then search continues further
*/
bool InetUnicastRouteEntry::IpamSubnetRouteAvailable() const {
if (IsHostRoute())
if ((IsHostRoute() == true) || (plen_ == 0))
return false;

//Local path present means that this route itself was programmed
Expand All @@ -490,6 +490,7 @@ bool InetUnicastRouteEntry::IpamSubnetRouteAvailable() const {
//and retain flood flag from that path.
uint16_t plen = plen_ - 1;
while (plen != 0) {
assert(plen < plen_);
InetUnicastRouteEntry key(NULL, addr_, plen, false);
InetUnicastRouteEntry *supernet_rt = table->FindRouteUsingKey(key);

Expand Down
14 changes: 14 additions & 0 deletions src/vnsw/agent/test/test_route.cc
Expand Up @@ -1634,6 +1634,20 @@ TEST_F(RouteTest, SubnetRoute_Flood_2) {
client->WaitForIdle();
}

TEST_F(RouteTest, null_ip_subnet_add) {
Ip4Address null_subnet_ip;
null_subnet_ip = Ip4Address::from_string("0.0.0.0");
AddRemoteVmRoute(null_subnet_ip, fabric_gw_ip_, 0, MplsTable::kStartLabel);

EXPECT_TRUE(RouteFind(vrf_name_, null_subnet_ip, 0));
InetUnicastRouteEntry *rt = RouteGet(vrf_name_, null_subnet_ip, 0);
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::TUNNEL);
EXPECT_FALSE(rt->ipam_subnet_route());

DeleteRoute(NULL, vrf_name_, null_subnet_ip, 0);
EXPECT_FALSE(RouteFind(vrf_name_, null_subnet_ip, 0));
}

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

0 comments on commit ec9d4ff

Please sign in to comment.