Skip to content

Commit

Permalink
Issue:
Browse files Browse the repository at this point in the history
-----
This Crash is seen becuase while getting the Policy enabled NH, the
interface marked as delete.
Fix:
----
Before getting the Policy enabled NH Check for Interface
active if it is not active,  mark that flow as short flow.
closes-bug: #1572418

Change-Id: I4b8d0ece581a2963860203777a53c151b2f4dfa0
  • Loading branch information
jayaramsatya committed Jun 3, 2016
1 parent d09b6b5 commit 1c94e54
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/vnsw/agent/pkt/pkt_flow_info.cc
Expand Up @@ -302,7 +302,15 @@ static bool NhDecode(const NextHop *nh, const PktInfo *pkt, PktFlowInfo *info,
//use policy disabled interface
if (local_intf &&
local_intf->type() == Interface::VM_INTERFACE) {
out->nh_ = GetPolicyEnabledNH(nh_table, local_nh)->id();
if (local_nh->IsActive()) {
out->nh_ =
GetPolicyEnabledNH(nh_table, local_nh)->id();
} else {
LogError(pkt, "Invalid or Inactive ifindex");
info->short_flow = true;
info->short_flow_reason =
FlowEntry::SHORT_UNAVIALABLE_INTERFACE;
}
}
}
} else {
Expand Down
48 changes: 48 additions & 0 deletions src/vnsw/agent/pkt/test/test_flow_error.cc
Expand Up @@ -252,6 +252,54 @@ TEST_F(FlowTest, Flow_ksync_nh_state_find_failure) {
client->WaitForIdle();
}

TEST_F(FlowTest, Flow_Deleted_Interace_nh) {
EXPECT_EQ(0U, get_flow_proto()->FlowCount());
//Create PHYSICAL interface to receive GRE packets on it.
FlowSetup();
PhysicalInterfaceKey key(eth_itf);
Interface *intf = static_cast<Interface *>
(agent()->interface_table()->FindActiveEntry(&key));

EXPECT_TRUE(intf != NULL);
CreateRemoteRoute("vrf6", remote_vm1_ip, remote_router_ip, 30, "vn6");
client->WaitForIdle();
TestFlow flow[] = {
{
TestFlowPkt(Address::INET, vm_a_ip, remote_vm1_ip, 1, 0, 0, "vrf6",
flow5->id()),
{
}
}
};
//remove policy enabled Interface
DBRequest req(DBRequest::DB_ENTRY_DELETE);
req.key.reset(new InterfaceNHKey
(new VmInterfaceKey(AgentKey::ADD_DEL_CHANGE, flow5->GetUuid(), ""),
true, InterfaceNHFlags::INET4));
req.data.reset(NULL);
NextHopTable::GetInstance()->Enqueue(&req);
//remove policy disabled Interface
DBRequest req1(DBRequest::DB_ENTRY_DELETE);
client->WaitForIdle(1);
req1.key.reset(new InterfaceNHKey
(new VmInterfaceKey(AgentKey::ADD_DEL_CHANGE, flow5->GetUuid(), ""),
false, InterfaceNHFlags::INET4));
req1.data.reset(NULL);
NextHopTable::GetInstance()->Enqueue(&req1);

CreateFlow(flow, 1);
client->WaitForIdle();

FlowEntry *fe =
FlowGet(VrfGet("vrf6")->vrf_id(), vm_a_ip, remote_vm1_ip, 1, 0, 0,
GetFlowKeyNH(input4[0].intf_id));
EXPECT_TRUE(fe != NULL && fe->is_flags_set(FlowEntry::ShortFlow) == true);
DeleteFlow(flow, 1);
DeleteRemoteRoute("vrf6", remote_vm1_ip);
FlowTeardown();
client->WaitForIdle();
}

int main(int argc, char *argv[]) {
GETUSERARGS();

Expand Down

0 comments on commit 1c94e54

Please sign in to comment.