Skip to content

Commit

Permalink
[intfsorch] Retrieve Port object before setting NAT zone on router in…
Browse files Browse the repository at this point in the history
…terfaces. (sonic-net#1372)

Method(setRouterIntfsNatZoneId) is called using local Port object that causes orchagent to crash on config reload with non-zero NAT zone configuration.

Orchagent:
Retrieve Port object using getPort method before setting NAT zone on Router interfaces.

Addressing the issue : sonic-net#1312
Signed-off-by: Kumaresh Perumal kumaresh.perumal@intel.com
  • Loading branch information
Kumaresh Perumal authored and abdosi committed Sep 3, 2020
1 parent 2d3a575 commit a8893ec
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,21 +681,24 @@ void IntfsOrch::doTask(Consumer &consumer)
continue;
}

/* Set nat zone id */
if ((!nat_zone.empty()) and (port.m_nat_zone_id != nat_zone_id))
if (gPortsOrch->getPort(alias, port))
{
port.m_nat_zone_id = nat_zone_id;

if (gIsNatSupported)
{
setRouterIntfsNatZoneId(port);
}
else
/* Set nat zone id */
if ((!nat_zone.empty()) and (port.m_nat_zone_id != nat_zone_id))
{
SWSS_LOG_NOTICE("Not set router interface %s NAT Zone Id to %u, as NAT is not supported",
port.m_alias.c_str(), port.m_nat_zone_id);
port.m_nat_zone_id = nat_zone_id;

if (gIsNatSupported)
{
setRouterIntfsNatZoneId(port);
}
else
{
SWSS_LOG_NOTICE("Not set router interface %s NAT Zone Id to %u, as NAT is not supported",
port.m_alias.c_str(), port.m_nat_zone_id);
}
gPortsOrch->setPort(alias, port);
}
gPortsOrch->setPort(alias, port);
}
}

Expand Down

0 comments on commit a8893ec

Please sign in to comment.