Skip to content

Commit

Permalink
Support for ACL extensions in metadata (opencomputeproject#1178)
Browse files Browse the repository at this point in the history
SAI sanitychecker doesn't expect any extensions to be developed for ACL attributes. This PR aims to add support by adding checks whether the 'under-check-attribute' is an extension attribute. The value range for an attribute between SAI_ACL_ENTRY_ATTR_ACTION_START and SAI_ACL_ENTRY_ATTR_ACTION_END is valid only for non-extensions. The extensions are to have attributes beyond SAI_ACL_ENTRY_ATTR_ACTION_END. This PR allows the range check to be conditional for extension attributes.
  • Loading branch information
bandaru-viswanath authored Feb 4, 2021
1 parent 24076be commit 3dcf1f2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions meta/saisanitycheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,11 @@ bool sai_metadata_is_acl_field_or_action(
{
return true;
}

if (metadata->isextensionattr)
{
return true;
}
}

return false;
Expand Down Expand Up @@ -1890,8 +1895,13 @@ void check_attr_acl_fields(
case SAI_ATTR_VALUE_TYPE_ACL_ACTION_DATA_OBJECT_ID:
case SAI_ATTR_VALUE_TYPE_ACL_ACTION_DATA_OBJECT_LIST:

if (md->objecttype != SAI_OBJECT_TYPE_ACL_ENTRY ||
md->attrid < SAI_ACL_ENTRY_ATTR_ACTION_START ||
if (md->objecttype == SAI_OBJECT_TYPE_ACL_ENTRY && md->isextensionattr)
{
break;
}

if (md->objecttype != SAI_OBJECT_TYPE_ACL_ENTRY ||
md->attrid < SAI_ACL_ENTRY_ATTR_ACTION_START ||
md->attrid > SAI_ACL_ENTRY_ATTR_ACTION_END)
{
META_MD_ASSERT_FAIL(md, "acl action may only be set on acl action");
Expand Down Expand Up @@ -4112,7 +4122,7 @@ void check_acl_entry_actions()
break;
}

if (meta->attrid > SAI_ACL_ENTRY_ATTR_ACTION_END)
if ((meta->isextensionattr == false) && (meta->attrid > SAI_ACL_ENTRY_ATTR_ACTION_END))
{
break;
}
Expand Down

0 comments on commit 3dcf1f2

Please sign in to comment.