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 [email protected]
  • Loading branch information
Kumaresh Perumal authored Aug 11, 2020
1 parent 85c5701 commit 36fe710
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 @@ -712,21 +712,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 36fe710

Please sign in to comment.