Skip to content

Commit

Permalink
Fix api query when unspecified api passed
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Aug 23, 2021
1 parent cd93183 commit e7e1d80
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/sai_redis_interfacequery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ sai_status_t sai_api_query(
return SAI_STATUS_INVALID_PARAMETER;
}

if (sai_api_id == SAI_API_UNSPECIFIED)
{
SWSS_LOG_ERROR("api ID is unspecified api");

return SAI_STATUS_INVALID_PARAMETER;
}

if (sai_metadata_get_enum_value_name(&sai_metadata_enum_sai_api_t, sai_api_id))
{
*api_method_table = ((void**)&redis_apis)[sai_api_id - 1];
Expand Down
7 changes: 7 additions & 0 deletions vslib/sai_vs_interfacequery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ sai_status_t sai_api_query(
return SAI_STATUS_INVALID_PARAMETER;
}

if (sai_api_id == SAI_API_UNSPECIFIED)
{
SWSS_LOG_ERROR("api ID is unspecified api");

return SAI_STATUS_INVALID_PARAMETER;
}

if (sai_metadata_get_enum_value_name(&sai_metadata_enum_sai_api_t, sai_api_id))
{
*api_method_table = ((void**)&vs_apis)[sai_api_id - 1];
Expand Down

0 comments on commit e7e1d80

Please sign in to comment.