Skip to content

Commit

Permalink
Validation checks and diagnostics.
Browse files Browse the repository at this point in the history
For following:
- If MPLS label is changing NH, then make sure non MCAST label does not point to
Composite NH of type L2 Comp.
- Temporarily store peer name in path.

Change-Id: I456ef6875e34f074a105f67e8e2866993e0ea30d
Partial-bug: #1548265
  • Loading branch information
manishsing committed May 3, 2016
1 parent d25b171 commit 629349b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vnsw/agent/oper/agent_path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ AgentPath::AgentPath(const Peer *peer, AgentRoute *rt):
is_subnet_discard_(false), dependant_rt_(rt), path_preference_(),
local_ecmp_mpls_label_(rt), composite_nh_key_(NULL), subnet_service_ip_(),
arp_mac_(), arp_interface_(NULL), arp_valid_(false),
ecmp_suppressed_(false) {
ecmp_suppressed_(false), peer_str_(peer ? peer->GetName() : "UNKNOWN") {
}

AgentPath::~AgentPath() {
Expand Down
1 change: 1 addition & 0 deletions src/vnsw/agent/oper/agent_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ class AgentPath : public Path {
// by taking only one of the nexthop from the path
bool ecmp_suppressed_;
EcmpLoadBalance ecmp_load_balance_;
std::string peer_str_;
DISALLOW_COPY_AND_ASSIGN(AgentPath);
};

Expand Down
9 changes: 9 additions & 0 deletions src/vnsw/agent/oper/mpls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,20 @@ bool MplsTable::OnChange(DBEntry *entry, const DBRequest *req) {
return ret;
}

void ValidateNH(const MplsLabel *mpls, NextHop *nh) {
CompositeNH *cnh = dynamic_cast<CompositeNH *>(nh);
if (!cnh)
return;
if (cnh->composite_nh_type() == Composite::L2COMP)
assert(mpls->GetType() == MplsLabel::MCAST_NH);
}

bool MplsTable::ChangeNH(MplsLabel *mpls, NextHop *nh) {
if (mpls == NULL)
return false;

if (mpls->nh_ != nh) {
ValidateNH(mpls, nh);
mpls->nh_ = nh;
assert(nh);
mpls->SyncDependentPath();
Expand Down

0 comments on commit 629349b

Please sign in to comment.