Skip to content

Commit

Permalink
* Copy ARP mac, interface and resolved flag in Sync() API of route
Browse files Browse the repository at this point in the history
Routes and nexthops dependent on ARP route are updated, when
any variable in ARP nexthop are changed. When ARP timer is
expired, nexthop gets marked as invalid and route Sync is triggered,
in this sync() API arp_mac and valid flags were not updated, hence
eventually when ARP resolution succeds, there would be no change in
agent path and the dependent nexthop would not be resolved.
Test case for same
Closes-bug:#1457337

Change-Id: I5c5c168367ce706a347a93f9f4852f8c5b68e95b
  • Loading branch information
naveen-n committed Jun 15, 2015
1 parent 9dd4571 commit 27cd794
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
29 changes: 28 additions & 1 deletion src/vnsw/agent/oper/agent_path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ bool AgentPath::Sync(AgentRoute *sync_route) {
}
}

if (nh_ && nh_->GetType() == NextHop::ARP) {
if (CopyArpData()) {
ret = true;
}
}

if (vrf_name_ == Agent::NullString()) {
return ret;
}
Expand Down Expand Up @@ -288,7 +294,6 @@ bool AgentPath::Sync(AgentRoute *sync_route) {
dependant_rt_.reset(rt);
ret = true;
}

return ret;
}

Expand All @@ -310,6 +315,28 @@ void AgentPath::set_nexthop(NextHop *nh) {
nh_ = nh;
}

bool AgentPath::CopyArpData() {
bool ret = false;
if (nh_ && nh_->GetType() == NextHop::ARP) {
const ArpNH *arp_nh = static_cast<const ArpNH *>(nh_.get());
if (arp_mac() != arp_nh->GetMac()) {
set_arp_mac(arp_nh->GetMac());
ret = true;
}

if (arp_interface() != arp_nh->GetInterface()) {
set_arp_interface(arp_nh->GetInterface());
ret = true;
}

if (arp_valid() != arp_nh->IsValid()) {
set_arp_valid(arp_nh->IsValid());
ret = true;
}
}
return ret;
}

EvpnDerivedPath::EvpnDerivedPath(const EvpnPeer *evpn_peer,
const IpAddress &ip_addr,
uint32_t ethernet_tag,
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 @@ -208,6 +208,7 @@ class AgentPath : public Path {

bool arp_valid() const { return arp_valid_;}
void set_arp_valid(bool valid) { arp_valid_ = valid;}
bool CopyArpData();

private:
const Peer *peer_;
Expand Down
14 changes: 1 addition & 13 deletions src/vnsw/agent/oper/inet_unicast_route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -753,19 +753,7 @@ bool Inet4UnicastArpRoute::AddChangePath(Agent *agent, AgentPath *path,
ret = true;

if (nh) {
const ArpNH *arp_nh = static_cast<const ArpNH *>(nh);
if (path->arp_mac() != arp_nh->GetMac()) {
path->set_arp_mac(arp_nh->GetMac());
ret = true;
}

if (path->arp_interface() != arp_nh->GetInterface()) {
path->set_arp_interface(arp_nh->GetInterface());
ret = true;
}

if (path->arp_valid() != arp_nh->IsValid()) {
path->set_arp_valid(arp_nh->IsValid());
if (path->CopyArpData()) {
ret = true;
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/vnsw/agent/test/test_route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,11 @@ TEST_F(RouteTest, RemoteVmRoute_4) {
client->NHWait(6);
EXPECT_TRUE(addr_nh->IsValid() == false);

//Readd ARP and verify tunnel NH is changed
AddArp(server1_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0e", eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(addr_nh->IsValid() == true);

//Delete Remote VM route
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
Expand Down

0 comments on commit 27cd794

Please sign in to comment.