Skip to content

Commit 62b7ca4

Browse files
prsunnyyxieca
authored andcommitted
Fix incorrect ACL CRM increment, resulting orchagent crash (#800)
1 parent dd6bdd9 commit 62b7ca4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

orchagent/aclorch.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,8 +1157,10 @@ bool AclTable::create()
11571157
attr.value.s32list.list = range_types_list;
11581158
table_attrs.push_back(attr);
11591159

1160+
sai_acl_stage_t acl_stage;
11601161
attr.id = SAI_ACL_TABLE_ATTR_ACL_STAGE;
1161-
attr.value.s32 = stage == ACL_STAGE_INGRESS ? SAI_ACL_STAGE_INGRESS : SAI_ACL_STAGE_EGRESS;
1162+
acl_stage = (stage == ACL_STAGE_INGRESS) ? SAI_ACL_STAGE_INGRESS : SAI_ACL_STAGE_EGRESS;
1163+
attr.value.s32 = acl_stage;
11621164
table_attrs.push_back(attr);
11631165

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

11731175
if (status == SAI_STATUS_SUCCESS)
11741176
{
1175-
gCrmOrch->incCrmAclUsedCounter(CrmResourceType::CRM_ACL_TABLE, (sai_acl_stage_t) attr.value.s32, SAI_ACL_BIND_POINT_TYPE_PORT);
1177+
gCrmOrch->incCrmAclUsedCounter(CrmResourceType::CRM_ACL_TABLE, acl_stage, SAI_ACL_BIND_POINT_TYPE_PORT);
11761178
}
11771179

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

19551957
if (deleteUnbindAclTable(table_oid) == SAI_STATUS_SUCCESS)
19561958
{
1957-
SWSS_LOG_NOTICE("Successfully deleted ACL table %s", table_id.c_str());
1958-
m_AclTables.erase(table_oid);
1959-
19601959
sai_acl_stage_t stage = (m_AclTables[table_oid].stage == ACL_STAGE_INGRESS) ? SAI_ACL_STAGE_INGRESS : SAI_ACL_STAGE_EGRESS;
19611960
gCrmOrch->decCrmAclUsedCounter(CrmResourceType::CRM_ACL_TABLE, stage, SAI_ACL_BIND_POINT_TYPE_PORT, table_oid);
19621961

1962+
SWSS_LOG_NOTICE("Successfully deleted ACL table %s", table_id.c_str());
1963+
m_AclTables.erase(table_oid);
1964+
19631965
return true;
19641966
}
19651967
else

0 commit comments

Comments
 (0)