Skip to content

Commit

Permalink
Fix incorrect ACL CRM increment, resulting orchagent crash (#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
prsunny authored and yxieca committed Feb 23, 2019
1 parent dd6bdd9 commit 62b7ca4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1157,8 +1157,10 @@ bool AclTable::create()
attr.value.s32list.list = range_types_list;
table_attrs.push_back(attr);

sai_acl_stage_t acl_stage;
attr.id = SAI_ACL_TABLE_ATTR_ACL_STAGE;
attr.value.s32 = stage == ACL_STAGE_INGRESS ? SAI_ACL_STAGE_INGRESS : SAI_ACL_STAGE_EGRESS;
acl_stage = (stage == ACL_STAGE_INGRESS) ? SAI_ACL_STAGE_INGRESS : SAI_ACL_STAGE_EGRESS;
attr.value.s32 = acl_stage;
table_attrs.push_back(attr);

if (type == ACL_TABLE_MIRROR)
Expand All @@ -1172,7 +1174,7 @@ bool AclTable::create()

if (status == SAI_STATUS_SUCCESS)
{
gCrmOrch->incCrmAclUsedCounter(CrmResourceType::CRM_ACL_TABLE, (sai_acl_stage_t) attr.value.s32, SAI_ACL_BIND_POINT_TYPE_PORT);
gCrmOrch->incCrmAclUsedCounter(CrmResourceType::CRM_ACL_TABLE, acl_stage, SAI_ACL_BIND_POINT_TYPE_PORT);
}

return status == SAI_STATUS_SUCCESS;
Expand Down Expand Up @@ -1954,12 +1956,12 @@ bool AclOrch::removeAclTable(string table_id)

if (deleteUnbindAclTable(table_oid) == SAI_STATUS_SUCCESS)
{
SWSS_LOG_NOTICE("Successfully deleted ACL table %s", table_id.c_str());
m_AclTables.erase(table_oid);

sai_acl_stage_t stage = (m_AclTables[table_oid].stage == ACL_STAGE_INGRESS) ? SAI_ACL_STAGE_INGRESS : SAI_ACL_STAGE_EGRESS;
gCrmOrch->decCrmAclUsedCounter(CrmResourceType::CRM_ACL_TABLE, stage, SAI_ACL_BIND_POINT_TYPE_PORT, table_oid);

SWSS_LOG_NOTICE("Successfully deleted ACL table %s", table_id.c_str());
m_AclTables.erase(table_oid);

return true;
}
else
Expand Down

0 comments on commit 62b7ca4

Please sign in to comment.