Skip to content

Commit

Permalink
[PortsOrch] Add reference counting to ports for ACL bindings (#1614)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chaoskao authored Jan 28, 2021
1 parent bbd2ca6 commit 008325c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,13 @@ bool PortsOrch::unbindAclTable(sai_object_id_t port_oid,
return false;
}


Port port;
if (getPort(port_oid, port))
{
decreasePortRefCount(port.m_alias);
}

if (!unbindRemoveAclTableGroup(port_oid, acl_table_oid, acl_stage)) {
return false;
}
Expand Down Expand Up @@ -1307,6 +1314,12 @@ bool PortsOrch::bindAclTable(sai_object_id_t port_oid,
return false;
}

Port port;
if (getPort(port_oid, port))
{
increasePortRefCount(port.m_alias);
}

return true;
}

Expand Down

0 comments on commit 008325c

Please sign in to comment.