Skip to content

Commit 008325c

Browse files
authored
[PortsOrch] Add reference counting to ports for ACL bindings (#1614)
What I did: Use reference count for protect interface, If interface bind to ACL the reference will increase and vice versa. Why I did it: If interface bind to ACL and remove LAG causes the ACL rule become global rule to match all interfaces. How I verified it: Run the pytest check ACL and Port test case passed.
1 parent bbd2ca6 commit 008325c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

orchagent/portsorch.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,13 @@ bool PortsOrch::unbindAclTable(sai_object_id_t port_oid,
12471247
return false;
12481248
}
12491249

1250+
1251+
Port port;
1252+
if (getPort(port_oid, port))
1253+
{
1254+
decreasePortRefCount(port.m_alias);
1255+
}
1256+
12501257
if (!unbindRemoveAclTableGroup(port_oid, acl_table_oid, acl_stage)) {
12511258
return false;
12521259
}
@@ -1307,6 +1314,12 @@ bool PortsOrch::bindAclTable(sai_object_id_t port_oid,
13071314
return false;
13081315
}
13091316

1317+
Port port;
1318+
if (getPort(port_oid, port))
1319+
{
1320+
increasePortRefCount(port.m_alias);
1321+
}
1322+
13101323
return true;
13111324
}
13121325

0 commit comments

Comments
 (0)