Skip to content

Commit

Permalink
Fix agent crash in FlowHandler::Run
Browse files Browse the repository at this point in the history
Issue:
------
for a flow on re-evaluation if it moves from non-NAT to
NAT, instead of marking it as short flow and getting
removed it was getting re-enqueued to partition 0 with
IPC pointer being reset, causing NULL ptr access while
processing the re-enqueued message

Fix:
----
do not allow re-enqueuing of a flow update message

Closes-Bug: 1576818
Change-Id: I96a42eda7ae941da022915fd3bfe8c114a1fe437
  • Loading branch information
Prabhjot Singh Sethi committed May 2, 2016
1 parent 3046a62 commit 48665aa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/vnsw/agent/pkt/flow_handler.cc
Expand Up @@ -61,11 +61,16 @@ bool FlowHandler::Run() {
PktFlowInfo info(agent_, pkt_info_,
flow_proto_->GetTable(flow_table_index_));
std::auto_ptr<FlowTaskMsg> ipc;
bool allow_reentrant = true;

if (pkt_info_->type == PktType::INVALID) {
info.SetPktInfo(pkt_info_);
info.l3_flow = pkt_info_->l3_forwarding = IsL3ModeFlow();
} else if (pkt_info_->type == PktType::MESSAGE) {
// we don't allow reentrancy to different partition if it is
// a reevaluation for an existing flow which will only exist
// in this partition
allow_reentrant = false;
ipc = std::auto_ptr<FlowTaskMsg>(static_cast<FlowTaskMsg *>(pkt_info_->ipc));
pkt_info_->ipc = NULL;
FlowEntry *fe = ipc->fe_ptr.get();
Expand Down Expand Up @@ -115,8 +120,8 @@ bool FlowHandler::Run() {

// Flows that change port-numbers are always processed in thread-0.
// Identify flows that change port and enqueue to thread-0
if (((pkt_info_->sport != info.nat_sport) ||
(pkt_info_->dport != info.nat_dport))) {
if (allow_reentrant && ((pkt_info_->sport != info.nat_sport) ||
(pkt_info_->dport != info.nat_dport))) {
if ((info.nat_sport != 0 || info.nat_dport != 0)) {
if (flow_table_index_ != FlowTable::kPortNatFlowTableInstance) {
// Enqueue flow evaluation to
Expand Down

0 comments on commit 48665aa

Please sign in to comment.