Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for filetype id before doing version check #174

Merged
merged 2 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions source/include/ota_config_defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,19 @@
#define otaconfigAllowDowngrade 0U
#endif

/**
* @brief The file type id received in the job document.
*
* @note The file type id received in the job document that allows devices
* to identify the type of file received from the cloud. This configuration
* defines the file type id used for firmware updates. If this is changed
* then the updated value must be used while creating firmware update jobs.
*
*/
#ifndef configOTA_FIRMWARE_UPDATE_FILE_TYPE_ID
#define configOTA_FIRMWARE_UPDATE_FILE_TYPE_ID 0U
#endif

/**
* @brief The protocol selected for OTA control operations.
*
Expand Down
2 changes: 1 addition & 1 deletion source/ota.c
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ static OtaErr_t validateUpdateVersion( const OtaFileContext_t * pFileContext )
( void ) newVersion; /* For suppressing compiler-warning: unused variable. */

/* Only check for versions if the target is self */
if( otaAgent.serverFileID == 0U )
if( ( otaAgent.serverFileID == 0U ) && ( otaAgent.fileContext.fileType == configOTA_FIRMWARE_UPDATE_FILE_TYPE_ID ) )
{
/* Check if version reported is the same as the running version. */
if( pFileContext->updaterVersion == appFirmwareVersion.u.unsignedVersion32 )
Expand Down