Skip to content

Commit 3dcf1f2

Browse files
Support for ACL extensions in metadata (#1178)
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.
1 parent 24076be commit 3dcf1f2

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

meta/saisanitycheck.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,11 @@ bool sai_metadata_is_acl_field_or_action(
435435
{
436436
return true;
437437
}
438+
439+
if (metadata->isextensionattr)
440+
{
441+
return true;
442+
}
438443
}
439444

440445
return false;
@@ -1890,8 +1895,13 @@ void check_attr_acl_fields(
18901895
case SAI_ATTR_VALUE_TYPE_ACL_ACTION_DATA_OBJECT_ID:
18911896
case SAI_ATTR_VALUE_TYPE_ACL_ACTION_DATA_OBJECT_LIST:
18921897

1893-
if (md->objecttype != SAI_OBJECT_TYPE_ACL_ENTRY ||
1894-
md->attrid < SAI_ACL_ENTRY_ATTR_ACTION_START ||
1898+
if (md->objecttype == SAI_OBJECT_TYPE_ACL_ENTRY && md->isextensionattr)
1899+
{
1900+
break;
1901+
}
1902+
1903+
if (md->objecttype != SAI_OBJECT_TYPE_ACL_ENTRY ||
1904+
md->attrid < SAI_ACL_ENTRY_ATTR_ACTION_START ||
18951905
md->attrid > SAI_ACL_ENTRY_ATTR_ACTION_END)
18961906
{
18971907
META_MD_ASSERT_FAIL(md, "acl action may only be set on acl action");
@@ -4112,7 +4122,7 @@ void check_acl_entry_actions()
41124122
break;
41134123
}
41144124

4115-
if (meta->attrid > SAI_ACL_ENTRY_ATTR_ACTION_END)
4125+
if ((meta->isextensionattr == false) && (meta->attrid > SAI_ACL_ENTRY_ATTR_ACTION_END))
41164126
{
41174127
break;
41184128
}

0 commit comments

Comments
 (0)