Skip to content

Commit

Permalink
Fixed test failure for 'AclOrchTest.AclTableType_ActionValidation' ca…
Browse files Browse the repository at this point in the history
…used by uninitialied src and dst IP addresses.

Signed-off-by: Mahdi Ramezani <mramezani@microsoft.com>
  • Loading branch information
mramezani95 committed Nov 13, 2024
1 parent f09153f commit 45323f4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion orchagent/mirrororch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ task_process_status MirrorOrch::createEntry(const string& key, const vector<Fiel
{
SWSS_LOG_ENTER();

bool src_ip_initialized = false;
bool dst_ip_initialized = false;

auto session = m_syncdMirrors.find(key);
if (session != m_syncdMirrors.end())
{
Expand All @@ -397,10 +400,12 @@ task_process_status MirrorOrch::createEntry(const string& key, const vector<Fiel
if (fvField(i) == MIRROR_SESSION_SRC_IP)
{
entry.srcIp = fvValue(i);
src_ip_initialized = true;
}
else if (fvField(i) == MIRROR_SESSION_DST_IP)
{
entry.dstIp = fvValue(i);
dst_ip_initialized = true;
}
else if (fvField(i) == MIRROR_SESSION_GRE_TYPE)
{
Expand Down Expand Up @@ -485,7 +490,7 @@ task_process_status MirrorOrch::createEntry(const string& key, const vector<Fiel
}
}
// Entry validation as a whole
if (entry.srcIp.getIp().family != entry.dstIp.getIp().family)
if (src_ip_initialized && dst_ip_initialized && entry.srcIp.getIp().family != entry.dstIp.getIp().family)
{
SWSS_LOG_ERROR("Address family of source and destination IPs is different");
return task_process_status::task_invalid_entry;
Expand Down

0 comments on commit 45323f4

Please sign in to comment.