Skip to content

Commit

Permalink
Fix the EVPN orch may access invalid address
Browse files Browse the repository at this point in the history
There is an private pointer in the EVPN orch which is used save the local
vtep. But the local vtep is add/removed in the vxlan tunnel orch, the
vxlan tunnel orch did not notify EVPN orch when remove the vtep and cause
EVPN orch may access invalid address
  • Loading branch information
gord1306 committed Mar 3, 2021
1 parent 721f47d commit bbdf214
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions orchagent/vxlanorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ bool VxlanTunnelOrch::delOperation(const Request& request)
SWSS_LOG_ENTER();

const auto& tunnel_name = request.getKeyString(0);
EvpnNvoOrch* evpn_orch = gDirectory.get<EvpnNvoOrch*>();

if (!isTunnelExists(tunnel_name))
{
Expand All @@ -1405,6 +1406,11 @@ bool VxlanTunnelOrch::delOperation(const Request& request)
return false;
}

if (vtep_ptr == evpn_orch->getEVPNVtep())
{
evpn_orch->delEVPNVtep();
}

vxlan_tunnel_table_.erase(tunnel_name);

SWSS_LOG_NOTICE("Vxlan tunnel '%s' was removed", tunnel_name.c_str());
Expand Down
5 changes: 5 additions & 0 deletions orchagent/vxlanorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,11 @@ class EvpnNvoOrch : public Orch2
return source_vtep_ptr;
}

void delEVPNVtep()
{
source_vtep_ptr = NULL;
}

private:
virtual bool addOperation(const Request& request);
virtual bool delOperation(const Request& request);
Expand Down

0 comments on commit bbdf214

Please sign in to comment.