forked from Juniper/contrail-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote branch 'upstream/master'
- Loading branch information
Showing
12 changed files
with
103 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,6 @@ if sys.platform != 'darwin': | |
sandesh_objs + | ||
[ | ||
'diag.cc', | ||
'ping.cc' | ||
'ping.cc', | ||
'diag_pkt_handler.cc' | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved. | ||
* */ | ||
|
||
#include <map> | ||
#include "vr_defs.h" | ||
#include "base/timer.h" | ||
#include "cmn/agent_cmn.h" | ||
#include "pkt/proto.h" | ||
#include "pkt/proto_handler.h" | ||
#include "diag/diag.h" | ||
#include "diag/diag_proto.h" | ||
#include "diag/ping.h" | ||
#include "oper/mirror_table.h" | ||
|
||
|
||
void DiagPktHandler::SetReply() { | ||
AgentDiagPktData *ad = (AgentDiagPktData *)pkt_info_->data; | ||
ad->op_ = htonl(AgentDiagPktData::DIAG_REPLY); | ||
} | ||
|
||
void DiagPktHandler::SetDiagChkSum() { | ||
pkt_info_->ip->check = 0xffff; | ||
} | ||
|
||
void DiagPktHandler::Reply() { | ||
SetReply(); | ||
Swap(); | ||
SetDiagChkSum(); | ||
Send(GetLen() - (2 * IPC_HDR_LEN), GetIntf(), GetVrf(), | ||
AGENT_CMD_ROUTE, PktHandler::DIAG); | ||
} | ||
bool DiagPktHandler::Run() { | ||
AgentDiagPktData *ad = (AgentDiagPktData *)pkt_info_->data; | ||
|
||
if (!ad) { | ||
//Ignore if packet doesnt have proper L4 header | ||
return true; | ||
} | ||
if (ntohl(ad->op_) == AgentDiagPktData::DIAG_REQUEST) { | ||
//Request received swap the packet | ||
//and dump the packet back | ||
Reply(); | ||
return false; | ||
} | ||
|
||
if (ntohl(ad->op_) != AgentDiagPktData::DIAG_REPLY) { | ||
return true; | ||
} | ||
//Reply for a query we sent | ||
DiagEntry::DiagKey key = ntohl(ad->key_); | ||
DiagEntry *entry = diag_table_->Find(key); | ||
if (!entry) { | ||
return true; | ||
} | ||
|
||
entry->HandleReply(this); | ||
|
||
if (entry->GetSeqNo() == entry->GetCount()) { | ||
DiagEntryOp *op; | ||
op = new DiagEntryOp(DiagEntryOp::DELETE, entry); | ||
entry->diag_table()->Enqueue(op); | ||
} else { | ||
entry->Retry(); | ||
} | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters