Skip to content

Commit 5516ec4

Browse files
authored
Check RIF/Port exists only for add entries (sonic-net#1110)
1 parent 59440f2 commit 5516ec4

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

orchagent/neighorch.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -317,27 +317,27 @@ void NeighOrch::doTask(Consumer &consumer)
317317
continue;
318318
}
319319

320-
Port p;
321-
if (!gPortsOrch->getPort(alias, p))
322-
{
323-
SWSS_LOG_INFO("Port %s doesn't exist", alias.c_str());
324-
it++;
325-
continue;
326-
}
327-
328-
if (!p.m_rif_id)
329-
{
330-
SWSS_LOG_INFO("Router interface doesn't exist on %s", alias.c_str());
331-
it++;
332-
continue;
333-
}
334-
335320
IpAddress ip_address(key.substr(found+1));
336321

337322
NeighborEntry neighbor_entry = { ip_address, alias };
338323

339324
if (op == SET_COMMAND)
340325
{
326+
Port p;
327+
if (!gPortsOrch->getPort(alias, p))
328+
{
329+
SWSS_LOG_INFO("Port %s doesn't exist", alias.c_str());
330+
it++;
331+
continue;
332+
}
333+
334+
if (!p.m_rif_id)
335+
{
336+
SWSS_LOG_INFO("Router interface doesn't exist on %s", alias.c_str());
337+
it++;
338+
continue;
339+
}
340+
341341
MacAddress mac_address;
342342
for (auto i = kfvFieldsValues(t).begin();
343343
i != kfvFieldsValues(t).end(); i++)

0 commit comments

Comments
 (0)